Check temperature evolution

Hi,
I am new to HASSIO so I apologize if this has already been explained somewhere…
I made my own Temp and Humidity Sensor (DHT22 + RF module) that i am reading in HASSIO. I have no way of knowing the Battery level so was thinking of checking the Temp value over let’s say 4 hours. I the temperature has not changed in that time, that would means my batteries are flat and need to be recharged; but how to perform this in HASSIO…??
Thank you.

I was just posting about that here.

You need a sensor.time_date:

sensor:
  - platform: time_date
    display_options:
      - 'time'

And then use the last_changed value in an automation. The as_timestamp gives you a value in seconds, so you need to compare the difference to the number of seconds in four hours:

automation:
  trigger:
    - platform: template
      value_template: "{{ (as_timestamp(states.sensor.time.last_changed) - as_timestamp(states.YOUR.ENTITY.last_changed)) > (60 * 60 * 4) }}"
  action:
    ...