Home-AssistantConfig/config/packages/battery_levels.yaml.DISABLED

55 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

2018-01-02 00:00:45 +00:00
#-------------------------------------------
# Fire Tablet Alarm Panel -
# https://www.vcloudinfo.com/2017/07/visualizing-smart-home-using-home.html
2018-01-02 00:00:45 +00:00
#-------------------------------------------
#
# homeassistant:
# customize_glob:
# "sensor.*_alarm_panel*":
2018-01-19 19:52:57 +00:00
#
#
2018-01-02 00:00:45 +00:00
# "binary_sensor.*_alarm_panel*":
2018-01-19 19:52:57 +00:00
#
#
2018-01-02 00:00:45 +00:00
sensor:
- platform: template
sensors:
low_battery:
friendly_name: 'Low Battery'
value_template: >
{%- set threshold = 15 -%}
{%- set domains = ['light', 'switch', 'sensor', 'zwave', 'lock', 'binary_sensor'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] if ((item.attributes.battery_level is defined and item.attributes['battery_level'] | int < threshold) or ("battery" in item.name | lower and ((item.state | int < threshold and item.state|int != 0) or item.state | lower == "low" or item.state | lower == "unknown"))) -%}
{{ item.attributes.friendly_name }} (
{%- if item.attributes.battery_level is defined -%}
{{ item.attributes.battery_level}}
{%- else -%}
{{item.state}}
{%- endif -%}%)
{%- if not loop.last -%}
{{', '}}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
automation:
- alias: 'Battery Alert'
2020-07-20 18:33:03 +00:00
id: 1a4f06f0-8763-4801-ba6c-55b87d1b0286
2018-01-02 00:00:45 +00:00
initial_state: 'on'
trigger:
- platform: time
at: '10:00:00'
- platform: time
at: '18:00:00'
condition:
condition: template
value_template: "{% if states('sensor.low_battery') %}true{% endif %}"
action:
- service: script.notify_engine
data:
2018-01-02 00:00:45 +00:00
value1: "Low battery levels: {{ states('sensor.low_battery') }}"
who: 'carlo'
apns_id: 'information'