Moved more to packages
This commit is contained in:
20
packages/low_battery_device_quantity.yaml
Normal file
20
packages/low_battery_device_quantity.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
devices_with_low_battery:
|
||||
friendly_name: "Devices with low battery"
|
||||
unit_of_measurement: devices
|
||||
value_template: >-
|
||||
{{ states.sensor
|
||||
| selectattr('attributes.device_class', 'eq', 'battery')
|
||||
| map(attribute='state')
|
||||
| reject('in', ['unknown', 'unavailable', 'Ok'])
|
||||
| map('int', -1) | select('le', 97)
|
||||
| list | count
|
||||
}}
|
||||
icon_template: >-
|
||||
{% if is_state('sensor.devices_with_low_battery', '0') %}
|
||||
mdi:check-circle
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
Reference in New Issue
Block a user