I am trying to create an automation that will fire a Persistent Notification when our phones or my watch drop below 20% battery level remaining. I have created the following but it doesn’t work. Any help would be appreciated.
Weird. I have a very similar automation that works as intended:
- id: fridge_compressor_alert
alias: 'Fridge Compressor Alert'
initial_state: true
trigger:
platform: numeric_state
entity_id:
- sensor.bar_fridge_power
- sensor.fridge_power
below: 50
for:
hours: 2
action:
- service: notify.telegram_system
data_template:
title: '*ALERT*'
message: "The {{trigger.to_state.attributes.friendly_name}} compressor has not turned on in the last 2 hours."
- service: persistent_notification.create
data_template:
message: "{{ now().strftime('%H:%M %A %d %B %Y') }} - The {{trigger.to_state.attributes.friendly_name}} compressor has not turned on in the last 2 hours."
title: "ALERT"
Have a look in the dev tools states menu. Are the battery levels actually numbers?
Do you get the notification if you trigger the automation from the developer tools services menu (service = automation trigger or something like that)?
I believe it may be working now. I may a few changes to make it more like yours and when I rebooted I had a notification that the only device currently below 20% was below 20%. We’ll see what happens when one of the others moves below 20.