Inital Commit
This commit is contained in:
32
automations/zigbee_low_battery_notifications_2.yaml
Normal file
32
automations/zigbee_low_battery_notifications_2.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
- id: notify_if_batteries_are_low
|
||||
alias: Daily alert that zigbee batteries Are Low
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time
|
||||
at: "19:00:00"
|
||||
condition:
|
||||
- condition: or
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set min_battery_level = 20 -%}
|
||||
{% set ns = namespace(found=false) -%}
|
||||
{% for entity_id in states.group.battery_levels.attributes.entity_id -%}
|
||||
{% set parts = entity_id.split('.') -%}
|
||||
{% if (states(entity_id) | replace("%","") | int) < min_battery_level -%}
|
||||
{% set ns.found = true -%}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{{ ns.found }}
|
||||
action:
|
||||
- service: notify.pushover_notifications
|
||||
data:
|
||||
title: View Road Sensors
|
||||
message: >
|
||||
{%- set min_battery_level = 20 -%}
|
||||
{%- for entity_id in states.group.battery_levels.attributes.entity_id -%}
|
||||
{%- set parts = entity_id.split('.') -%}
|
||||
{%- if (states(entity_id) | replace("%","") | int) < min_battery_level -%}
|
||||
{{ states[parts[0]][parts[1]].name }} level is {{ states(entity_id) }}%.{{ '\n' }}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
Reference in New Issue
Block a user