Home Assistant is brilliant.
I'm tidying up some error checking and mode logic for the lINUX C program that controls the advanced energy buffering, time-shifting and energy flow functions. Needed a way to easily and reliably make sure the program is actually sending data via MQTT to HA so it runs in the correct mode. The simplest way I found was to simply use the HA MQTT 'message received' trigger' to set a HA 'counter' to 1 when it receives data from the energy program in a HA Connected automation and another write HA Disconnected automation to set the counter to 0 when the HA Connected automation trigger (update time set when MQTT data is received) has not happened for X seconds.




https://www.home-assistant.io/docs/automation/templating/#available-this-data
All done with the GUI.
I'm tidying up some error checking and mode logic for the lINUX C program that controls the advanced energy buffering, time-shifting and energy flow functions. Needed a way to easily and reliably make sure the program is actually sending data via MQTT to HA so it runs in the correct mode. The simplest way I found was to simply use the HA MQTT 'message received' trigger' to set a HA 'counter' to 1 when it receives data from the energy program in a HA Connected automation and another write HA Disconnected automation to set the counter to 0 when the HA Connected automation trigger (update time set when MQTT data is received) has not happened for X seconds.




https://www.home-assistant.io/docs/automation/templating/#available-this-data
All done with the GUI.





























































