Just cleaned up the code thanks to @burnshomeautomation and @CCOSTAN

This commit is contained in:
Jeffrey Stone 2019-10-05 20:42:30 -04:00
parent 0dae10b22c
commit f4e36a424d
1 changed files with 14 additions and 76 deletions

View File

@ -77,97 +77,35 @@
sensor_count:
friendly_name: 'Number of Sensors'
entity_id: []
value_template: >
{%- set domains = ['sensor'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
value_template: >-
{{ states.sensor | list | count }}
automation_count:
friendly_name: 'Number of Automations'
entity_id: []
value_template: >
{%- set domains = ['automation'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
value_template: >-
{{ states.automation| list | count }}
script_count:
friendly_name: 'Number of Scripts'
entity_id: []
value_template: >
{%- set domains = ['script'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
value_template: >-
{{ states.script | list | count }}
binary_sensor_count:
friendly_name: 'Number of Binary Sensors'
entity_id: []
value_template: >
{%- set domains = ['binary_sensor'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
value_template: >-
{{ states.binary_sensor | list | count }}
tracker_count:
friendly_name: 'Number of Devices'
entity_id: []
value_template: >
{%- set domains = ['device_tracker'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
value_template: >-
{{ states.device_tracker| list | count }}
lights_count:
friendly_name: 'Number of Lights'
entity_id: []
value_template: >
{%- set domains = ['light'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
protect_count:
friendly_name: 'Number of Smoke Detectors'
entity_id: []
value_template: >
{% if states('group.protects') == 'on' %}
{% for e in states.group.protects.attributes.entity_id if states(e) == 'on' %}
{% if loop.last %}
{{ loop.index }}
{% endif %}
{%- endfor -%}
{% else %}
0
{% endif %}
value_template: >-
{{ states.light | list | count }}
camera_count:
friendly_name: 'Number of online Cameras'
entity_id: []
value_template: >
{%- set domains = ['camera'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
value_template: >-
{{ states.camera | list | count }}