|
LightHub 4.6.0
Open-source smart home controller firmware
|
Relay (ON/OFF output) driver (CH_RELAY = 6 / CH_RELAYX = 16). More...
#include <out_relay.h>
Public Member Functions | |
| void | link (Item *_item) |
| Attach to an item and read its pin/period configuration. | |
| void | getConfig () |
| Read pin and pulse period from the item arguments (negative pin = inverted). | |
| void | relay (bool state) |
| Physically switch the relay and publish the new action state. | |
| int | Setup () override |
| Initialize the pin (OUTPUT, inactive) and remember the state if the item is active. | |
| int | Poll (short cause) override |
| For CH_RELAYX: toggle the relay on/off according to the configured period and /set value. | |
| int | Stop () override |
| Release the pin and mark the driver uninitialized. | |
| int | getChanType () override |
| Channel type of the driver. | |
| int | Ctrl (itemCmd cmd, char *subItem=NULL, bool toExecute=true, bool authorized=false) override |
| Handle /set (duration/turn-on) and /cmd (ON/OFF/TOGGLE/XON/XOFF/HALT/REST) commands. | |
| Public Member Functions inherited from abstractOut | |
| abstractOut () | |
| virtual int | isActive () |
| virtual bool | isAllowed (itemCmd cmd) |
| virtual itemCmd | getDefaultOnVal () |
| virtual int | Status () override |
| virtual void | setStatus (uint8_t status) override |
| Item * | getItem () |
| Public Member Functions inherited from abstractCh | |
| abstractCh () | |
| virtual | ~abstractCh () |
Protected Attributes | |
| short | pin |
| bool | inverted |
| uint32_t | period |
| Protected Attributes inherited from abstractOut | |
| Item * | item |
| Item currently linked to this driver. | |
Additional Inherited Members | |
| Protected Member Functions inherited from abstractOut | |
| int | pubAction (bool state) |
| Protected Member Functions inherited from abstractCh | |
| int | publishTopic (const char *topic, long value, const char *subtopic=NULL) |
| int | publishTopic (const char *topic, float value, const char *subtopic=NULL) |
| int | publishTopic (const char *topic, const char *value, const char *subtopic=NULL, const char *suffix=NULL) |
Relay (ON/OFF output) driver (CH_RELAY = 6 / CH_RELAYX = 16).
Switches a digital output pin. In the simple CH_RELAY form the relay is latched; in the CH_RELAYX form it is a pulse output: after each turn-on the relay stays active for val/255 of the configured period and is switched off by the polling loop.
JSON config (item argument array):
A negative pin number selects an inverted output (active-low).
Commands (/cmd): ON / OFF / TOGGLE / XON / XOFF / HALT / REST, plus a /set percent value which defines the ON duration for CH_RELAYX.
|
overridevirtual |
Handle /set (duration/turn-on) and /cmd (ON/OFF/TOGGLE/XON/XOFF/HALT/REST) commands.
Implements abstractOut.
|
overridevirtual |
Channel type of the driver.
Reimplemented from abstractOut.
| void out_relay::getConfig | ( | ) |
Read pin and pulse period from the item arguments (negative pin = inverted).
|
inlinevirtual |
Attach to an item and read its pin/period configuration.
Reimplemented from abstractOut.
|
overridevirtual |
For CH_RELAYX: toggle the relay on/off according to the configured period and /set value.
Reimplemented from abstractCh.
| void out_relay::relay | ( | bool | state | ) |
Physically switch the relay and publish the new action state.
|
overridevirtual |
Initialize the pin (OUTPUT, inactive) and remember the state if the item is active.
????
Reimplemented from abstractOut.
|
overridevirtual |
Release the pin and mark the driver uninitialized.
Reimplemented from abstractCh.
|
protected |
|
protected |
|
protected |