Sensor state "unknown or unavailable" blueprint / automation

I have some sensors and devices that from time to time due to different reasons go to the state of unknown or unavailable and I don’t know about until something fails, like an automation for example.

Example: My kitchen motion sensor for some reason goes to “unknown or unavailable” and my lights don’t turn ON automatically. This is annoying. Is there such blueprint or automation that can easily include all devices states that are “unknown or unavailable” and send me notification on my phone, that THAT SPECIFIC device has gone “unknown or unavailable” and I need to check it out, reset it, repair it of need be or whatever.

I have similar blueprint that checks every morning at 7am if any of my batteries on my sensors are below 20% so I can change them. Something like this but with the functionality from above will be great! Thank you.

@alexvaltchev

Hi Alex, I have a sensor light blueprint that I think you will like. In my FAQ it shows you how to fix this problem.

Blueprint: :bulb: Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time

The FAQ in the post: click here. It is under the heading;

REF - ALS-2
LUX / Illuminance Sensor With A Default Value

You would just make the sensor your motion sensor that “unknown or unavailable”.

Blacky :smiley:

I am kind of newbie, and mostly do thing from the UI, but if there are steps to follow I might be able to succeed :slight_smile: Thanks. I will check it out and report back I am able or unable to figure it out.

To send yourself a notification when the motion sensor goes "unavailable”. Go into automations, select crate automation new, then trigger select “State” and your entities you would like to keep an eye on, in the “to” select “unavailable”, then the for is good as a buffer so you don’t get notifications all the time, so set your time it has to be "unavailable” before it will send you a notification. Then in actions select “Call service” in the service search for “notifications” and select your phone and enter in a message and or title. Click save. Your done.

EDIT: I though about it… not good to have a default for a motion sensor as the light will come ON every time the sensor goes to "unavailable”.

Blacky :smiley:

@Blacky thanks for the help but this is a manual way of going it. I know how to create such automation that notifys me if the status changes. The point is I dont want to manually create an automation. I want a blueprint that automatically adds ALL sensors/devices in my home assistant, even the one I might add in future. I dont want to be modifying it all the time :slight_smile:

I need blueprint that by default it includes all devices/sensors that I already have and even those that I might add in future, without manually adding/removing them. I am sure there is more clever way ?

I asked ChatGPT to do something like that and it made a 2 step process. 1 a custom sensor and 2 automation:

  1. Custom sensor
  - platform: template
    sensors:
      all_devices_sensors_list:
        friendly_name: "All Devices and Sensors List"
        value_template: >-
          {%- set entities = states | map(attribute='entity_id') | select('regex_search', '^(sensor|binary_sensor)\\.') | list %}
          {{ entities | join(', ') }}

  1. Automation
description: "Notify when any device becomes unavailable or unknown"
trigger:
  - platform: state
    entity_id: sensor.all_devices_sensors_list
    to: 'unavailable'
    for:
      hours: 0
      minutes: 0
      seconds: 0
  - platform: state
    entity_id: sensor.all_devices_sensors_list
    to: 'unknown'
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - service: notify.mobile_app_alexphone
    data:
      title: "Device Alert:"
      message: "The device '{{ trigger.from_state.state }}' became {{ trigger.to_state.state }} at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
mode: single

However, it did not work. But at least it got the idea… Can anyone expand on it?

My final goal is to when ANY device or sensor become status unknown or unavailable to receive notificaiton on my phone with the name of the sensor, the state, and the time it become to that state. Thanks

ANYONE? :slight_smile:

1 Like

No news on this ?

I would love to disable all sensor when my pc is off ( for exemple ) to avoid a lot of sensor’s check.

I can’t seem to find a solution for this. :frowning:
Any tips will appreciate.