Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for H-Bridge Switch #4233

Merged
merged 8 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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