-
Notifications
You must be signed in to change notification settings - Fork 34
/
danfoss_ally_remote_temperature_min_delay.yaml
129 lines (129 loc) · 4.07 KB
/
danfoss_ally_remote_temperature_min_delay.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
blueprint:
domain: automation
name: Ally Temp Update Min Delay
description: Update Danfoss Ally TRV external temperature with min refresh rate
source_url: https://github.com/mdeweerd/zha-toolkit/blob/master/blueprints/danfoss_ally_remote_temperature_min_delay.yaml
input:
ally_device:
name: Ally TRV Device
description: Temperature reading will be sent to this device
selector:
device:
manufacturer: Danfoss
entity:
domain: climate
temp_sensor_id:
name: Temperature Sensor
description:
External sensor from which the temperature will be read. Expects
data format 12.3 (corresponding to °C)
selector:
entity:
device_class: temperature
min_update_minutes:
name: Minimum update interval
description: >
Updates will not be sent if time from last update is less than minimum interval.
Normally 30 min for uncovered, 5 min for covered.
default: 30
selector:
number:
max: 299
min: 1
unit_of_measurement: minutes
mode: box
temperature_offset:
name: Temperature offset to apply to temperature measured by sensor
description: >
When the offset is -1.5 and the value measured by the sensor is 20 °C, then
the temperature provide to the TRV will be 18.5 °C.
default: 0
selector:
number:
max: 4.0
min: -4.0
step: 0.1
unit_of_measurement: °C
mode: box
variables:
device: !input ally_device
ieee: "{{(device_attr(device, 'identifiers')|list)[0][1]}}"
min_update_minutes: !input min_update_minutes
temp_sensor_id: !input temp_sensor_id
temp_offset: !input temperature_offset
temperature: "{{ states(temp_sensor_id) }}"
trigger:
- platform: state
entity_id:
- !input temp_sensor_id
- platform: event
event_type: homeassistant_start
id: ha_restart
condition:
- condition: template
value_template: "{{ temperature != -32768 }}"
action:
- alias: Store ZHA reported temperature in state attribute
service: zha_toolkit.ha_set_state
data:
state_id: "{{ temp_sensor_id }}"
state_attr: best_val
attr_val: "{{ (temperature|round(2)) }}"
- alias:
Try to get more precise temperature (should work if zigbee temperature
sensor)
service: zha_toolkit.attr_read
data:
ieee: "{{ temp_sensor_id }}"
use_cache: true
cluster: 1026
attribute: 0
state_id: "{{ temp_sensor_id }}"
state_attr: best_val
state_value_template: value/100
- alias:
Fake small change in temperature so that the next sensor update triggers
an update/change event in case the write fails
service: zha_toolkit.ha_set_state
data:
state_id: "{{ temp_sensor_id }}"
attr_val: "{{ (temperature|round(2)) - 0.001 }}"
- alias: Write remote temperature to Danfoss Ally
service: zha_toolkit.attr_write
data:
ieee: "{{ ieee }}"
cluster: 0x0201
attribute: 0x4015
manf: 0x1246
attr_val:
'{{ (((state_attr(temp_sensor_id, "best_val")|float) + temp_offset)
* 100) | round(0) }}'
read_before_write: false
write_if_equal: true
fail_exception: true
tries: 3
- alias:
Wait until the minimum update delay expires (the automation blocks itself
because it is in single mode)
delay:
minutes: !input min_update_minutes
- alias:
Set slightly changed temperature if it is valid to force update. Otherwise,
a valid temperature will trigger anyway.
if:
- condition: not
conditions:
- condition: state
entity_id: !input temp_sensor_id
state: "-32768"
then:
- alias:
Fake small change in temperature so that the next sensor update triggers
an update/change event
service: zha_toolkit.ha_set_state
data:
state_id: "{{ temp_sensor_id }}"
attr_val: "{{ (states(temp_sensor_id)|round(2)) + 0.001 }}"
mode: single
max_exceeded: silent