Files
Home-Assistant-Configs/sensors/house_stats.yaml

229 lines
7.9 KiB
YAML

- platform: template
sensors:
sensor_count:
friendly_name: 'Number of Sensors'
value_template: >-
{{ states.sensor | rejectattr('state', 'eq', 'unavailable') | list | count }}
automation_count:
friendly_name: 'Number of Automations'
value_template: >-
{{ states.automation| rejectattr('state', 'eq', 'unavailable') | list | count }}
script_count:
friendly_name: 'Number of Scripts'
value_template: >-
{{ states.script | rejectattr('state', 'eq', 'unavailable') | list | count }}
binary_sensor_count:
friendly_name: 'Number of Binary Sensors'
value_template: >-
{{ states.binary_sensor | rejectattr('state', 'eq', 'unavailable') | list | count }}
tracker_count:
friendly_name: 'Number of Devices'
value_template: >-
{{ states.device_tracker| rejectattr('state', 'eq', 'unavailable') | list | count }}
lights_count:
friendly_name: 'Number of Lights'
value_template: >-
{{ states.light | rejectattr('state', 'eq', 'unavailable') | list | count }}
switches_count:
friendly_name: 'Number of Switches'
value_template: >-
{{ states.switch | rejectattr('state', 'eq', 'unavailable') | list | count }}
camera_count:
friendly_name: 'Number of online Cameras'
value_template: >-
{{ states.camera | rejectattr('state', 'eq', 'unavailable') | list | count }}
entities_count:
friendly_name: 'Number of Entities'
value_template: >-
{{ states | rejectattr('state', 'eq', 'unavailable') | list | count}}
na_entities_count:
friendly_name: 'Number of NA Entities'
value_template: >-
{{ states | selectattr('state', 'eq', 'unavailable') | map(attribute='entity_id') | list | count }}
current_lights_on:
friendly_name: Current Lights On
unit_of_measurement: 'on'
value_template: >-
{% set lights = [
states.light.living_room_color_1,
states.light.living_room_color_2,
states.light.living_room_color_3,
states.light.dining_room_lamp,
states.light.mud_room_overhead,
states.light.downstairs_bathroom_left,
states.light.downstairs_bathroom_right,
states.light.tina_lamp_top,
states.light.tina_lamp_side,
states.light.tina_desk_strip,
states.light.basement_tall_lamp,
states.light.basement_short_lamp,
states.light.basement_stairwell,
states.light.basement_led_strip_1,
states.light.hallway_overhead,
states.light.upstairs_bathroom_left,
states.light.upstairs_bathroom_middle_left,
states.light.upstairs_bathroom_middle_right,
states.light.upstairs_bathroom_right,
states.light.upstairs_bathroom_wall,
states.light.master_bedroom_front,
states.light.master_bedroom_side,
states.light.master_bedroom_closet,
states.light.kallen_bedroom_wall,
states.light.kallen_bedroom_overhead,
states.light.emma_bedroom_light,
states.light.front_porch_light,
states.light.front_window_christmas_lights,
states.light.living_room_christmas_tree
] %}
{{ lights | selectattr('state','eq','on') | list | count }}
first_floor_lights_on:
friendly_name: First Floor Lights On
unit_of_measurement: 'on'
value_template: >-
{% set lights = [
states.light.living_room_color_1,
states.light.living_room_color_2,
states.light.living_room_color_3,
states.light.dining_room_lamp,
states.light.mud_room_overhead,
states.light.downstairs_bathroom_left,
states.light.downstairs_bathroom_right,
states.light.tina_lamp_top,
states.light.tina_lamp_side,
states.light.tina_desk_strip,
states.light.living_room_christmas_tree
] %}
{{ lights | selectattr('state','eq','on') | list | count }}
second_floor_lights_on:
friendly_name: Second Floor Lights On
unit_of_measurement: 'on'
value_template: >-
{% set lights = [
states.light.hallway_overhead,
states.light.upstairs_bathroom_left,
states.light.upstairs_bathroom_middle_left,
states.light.upstairs_bathroom_middle_right,
states.light.upstairs_bathroom_right,
states.light.upstairs_bathroom_wall,
states.light.master_bedroom_front,
states.light.master_bedroom_side,
states.light.master_bedroom_closet,
states.light.kallen_bedroom_wall,
states.light.kallen_bedroom_overhead,
states.light.emma_bedroom_light
] %}
{{ lights | selectattr('state','eq','on') | list | count }}
basement_lights_on:
friendly_name: Basement Lights On
unit_of_measurement: 'on'
value_template: >-
{% set lights = [
states.light.basement_stairwell,
states.light.basement_tall_lamp,
states.light.basement_short_lamp,
states.light.basement_led_strip_1
] %}
{{ lights | selectattr('state','eq','on') | list | count }}
current_fans_on:
friendly_name: Current Fans On
unit_of_measurement: 'on'
value_template: >-
{% set fans = [
states.fan.basement_fan,
states.fan.kallen_bedroom_fan,
states.fan.master_bedroom_fan,
states.fan.emma_air_conditioner
] %}
{{ fans | selectattr('state','eq','on') | list | count }}
current_outdoor_lights_on:
friendly_name: Current Outdoor Lights On
unit_of_measurement: 'on'
value_template: >-
{% set lights = [
states.light.front_porch_light,
states.light.front_window_christmas_lights
] %}
{{ lights | selectattr('state','eq','on') | list | count }}
climate_devices_installed:
friendly_name: Climate Devices Installed
unit_of_measurement: 'installed'
value_template: >-
{% set devices = [
states.input_boolean.master_bedroom_aircon_installed,
states.input_boolean.emma_bedroom_aircon_installed
] %}
{{ devices | selectattr('state','eq','on') | list | count }}
front_porch_color_temp:
friendly_name: Front Porch Color Temp
unit_of_measurement: 'mireds'
value_template: >
{% if is_state('light.front_porch_light','off') %}
{{ 0 | int }}
{% else %}
{{ state_attr('light.front_porch_light','color_temp') | int }}
{% endif %}
- platform: history_stats
name: Basement TV Time
entity_id: media_player.basement_tv
state: 'playing'
type: time
end: '{{ now() }}'
duration:
hours: 24
- platform: history_stats
name: Basement TV Chromecast Time
entity_id: media_player.basement_tv_chromecast
state: 'playing'
type: time
end: '{{ now() }}'
duration:
hours: 24
- platform: history_stats
name: Living Room TV Time
entity_id: media_player.living_room_tv
state: 'playing'
type: time
end: '{{ now() }}'
duration:
hours: 24
- platform: history_stats
name: Living Room TV Chromecast Time
entity_id: media_player.living_room_tv_chromecast
state: 'playing'
type: time
end: '{{ now() }}'
duration:
hours: 24
- platform: history_stats
name: Master Bedroom TV Time
entity_id: media_player.master_bedroom_firetv
state: 'playing'
type: time
end: '{{ now() }}'
duration:
hours: 24
- platform: history_stats
name: Outside Lights
entity_id: light.outside_lights
state: 'on'
type: time
end: '{{ now() }}'
duration:
hours: 24
- platform: history_stats
name: Windows Open Time
entity_id: sensor.windows_open
state: 'on'
type: time
end: '{{ now() }}'
duration:
hours: 24
- platform: history_stats
name: Doors Open Time
entity_id: sensor.doors_open
state: 'on'
type: time
end: '{{ now() }}'
duration:
hours: 24