forked from tasmota/blueprints
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync_climate_and_switch_entity.yaml
51 lines (50 loc) · 1.63 KB
/
sync_climate_and_switch_entity.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
blueprint:
name: Sync climate with a switch entity
source_url: https://raw.githubusercontent.com/tasmota/blueprints/main/sync_climate_and_switch_entity.yaml
description: |
Sync states of a climate entity and a switch.
Useful when you want to track the state of the climate entity on, for example, a switch with a LED indicator and control the heater from the same switch.
domain: automation
input:
switch:
name: Choose switch device
selector:
entity:
domain: switch
climate:
name: Choose climate device
selector:
entity:
domain: climate
mode: single
max_exceeded: silent
variables:
climate: !input climate
switch: !input switch
trigger:
- platform: state
entity_id: !input climate
- platform: state
entity_id: !input switch
condition:
- condition: template
value_template: >-
{{ states(climate | replace("idle", "on") | replace("heat", "on") | replace("cool", "on") | replace("dry", "on")) !=
states(switch) }}
action:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.entity_id == climate }}'
sequence:
- service: >-
switch.turn_{{ "on" if trigger.to_state.state != "off" else "off" }}
target:
entity_id: !input switch
- conditions:
- condition: template
value_template: '{{ trigger.entity_id == switch }}'
sequence:
- service: 'climate.turn_{{ trigger.to_state.state }}'
target:
entity_id: !input climate