Testing for home automation system component failure (not Home Assistant server)

As I’m finishing up my initial HA setup and I want to add checks that validate system component failure. The components that I want to check for this for are an Insteon PLM, Yolink Hub, Ecobee thermostat (via HomeKit hub) and a Ring doorbell.

I haven’t found entities in those integrations that provide component health. If they are there that would be good to know. Absent of that, I set up yaml to check availability, eg state = “unavailable”

Ring & Ecobee, I picked entities that report standard data like battery and temp state
For Insteon and yolink, I picked multiple devices for each integration to see if they are all state = “unavailable”, so that one device failure doesn’t trigger it

To me it seems that these will infer a failure. I’m going to test it, but I’m curious if there are other ways to test for major and hub component failure

Here’s what I do,

Input Text helper to ignore known off-line entities

ignore_list:
  name: Ignore List
  icon: mdi:file-document-remove-outline
  max: 255

Template sensor to get the unavailable entities

- trigger:
    - trigger: time_pattern
      minutes: "/3"
  sensor:
    - name: Unavailable Entities
      unique_id: 272d21b8-48ab-4e65-8000-32c7ea62deb2
      state_class: measurement
      unit_of_measurement: ents
      icon: "mdi:cancel"
      state: >
        {% set ignore_list = states('input_text.ignore_list').split(',')  %}
        {{ states
          | selectattr('state','eq', 'unavailable')
          | rejectattr('entity_id', 'in', ignore_list)
          | map(attribute='entity_id')
          | list 
          | count
        }}
      attributes:
        entity_ids: >
          {% set ignore_list = states('input_text.ignore_list').split(',')  %}
          {{ states
            | selectattr('state','eq', 'unavailable')
            | rejectattr('entity_id', 'in', ignore_list)
            | map(attribute='entity_id')
            | list 
            | join(', \n')
          }}

Automation to send a notification if there are unavailable entities

- id: f2917319-23f4-4f1c-9dca-ea4d1ccc2969
  alias: 'Unavailable Entities Alert'
  mode: single
  max_exceeded: silent
  triggers:
  - trigger: state
    entity_id: sensor.unavailable_entities
    not_to:
    - unknown
    - unavailable
    for: 300
  conditions:
  - condition: numeric_state
    entity_id: sensor.unavailable_entities
    above: 0
  actions:
  - action: telegram_bot.send_message
    data:
      target: !secret telegram_alert_chat_group_id
      title: "⚠️<b>Unavailable Entities</b>"
      message: >
        The following entities are unavailable:

        {{ state_attr('sensor.unavailable_entities','entity_ids') }}
3 Likes