infra/roles/hass-core/files/packages/washing_machine.yaml

242 lines
7.2 KiB
YAML

homeassistant:
customize:
package.node_anchors:
package_name: &package_name "washing_machine"
common_attrs: &common_attrs
package: *package_name
common_attrs_templated: &common_attrs_templated
templated: true
<<: *common_attrs
binary_sensor.washing_machine:
friendly_name: Washing Machine
labels:
- Appliances
- Notifications
- Z-Wave
<<: *common_attrs_templated
binary_sensor.washing_machine_on:
friendly_name: Washing Machine (legacy entity_id)
comment: |
A group entity to provide legacy name, has 1 member.
icon: "mdi:washing-machine"
labels:
- Appliances
- Notifications
- Z-Wave
<<: *common_attrs
binary_sensor.washing_machine_laundry:
friendly_name: Laundry in washing machine
labels:
- ADHD
- Appliances
- Notifications
- Z-Wave
<<: *common_attrs_templated
alert.laundry:
# friendly_name is set with 'name' in the 'alert' integration
templated: false
labels:
- ADHD
- Appliances
- Home Assistant
- Notifications
- Z-Wave
<<: *common_attrs
binary_sensor.door_bathroom_washingmachine:
friendly_name: "Washing machine"
proto: Z-Wave
comment: Door/window sensor on the washing machine
templated: false
labels:
- ADHD
- Appliances
- Z-Wave
<<: *common_attrs
sensor.electric_a_switch_washing_machine_max_24h:
friendly_name: Washing Machine max current [A] over 24h
<<: *common_attrs
sensor.electric_a_switch_washing_machine_max_30d:
friendly_name: Washing Machine max current [A] over 30d
<<: *common_attrs
sensor.electric_w_switch_washing_machine_max_24h:
friendly_name: Washing Machine max power usage [W] over 24h
<<: *common_attrs
sensor.electric_w_switch_washing_machine_max_30d:
friendly_name: Washing Machine max power usage [W] over 30d
<<: *common_attrs
sensor.electric_v_switch_washing_machine_min_30d:
friendly_name: Washing Machine min voltage [V] over 30d
<<: *common_attrs
sensor.electric_v_switch_washing_machine_max_30d:
friendly_name: Washing Machine max voltage [V] over 30d
<<: *common_attrs
template:
- binary_sensor:
- name: washing_machine
unique_id: washing_machine
icon: >-
{% if is_state(this.entity_id, "on") %}
mdi:washing-machine
{% else %}
mdi:washing-machine-off
{% endif %}
device_class: running
#delay_on: "00:00:10"
delay_off: "00:01:00"
availability: >-
{% set id_power = 'sensor.electric_w_switch_washing_machine' %}
{{
states(id_power) is defined
and is_number(states(id_power))
and states(id_power)|float is defined
}}
state: >-
{% set current = states('sensor.electric_a_switch_washing_machine')|float %}
{% set current_on = current > 0.2 %}
{% set power = states('sensor.electric_w_switch_washing_machine')|float %}
{{ power > 4.12 }}
attributes:
delay_on: 10s
delay_off: 1min
threshold: 4.12WW
comment: >-
Drops down to ca 2.8W after finishing and releasing the lock on the door, uses ~3.9-4.0W until door lock is released.
- name: washing_machine_laundry
unique_id: washing_machine_laundry
icon: |
{% if is_state(this.entity_id, "on") %}
mdi:washing-machine-alert
{% else %}
mdi:washing-machine
{% endif %}
device_class: problem
availability: |
{{
has_value("binary_sensor.washing_machine")
and has_value("binary_sensor.door_bathroom_washingmachine")
}}
# The 'automation.washing_machine_finished' automation
# is UI-managed
state: |
{% set washing_machine_running = is_state("binary_sensor.washing_machine", "on") %}
{% set washing_machine_finished = states.automation.washing_machine_finished.last_triggered %}
{% set door_closed = is_state("binary_sensor.door_bathroom_washingmachine", "off") %}
{% set door_changed = states.binary_sensor.door_bathroom_washingmachine.last_changed %}
{{
not washing_machine_running
and door_closed
and door_changed < washing_machine_finished
}}
alert:
# entity_id set to the key ("laundry")
laundry:
# friendly name
name: "Take out laundry"
entity_id: binary_sensor.washing_machine_laundry
title: |
Laundry
state: "on"
repeat: 60
can_acknowledge: true
skip_first: false
message: |
Take out the laundry!
done_message: clear_notification
notifiers:
- mobile_app_ben_phone
- mobile_app_oxygen
data:
tag: laundry
binary_sensor:
- platform: group
name: washing_machine_on
device_class: running
entities:
- binary_sensor.washing_machine
sensor:
# power / W
- name: electric_w_switch_washing_machine_max_24h
platform: statistics
entity_id: sensor.electric_w_switch_washing_machine
state_characteristic: value_max
max_age:
hours: 24
- name: electric_w_switch_washing_machine_max_30d
platform: statistics
entity_id: sensor.electric_w_switch_washing_machine
state_characteristic: value_max
max_age:
days: 30
# current / A
- name: electric_a_switch_washing_machine_max_24h
platform: statistics
entity_id: sensor.electric_a_switch_washing_machine
state_characteristic: value_max
max_age:
hours: 24
- name: electric_a_switch_washing_machine_max_30d
platform: statistics
entity_id: sensor.electric_a_switch_washing_machine
state_characteristic: value_max
max_age:
days: 30
# potential / V
- name: electric_v_switch_washing_machine_max_30d
platform: statistics
entity_id: sensor.electric_v_switch_washing_machine
state_characteristic: value_max
max_age:
days: 30
- name: electric_v_switch_washing_machine_min_30d
platform: statistics
entity_id: sensor.electric_v_switch_washing_machine
state_characteristic: value_min
max_age:
days: 30
automation:
- alias: washing_machine_flood_sensor
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.flood_bathroom
to: "on"
action:
- service: switch.turn_off
data: {}
target:
entity_id: switch.washing_machine
- alias: home_alarm_washing_machine_flood_sensor
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.flood_bathroom
to: "on"
condition: []
action:
- service: notify.notify
data:
title: HOME ALARM
message: "WATER detected: {{ trigger.entity_id[14:] }}"
enabled: true
- service: notify.pagerduty
data:
title: "WATER detected: {{ trigger.entity_id[14:] }} @ {{ now().isoformat() }}"
message: "WATER detected: {{ trigger.entity_id }}"
mode: single