@hartman9 wrote:
I am trying to setup a binary sensor to trigger an alert if an mqtt sensor I have does not check in every four hours. The time sensor is setup and looks like this on my dashboard.
Which would seem quite perfect as it displays how long ago the sensor checked in with HA. But of course this is not how it is displayed under my states. It just gives me the raw date and time.My question of course is how do I best use this to create a binary sensor which I then can take to trigger an alert? Obviously, in my perfect non-coding world it would be easiest to do something like this below but that clearly won’t work. Do I need to convert the raw timestamp somehow or what is the best way to attack this? Any help would be greatly appreciate, thanks.
- platform: template sensors: mail_box_sensor_lastboot_over4hours: value_template: "{% if states('sensor.water_heater_alarm_last_boot_time') > 4 minutes} on {% else %} off {%endif %}" friendly_name: '4 hour Test'
Posts: 3
Participants: 2