heating_kitchen:
binary_sensor:
- platform: template
sensors:
# Условия для включения отопления
kitchen_heat:
friendly_name: "Режим отопления кухня -"
value_template: >-
{{ is_state('binary_sensor.0x00158d0001a99562_contact', 'off')
and is_state('binary_sensor.0x00158d0001a20885_contact', 'off')
and is_state('binary_sensor.away', 'off')
and is_state('binary_sensor.radiator', 'on') }}
icon_template: >-
{% if is_state("binary_sensor.kitchen_heat", "on") %}
mdi:radiator
{% else %}
mdi:radiator-off
{% endif %}
# Фактическое состояние термостата
kn_heat_valve:
friendly_name: "Термостат кухня -"
value_template: >-
{{ state_attr('climate.0xec1bbdfffe9466c5_climate', 'position') | int == 100}}
device_class: lock
icon_template: >-
{% if is_state("binary_sensor.kn_heat_valve", "on") %}
mdi:valve-open
{% else %}
mdi:valve-closed
{% endif %}
switch:
- platform: template
switches:
kn_radiator:
friendly_name: "Кухня головка радиатора"
value_template: "{{ is_state_attr('climate.0xec1bbdfffe9466c5_climate', 'force', 'open') }}"
turn_on:
service: mqtt.publish
data_template:
topic: "zigbee2mqtt/KN thermostat/set/force"
payload_template: 'open'
turn_off:
service: mqtt.publish
data_template:
topic: "zigbee2mqtt/KN thermostat/set/force"
payload_template: 'close'
icon_template: >-
{% if is_state('switch.kn_radiator', 'on') %}
mdi:radiator
{% else %}
mdi:radiator-off
{% endif %}
automation:
- id: Обгрев кухни
alias: kn_heating
initial_state: true
trigger:
- platform: homeassistant
event: start
- platform: time_pattern
minutes: '/5'
- platform: state
entity_id:
- binary_sensor.kitchen_heat
action:
- service: script.turn_on
data_template:
entity_id: >-
{%- if states.binary_sensor.kitchen_heat.state == 'on' -%}
script.kn_home_heat
{%- elif states.binary_sensor.kitchen_heat.state == 'off' -%}
script.kn_away_heat
{%- endif -%}
script:
kn_home_heat:
alias: Обгрев кухни, режим дом
sequence:
- service: climate.set_preset_mode
data:
entity_id: climate.kn_heater
preset_mode: none
- service: climate.set_temperature
data:
entity_id: climate.kn_heater
temperature: 22
kn_away_heat:
alias: Обгрев кухни, режим away
sequence:
- service: climate.set_preset_mode
data:
entity_id: climate.kn_heater
preset_mode: away
- service: climate.set_temperature
data:
entity_id: climate.kn_heater
temperature: 19