luebbe / homie-node-collection

Collection of Node implementations for the Homie-ESP8266 library
MIT License
26 stars 12 forks source link

make sendState public #8

Closed ivanfmartinez closed 3 years ago

ivanfmartinez commented 4 years ago

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.

kleini commented 4 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.

ivanfmartinez commented 4 years ago

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();
luebbe commented 3 years ago

Won't merge