Notification in case no values have been recorded since X

Hi all,

I’m using a HA setup, which is somehow restriced concerning how I can access the system and therefore, I only check recorded values once I’m sitting in front of a dedicated PC.

Last week, something happened and the HA stopped recording temperature values and no one noticed that, because recently no one has been using the dedicated PC.

Therefore my question is: is there something already availabe to e.g. write a log and to put this one to a samba share (which I could check from another PC). Or is there an idea existing, concerning how this isolated system could make itself heard?

Thanks,
Till

Are you recording a sensor’s value? If yes, you can create an automation to notify you if the sensor goes to unavailable state.

trigger:
  - platform: state
    entity_id: sensor.helloworld
    to: unavailable
    for: '00:01:00'
action:
  - service: notify.mobile_app_your_name
    data:
      message: Alert!

One way to detect if a sensor’s value is stale (i.e. has not changed for a long time) is to compare the entity’s last_changed to the current time. If it’s more than some threshold value, like 30 minutes, that means the entity’s value hasn’t changed in the past half-hour.

You can create an automation with a Template Trigger that triggers when the monitored temperature sensor is stale. The action can be whatever you want. It can log the incident to a file, notify you, do both and more. In the example below it simply posts a notification to all notification services you have configured.

alias: example abc123
trigger:
- platform: template
  value_template: "{{ now() - states.sensor.temperature.last_changed >= timedelta (minutes=30) }}"
action:
- service: notify.notify
  data:
    title: Stale Temperature
    message: "{{ now().timestamp() | timestamp_local }} Value unchanged for the past 30 minutes."
8 Likes

Thank you both for your answer. The issue is still that the system is isolated, so it cannot simply send me a notification on my mobile phone or similar actions. Therefore my idea was to log those issues somewhere into a file placed in a shared folder. Is there a well known way to do that?

You must have missed this part in my reply:

You can use the File integration to send notifications to a file.

The file platform allows you to store notifications from Home Assistant as a file.

If you want the file to reside not on the host machine but a shared Samba drive on the network, you will need to mount it (using your Linux skills). Search online for “linux mount samba drive”.

How can I add more sensors to the automation? For example all temperature sensors.

Probably with a template that’s more complex than the simple one in this 2 year-old topic.

The example in this post can serve as a starting point: