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.
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 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.
@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
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:
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(', ') }}
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