Skip to content

Commit

Permalink
Add docs for H-Bridge Switch (#4233)
Browse files Browse the repository at this point in the history
* Add docs for H-Bridge Switch

* optimistic mode

* Update hbridge.rst

---------

Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
  • Loading branch information
dwmw2 and kbx81 authored Dec 2, 2024
1 parent 6af4943 commit 8b6e425
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions components/switch/hbridge.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
H-bridge Switch
===============

.. seo::
:description: Instructions for setting up H-Bridge controlled switches (or relays).
:image: hbridge-relay.jpg

The ``hbridge`` switch platform allows you to drive an *h-bridge* controlled latching relay.

.. figure:: images/hbridge-relay.png
:align: center
:width: 50.0%

Omron G6CK-2117P relay module.

.. code-block:: yaml
# Example configuration entry
switch:
- platform: hbridge
id: my_relay
name: "Relay"
on_pin: GPIOXX
off_pin: GPIOXX
pulse_length: 50ms
wait_time: 50ms
Configuration variables:
------------------------

- **on_pin** (**Required**, :ref:`config-pin_schema`): The GPIO pin to pulse to turn on the switch.
- **off_pin** (**Required**, :ref:`config-pin_schema`): The GPIO pin to pulse to turn off the switch.
- **pulse_length** (*Optional*, :ref:`config-time`): The length in milliseconds of the pulse sent on ``on_pin`` and ``off_pin`` to change switch state. Defaults to ``100 ms``.
- **wait_time** (*Optional*, :ref:`config-time`): The time in milliseconds to delay between pulses on ``off_pin`` and ``on_pin``. Defaults to no delay.
- **optimistic** (*optional*, boolean): Whether to operate in optimistic mode - when in this mode,
any command sent to the switch will immediately update the reported state. Defaults to ``false``, and the reported state updates only at the end of the pulse.

- All other options from :ref:`Switch Component <config-switch>`.

See Also
--------

- :doc:`/components/output/index`
- :doc:`/components/switch/index`
- :apiref:`hbridge/switch/hbridge_switch.h`
- :ghedit:`Edit`
Binary file added components/switch/images/hbridge-relay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hbridge-relay.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ Switch Components
Factory Reset Switch, components/switch/factory_reset, restart-alert.svg, dark-invert
Generic Output Switch, components/switch/output, upload.svg, dark-invert
GPIO Switch, components/switch/gpio, gpio.svg
H-bridge Switch, components/switch/hbridge, hbridge-relay.jpg
LVGL Widget, components/switch/lvgl, lvgl_c_swi.png
Modbus Switch, components/switch/modbus_controller, modbus.png
Nextion Switch, components/switch/nextion, nextion.jpg
Expand Down

0 comments on commit 8b6e425

Please sign in to comment.