dawidchyrzynski / arduino-home-assistant

ArduinoHA allows to integrate an Arduino/ESP based device with Home Assistant using MQTT.
https://dawidchyrzynski.github.io/arduino-home-assistant/
GNU Affero General Public License v3.0
508 stars 119 forks source link

Wireless generator control use case #87

Closed zorrobyte closed 2 years ago

zorrobyte commented 2 years ago

Howdy!

I plan on writing a sketch to auto start/stop a Cummins Onan generator. I will need to write the logic manually and control it with relays. I plan on PR'ing my example once working

The unsolved use case I need to figure out would be some sort of heartbeat. I plan on subscribing to an MQTT RUN and STOP state from Node-Red/Home Assistant node. The issue is that I need to monitor on the Arduino side that my Home Assistant/Node-Red is actually connected and sending RUN and STOP commands (sending every 5 seconds or so) and stop the generator if the connection is lost.

Otherwise, the generator will just stay running and deplete all petrol.

I noticed there is a Reporting availability (online/offline states) of a device, is this available on the arduino side? And if not too much trouble, could you provide a code example?

Thanks! I have several Arduino IOT boards coming and will also be wiring up solar panel actuators and other things.

dawidchyrzynski commented 2 years ago

Hi @zorrobyte,

There is a new version of the library released. Maybe you will find something useful for your use case in the documentation: https://dawidchyrzynski.github.io/arduino-home-assistant/