Removing the low battery sensor. It isn't work properly an just generating errors. Need to redo

This commit is contained in:
Jeffrey Stone 2022-03-06 18:37:26 -05:00
parent 5a5242ac20
commit b816468491
1 changed files with 20 additions and 20 deletions

View File

@ -1,21 +1,21 @@
- platform: template # - platform: template
sensors: # sensors:
low_battery: # low_battery:
friendly_name: 'Low Battery' # friendly_name: 'Low Battery'
value_template: > # value_template: >
{%- set threshold = 15 -%} # {%- set threshold = 15 -%}
{%- set domains = ['light', 'switch', 'sensor', 'zwave', 'lock', 'binary_sensor'] -%} # {%- set domains = ['light', 'switch', 'sensor', 'zwave', 'lock', 'binary_sensor'] -%}
{%- for domain in domains -%} # {%- 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"))) -%} # {%- 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 }} ( # {{ item.attributes.friendly_name }} (
{%- if item.attributes.battery_level is defined -%} # {%- if item.attributes.battery_level is defined -%}
{{ item.attributes.battery_level}} # {{ item.attributes.battery_level}}
{%- else -%} # {%- else -%}
{{item.state}} # {{item.state}}
{%- endif -%}%) # {%- endif -%}%)
{%- if not loop.last -%} # {%- if not loop.last -%}
{{', '}} # {{', '}}
{%- endif -%} # {%- endif -%}
{%- endfor -%} # {%- endfor -%}
{%- endfor -%} # {%- endfor -%}