Closed ivanfmartinez closed 3 years ago
What should be the mechanism, you want to use in the main loop to trigger sending of the state? Should that be timewise periodic trigger? Then it would be better to introduce this timewise periodic trigger into the Node loop and to make it configurable through a constructor parameter. Sensor nodes implement that normally this way.
I'm using the send statistics Homie Event:
void onHomieEvent(const HomieEvent& event) {
switch(event.type) {
case HomieEventType::SENDING_STATISTICS:
// Do whatever you want when statistics are sent in normal mode
rele1.sendState();
rele2.sendState();
Won't merge
This make possible to trigger sendState from the main Homie loop, or on any HomieEvent.
In my case I want to publish more frequently the state to keep my automation system aware of the states even if any message was lost.