Low battery tracking
This commit is contained in:
@ -585,3 +585,28 @@
|
|||||||
}} and tonight''s cooling is set to start at {{ states(''input_datetime.master_bedroom_cooling'')
|
}} and tonight''s cooling is set to start at {{ states(''input_datetime.master_bedroom_cooling'')
|
||||||
}}"'
|
}}"'
|
||||||
mode: queued
|
mode: queued
|
||||||
|
- id: '1654547257475'
|
||||||
|
alias: Battery Monitoring
|
||||||
|
description: Monitor all battery-powered things for low battery states
|
||||||
|
use_blueprint:
|
||||||
|
path: sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml
|
||||||
|
input:
|
||||||
|
time: '11:00:00'
|
||||||
|
exclude:
|
||||||
|
entity_id:
|
||||||
|
- sensor.iphone_battery_level
|
||||||
|
- sensor.kallen_iphone_battery_level
|
||||||
|
- sensor.tinas_ipad_battery_level
|
||||||
|
- sensor.tony_s_iphone_battery_level
|
||||||
|
- sensor.tony_s_ipad_battery_level
|
||||||
|
- sensor.kallen_desktop_battery_level
|
||||||
|
- sensor.kallen_desktop_battery_remaining
|
||||||
|
- sensor.tony_asus_battery_level
|
||||||
|
- sensor.tony_asus_battery_remaining
|
||||||
|
- sensor.xia_desktop_battery_level
|
||||||
|
- sensor.xia_desktop_battery_remaining
|
||||||
|
actions:
|
||||||
|
- service: script.text_notify_all
|
||||||
|
data:
|
||||||
|
title: Low Batteries in House
|
||||||
|
message: 'Low battery alert for: {{sensors}}'
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
blueprint:
|
||||||
|
name: Low battery level detection & notification for all battery sensors
|
||||||
|
description: Regularly test all sensors with 'battery' device-class for crossing
|
||||||
|
a certain battery level threshold and if so execute an action.
|
||||||
|
domain: automation
|
||||||
|
input:
|
||||||
|
threshold:
|
||||||
|
name: Battery warning level threshold
|
||||||
|
description: Battery sensors below threshold are assumed to be low-battery (as
|
||||||
|
well as binary battery sensors with value 'on').
|
||||||
|
default: 20
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 5.0
|
||||||
|
max: 100.0
|
||||||
|
unit_of_measurement: '%'
|
||||||
|
mode: slider
|
||||||
|
step: 5.0
|
||||||
|
time:
|
||||||
|
name: Time to test on
|
||||||
|
description: Test is run at configured time
|
||||||
|
default: '10:00:00'
|
||||||
|
selector:
|
||||||
|
time: {}
|
||||||
|
day:
|
||||||
|
name: Weekday to test on
|
||||||
|
description: 'Test is run at configured time either everyday (0) or on a given
|
||||||
|
weekday (1: Monday ... 7: Sunday)'
|
||||||
|
default: 0
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 0.0
|
||||||
|
max: 7.0
|
||||||
|
mode: slider
|
||||||
|
step: 1.0
|
||||||
|
exclude:
|
||||||
|
name: Excluded Sensors
|
||||||
|
description: Battery sensors (e.g. smartphone) to exclude from detection. Only
|
||||||
|
entities are supported, devices must be expanded!
|
||||||
|
default:
|
||||||
|
entity_id: []
|
||||||
|
selector:
|
||||||
|
target:
|
||||||
|
entity:
|
||||||
|
device_class: battery
|
||||||
|
actions:
|
||||||
|
name: Actions
|
||||||
|
description: Notifications or similar to be run. {{sensors}} is replaced with
|
||||||
|
the names of sensors being low on battery.
|
||||||
|
selector:
|
||||||
|
action: {}
|
||||||
|
source_url: https://gist.github.com/sbyx/1f6f434f0903b872b84c4302637d0890
|
||||||
|
variables:
|
||||||
|
day: !input 'day'
|
||||||
|
threshold: !input 'threshold'
|
||||||
|
exclude: !input 'exclude'
|
||||||
|
sensors: "{% set result = namespace(sensors=[]) %} {% for state in states.sensor\
|
||||||
|
\ | selectattr('attributes.device_class', '==', 'battery') %}\n {% if 0 <= state.state\
|
||||||
|
\ | int(-1) < threshold | int and not state.entity_id in exclude.entity_id %}\n\
|
||||||
|
\ {% set result.sensors = result.sensors + [state.name ~ ' (' ~ state.state\
|
||||||
|
\ ~ ' %)'] %}\n {% endif %}\n{% endfor %} {% for state in states.binary_sensor\
|
||||||
|
\ | selectattr('attributes.device_class', '==', 'battery') | selectattr('state',\
|
||||||
|
\ '==', 'on') %}\n {% if not state.entity_id in exclude.entity_id %}\n {%\
|
||||||
|
\ set result.sensors = result.sensors + [state.name] %}\n {% endif %}\n{% endfor\
|
||||||
|
\ %} {{result.sensors|join(', ')}}"
|
||||||
|
trigger:
|
||||||
|
- platform: time
|
||||||
|
at: !input 'time'
|
||||||
|
condition:
|
||||||
|
- '{{ sensors != '''' and (day | int == 0 or day | int == now().isoweekday()) }}'
|
||||||
|
action:
|
||||||
|
- choose: []
|
||||||
|
default: !input 'actions'
|
||||||
|
mode: single
|
Reference in New Issue
Block a user