Files
sarah/config/packages/modules/climate/windows.yaml
T
2020-06-01 22:51:14 +03:00

84 lines
3.1 KiB
YAML

group:
all_windows:
name: All windows
entities:
- binary_sensor.living_room_right_window
- binary_sensor.bedroom_left_window
- binary_sensor.bedroom_right_window
- binary_sensor.kitchen_window
binary_sensor:
- platform: template
sensors:
living_room_right_window:
friendly_name: Living room window
device_class: window
value_template: "{{ is_state('binary_sensor.living_room_right_window_on_off', 'on') }}"
entity_id: binary_sensor.living_room_right_window_on_off
icon_template: >
{% if is_state('binary_sensor.living_room_right_window_on_off', 'on') %} mdi:window-open-variant
{% else %} mdi:window-closed-variant
{% endif %}
bedroom_right_window:
friendly_name: Bedroom right window
device_class: window
value_template: "{{ is_state('binary_sensor.bedroom_right_window_on_off', 'on') }}"
entity_id: binary_sensor.bedroom_right_window_on_off
icon_template: >
{% if is_state('binary_sensor.bedroom_right_window_on_off', 'on') %} mdi:window-open-variant
{% else %} mdi:window-closed-variant
{% endif %}
bedroom_left_window:
friendly_name: Bedroom left window
device_class: window
value_template: "{{ is_state('binary_sensor.bedroom_left_window_raw', 'on') }}"
entity_id: binary_sensor.bedroom_left_window_raw
icon_template: >
{% if is_state('binary_sensor.bedroom_left_window_raw', 'on') %} mdi:window-open-variant
{% else %} mdi:window-closed-variant
{% endif %}
kitchen_window:
friendly_name: Kitchen window
device_class: window
value_template: "{{ is_state('binary_sensor.kitchen_window_raw', 'on') }}"
entity_id: binary_sensor.kitchen_window_raw
icon_template: >
{% if is_state('binary_sensor.kitchen_window_raw', 'on') %} mdi:window-open-variant
{% else %} mdi:window-closed-variant
{% endif %}
sensor:
- platform: template
sensors:
open_window_count:
entity_id:
- binary_sensor.living_room_right_window
- binary_sensor.bedroom_left_window
- binary_sensor.bedroom_right_window
- binary_sensor.kitchen_window
friendly_name: Open window count
value_template: >-
{{ states | selectattr('entity_id', 'in', state_attr('group.all_windows', 'entity_id')) | selectattr('state', 'eq', 'on') | list | count | int }}
#
# ─── CUSTOMIZATION ──────────────────────────────────────────────────────────────
#
homeassistant:
customize:
sensor.living_room_right_window_power:
friendly_name: Living room window battery
sensor.bedroom_left_window_power:
friendly_name: Bedroom left window battery
sensor.bedroom_right_window_power:
friendly_name: Bedroom right window battery
sensor.kitchen_window_power:
friendly_name: Kitchen window battery