Plugin for unresponsive sensors?

I was wondering whether there is an add-on/plugin to monitor sensors and to get a notification when one of the monitored sensors isn’t sending information for a certain period.
Ofcourse I could write my own automation, however I am not the only one facing these problems, so that’s why I would like to know this!
Thanks in advance!

1 Like

Two options:

This sensor lists any devices in a group that are reported as unknown:

  - platform: template
        friendly_name: "Offline Devices"
        value_template: >
          {{ expand(|list) | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | map(attribute='entity_id') | list | length }}
        entity_id: sensor.time
          entities: >
            {{ expand(|list) | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | map(attribute='entity_id') | list | join('\n') }}

Just create and populate the group “watchdog_devices” with whatever you want to track.

The other option I use is a script / automation that reports if a device hasn’t changed its value in a configurable amount of time:

    alias: 'Entity Watchdog'
    # description: "Entity Watchdog"
    # fields:
    #   entity_id:
    #     description: 'The entity to check'
    #     example: 'binary_sensor.sensor'
    #   time:
    #     description: 'The max number of seconds before an alert'
    #     example: '300'
      - service: persistent_notification.dismiss
          notification_id: 'Watchdog:{{entity_id}}'
      - condition: template
        value_template: '{{ ( now()|as_timestamp() - states[entity_id].last_updated|default(0,true)|as_timestamp()|default(0,true) ) > time }}'
      - service: persistent_notification.create
          title: 'Watchdog: {{ entity_id }}'
          message: >
            {%- if states[entity_id].last_updated %}
            Entity {{ entity_id }} has not been updated in {{ ( now()|as_timestamp() - states[entity_id].last_updated|default(0,true)|as_timestamp()|default(0,true) )|int }}
            seconds which is longer than the max allowed of {{ time }}.
            {%- else %}
            Entity {{ entity_id }} does not seem to exist.
            {%- endif %}
          notification_id: 'Watchdog:{{entity_id}}'

To use the script, I have an automation that runs every 5 minutes and checks each device I want to watch:

  - alias: Watchdog
      platform: time_pattern
      minutes: "/5"
      - service: script.watchdog
          entity_id: sensor.living_room_51_10
          time: 600
      - service: script.watchdog
          entity_id: sensor.kitchen_52_10
          time: 1200

(Extend the action section to include as many devices as you want to check.

Hope this helps.

Thanks!! That’s what I was looking for.
Would there also be the possibility to add a notification to the script when the sensor changed its value after being unresponsive?

The second option which uses the script & automation creates a persistent notification if a device is unresponsive. If the device later responds, it automatically removes the persistent notification.