create and subscribe transmission handler
This commit is contained in:
parent
e01e13cd9f
commit
f595ac746f
@ -16,7 +16,7 @@ class DeviceIrTx : public Device {
|
||||
private:
|
||||
byte pin_irtx;
|
||||
IRsend irsend;
|
||||
decode_results results;
|
||||
bool irTxHandler(String message);
|
||||
HomieNode irTxNode = HomieNode("irtx", "irtx");
|
||||
};
|
||||
|
||||
@ -24,13 +24,18 @@ void DeviceIrTx::deviceSetup() {
|
||||
pinMode(pin_irtx, OUTPUT);
|
||||
}
|
||||
|
||||
bool DeviceIrTx::irTxHandler(String message) {
|
||||
irsend.sendSony(0xa90, 12);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeviceIrTx::deviceRegister() {
|
||||
irTxNode.subscribe("irtx", [this](String value) { return irTxHandler(value); });
|
||||
Homie.registerNode(irTxNode);
|
||||
}
|
||||
|
||||
void DeviceIrTx::deviceLoop() {
|
||||
irsend.sendSony(0xa90, 12);
|
||||
delay(500);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user