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

73 lines
1.9 KiB
YAML

---
homeassistant:
customize:
package.node_anchors:
common_attrs: &common_attrs
package: "heating"
common_attrs_templated: &common_attrs_templated
templated: true
<<: *common_attrs
binary_sensor.radiators:
friendly_name: Radiators
<<: *common_attrs_templated
switch.heating:
friendly_name: Heating
group:
climate:
name: heating
icon: "mdi:radiator"
entities:
- climate.bathroom
- climate.bedroom
- climate.livingroom
- climate.study
all: false
template:
- binary_sensor:
- name: radiators
icon: >-
{% if is_state(this.entity_id, "on") %}
mdi:thermometer
{% else %}
mdi:thermometer-off
{% endif %}
state: |
{% set all_radiators = states.climate
| selectattr("attributes", "defined")
| map(attribute="attributes")
| selectattr("temperature", "defined")
| map(attribute="temperature")
| default([])
| map("float", 0.0)
| list %}
{% set max_radiator_temp = all_radiators | map("float", 0.0) | max | default(0.0) | float(0.0) %}
{% set target_temp = states('input_number.target_temp_heat') | default(0.0) | float(0.0) %}
{{
max_radiator_temp >= target_temp
and max_radiator_temp > 0.0
}}
switch:
platform: template
switches:
heating:
icon_template: |
{% if is_state("binary_sensor.radiators", "on") %}
mdi:thermometer
{% else %}
mdi:thermometer-off
{% endif %}
availability_template: |
{{ has_value("binary_sensor.radiators") }}
value_template: |
{{ is_state("binary_sensor.radiators", "on") }}
turn_on:
service: script.heating_on
turn_off:
service: script.heating_eco