-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
heating_channel_remote_controlled.yaml
177 lines (162 loc) · 6.64 KB
/
heating_channel_remote_controlled.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
########### Climate thermostat
climate:
- platform: thermostat
id: ${id}_thermostat
name: ${frendly_name}
sensor: ${temperature_sensor}
default_preset: ${default_preset}
on_boot_restore_from: memory
startup_delay: true
preset: #ECO, AWAY, BOOST, COMFORT, HOME, SLEEP, ACTIVITY
- name: ${preset_1_name}
default_target_temperature_low: ${preset_1_target_temperature_low}
# default_target_temperature_high: ${preset_1_target_temperature_high}
mode: ${preset_1_mode} #OFF, AUTO, HEAT, COOL, HEAT_COOL, FAN_ONLY, DRY
- name: ${preset_2_name}
default_target_temperature_low: ${preset_2_target_temperature_low}
# default_target_temperature_high: ${preset_2_target_temperature_high}
mode: ${preset_2_mode}
- name: ${preset_3_name}
default_target_temperature_low: ${preset_3_target_temperature_low}
# default_target_temperature_high: ${preset_3_target_temperature_high}
mode: ${preset_3_mode}
# min_cooling_off_time: 300s
# min_cooling_run_time: 300s
min_heating_off_time: 300s
min_heating_run_time: 300s
min_idle_time: 30s
heat_action:
- lambda: 'return;' # do nothing cause action is triggered by time interval
# cool_action:
# - lambda: 'return;'
idle_action:
- lambda: 'return;'
visual:
min_temperature: ${visual_min_temperature}
max_temperature: ${visual_max_temperature}
temperature_step: ${visual_temperature_step}
# web_server:
# sorting_group_id: sorting_group_climate
########### cover
cover:
- platform: endstop
name: CH${channel_number}
device_class: shutter
open_action:
- switch.turn_on: CH${channel_number}_IA_pin
- switch.turn_off: CH${channel_number}_IB_pin
open_duration: 60s
open_endstop: BEMF_${channel_number}_sensor
close_action:
- switch.turn_on: CH${channel_number}_IB_pin
- switch.turn_off: CH${channel_number}_IA_pin
close_duration: 60s
close_endstop: BEMF_${channel_number}_sensor
stop_action:
- switch.turn_off: CH${channel_number}_IA_pin
- switch.turn_off: CH${channel_number}_IB_pin
max_duration : 65s
#assumed_state: true
id: CH${channel_number}_cover
# web_server:
# sorting_group_id: sorting_group_covers
number:
- platform: template
name: "bemf_trigger_${channel_number}"
optimistic: true
min_value: 0.005
max_value: 1.5
step: 0.005
restore_value: true
initial_value: ${bemf_trigger_initial_value}
id: bemf_trigger_${channel_number}
# web_server:
# sorting_group_id: sorting_group_inputs
script:
- id: calibrate_CH${channel_number}_cover
then:
- logger.log:
format: "Calibrate CH${channel_number}"
tag: heat_ctrl_main
- cover.close: CH${channel_number}_cover
- delay: 5s
- cover.open: CH${channel_number}_cover
- delay: 5s
- cover.close: CH${channel_number}_cover
- delay: 5s
- cover.open: CH${channel_number}_cover
- delay: 5s
- cover.close: CH${channel_number}_cover
- delay: 5s
- cover.open: CH${channel_number}_cover
- delay: 60s
- cover.close: CH${channel_number}_cover
- delay: 60s
- cover.close: CH${channel_number}_cover
- delay: 60s
- cover.close: CH${channel_number}_cover
### back electromotive force (back EMF)
### https://en.wikipedia.org/wiki/Counter-electromotive_force
binary_sensor:
- platform: template
id: BEMF_${channel_number}_sensor
name: "BEMF CH${channel_number} sensor"
lambda: return ((id(${bemf_sensor_adc}).state >= id(bemf_trigger_${channel_number}).state));
on_press:
then:
- lambda: |-
if (id(CH${channel_number}_cover).current_operation == COVER_OPERATION_OPENING) {
auto call = id(CH${channel_number}_cover).make_call();
call.set_command_stop();
call.perform();
id(CH${channel_number}_cover).position = 1.0; //1.0 = 100% = OPEN
id(CH${channel_number}_cover).publish_state();
id(${id_prefix}bemf_logs).publish_state("CH${channel_number} opening endstop reached at " + to_string(id(${bemf_sensor_adc}).state) + " V");
ESP_LOGD("heat_ctrl_bemf", "CH${channel_number} opening endstop reached at %f V", id(${bemf_sensor_adc}).state);
} else if (id(CH${channel_number}_cover).current_operation == COVER_OPERATION_CLOSING) {
auto call = id(CH${channel_number}_cover).make_call();
call.set_command_stop();
call.perform();
id(CH${channel_number}_cover).position = 0.0; //0.0 = 0% = CLOSED
id(CH${channel_number}_cover).publish_state();
id(${id_prefix}bemf_logs).publish_state("CH${channel_number} closing endstop reached at " + to_string(id(${bemf_sensor_adc}).state) + " V");
ESP_LOGD("heat_ctrl_bemf", "CH${channel_number} closing endstop reached at %f V", id(${bemf_sensor_adc}).state);
}
internal: true
# web_server:
# sorting_group_id: sorting_group_BEMF
switch:
- platform: gpio
name: "CH${channel_number} IA"
pin:
sn74hc595: sn74hc595_hub
number: ${sn74hc595_IA_pin}
inverted: False
internal: true
on_turn_on: #interlock do not support templating => replaced with switch.turn_off
- switch.turn_off: CH${channel_number}_IB_pin
- delay: 200ms #allow for switching time and any discharge
id: CH${channel_number}_IA_pin
#interlock: [CH${channel_number}_IA_pin, CH${channel_number}_IB_pin] #interlock: &interlock_group_CH1 [CH1_IA_pin, CH1_IB_pin]
restore_mode: always off
- platform: gpio
name: "CH${channel_number} IB"
pin:
sn74hc595: sn74hc595_hub
number: ${sn74hc595_IB_pin}
inverted: False
internal: true
on_turn_on:
- switch.turn_off: CH${channel_number}_IA_pin
- delay: 200ms #allow for switching time and any discharge
id: CH${channel_number}_IB_pin
#interlock: CH${channel_number}_IA_pin #interlock: *interlock_group_CH1
restore_mode: always off
# - platform: template
# name: "Run ${frendly_name} check"
# turn_on_action:
# - script.execute: TH${channel_number}_check
# interval:
# - interval: ${check_interval}
# then:
# - script.execute: TH${channel_number}_check