Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95414

Binary Sensor for timestamp Device Class

$
0
0

@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.

Annotation%202019-11-14%20102412-1
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

Read full topic


Viewing all articles
Browse latest Browse all 95414

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>