-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatteries.yaml
32 lines (30 loc) · 1.12 KB
/
batteries.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
### Black Panther ###
black_panther_battery:
entity_id: device_tracker.ozone
value_template: "{{ (states.device_tracker.ozone.attributes|default).battery_level|default|int('unknown') }}"
unit_of_measurement: '%'
icon_template: >-
{% set battery_state = states('sensor.black_panther_battery_state')|lower %}
{% set battery_level = states('sensor.black_panther_battery_level')|int('unknown') %}
{% set battery_round = (battery_level|int / 10)|int * 10 %}
{% if battery_level == 'unknown' %}
mdi:battery-unknown
{% elif battery_state == 'charging' %}
{% if battery_round < 20 %}
{% set battery_round = 20 %}
{% elif battery_round == 50 %}
{% set battery_round = 60 %}
{% elif battery_round == 70 %}
{% set battery_round = 80 %}
{% endif %}
mdi:battery-charging-{{ battery_round }}
{% else %}
{% if battery_round >= 100 %}
mdi:battery
{% elif battery_round > 0 %}
mdi:battery-{{ battery_round }}
{% else %}
mdi:battery-alert
{% endif %}
{% endif %}
A