diff --git a/sensors/house.yaml b/sensors/house.yaml index 736a194..c8ff8cc 100755 --- a/sensors/house.yaml +++ b/sensors/house.yaml @@ -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 }}