34 void relay(
bool state);
38 int Poll(
short cause)
override;
45 int Ctrl(
itemCmd cmd,
char* subItem=NULL,
bool toExecute=
true,
bool authorized =
false)
override;
A single LightHub item (virtual channel).
Definition item.h:232
abstractOut()
Definition abstractout.h:22
virtual void link(Item *_item)
Definition abstractout.h:24
Command + value container passed between items, drivers and MQTT.
Definition itemCmd.h:306
Relay (ON/OFF output) driver (CH_RELAY = 6 / CH_RELAYX = 16).
Definition out_relay.h:27
void link(Item *_item)
Attach to an item and read its pin/period configuration.
Definition out_relay.h:30
int Setup() override
Initialize the pin (OUTPUT, inactive) and remember the state if the item is active.
Definition out_relay.cpp:34
bool inverted
Definition out_relay.h:49
uint32_t period
Definition out_relay.h:50
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.
Definition out_relay.cpp:104
short pin
Definition out_relay.h:48
int getChanType() override
Channel type of the driver.
Definition out_relay.cpp:186
int Poll(short cause) override
For CH_RELAYX: toggle the relay on/off according to the configured period and /set value.
Definition out_relay.cpp:72
void getConfig()
Read pin and pulse period from the item arguments (negative pin = inverted).
Definition out_relay.cpp:12
void relay(bool state)
Physically switch the relay and publish the new action state.
Definition out_relay.cpp:61
int Stop() override
Release the pin and mark the driver uninitialized.
Definition out_relay.cpp:53
Item (virtual channel) system of LightHub.