-
Notifications
You must be signed in to change notification settings - Fork 1
/
ir2.yaml
170 lines (139 loc) · 4.83 KB
/
ir2.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
substitutions:
friendly_name: ir2
packages:
device_base: !include device_base_esp32.yaml
logger:
# level: VERBOSE
# DHT11 --> PID Controller --> output_template --> Daikin Controller --> Physical IR LEDs
# daikin_temp_sensor test_ac_remote
# daikin_pid_thermostat remote_transmitter
# output_dummy
sensor:
- platform: dht
pin:
number: GPIO19
mode:
input: true
pullup: true
temperature:
name: "Temperature"
id: daikin_temp_sensor
accuracy_decimals: 3
filters:
- exponential_moving_average:
alpha: 0.1
send_every: 1
humidity:
name: "Humidity"
id: daikin_humidity_sensor
update_interval: 7s
# The IR LEDs
remote_transmitter:
pin: GPIO18
carrier_duty_percent: 50%
# The output climate device to control the Daikin
climate:
- platform: daikin
name: "Test AC Remote"
id: test_ac_remote
# sensor: daikin_temp_sensor
- platform: pid
name: "Daikin PID Thermostat"
id: daikin_pid_thermostat
sensor: daikin_temp_sensor
default_target_temperature: 24°C
deadband_parameters:
threshold_high: 3.0°C
threshold_low: -1.0°C
ki_multiplier: 0.05
cool_output: output_dummy
heat_output: output_dummy
control_parameters:
# Living room parameters
kp: 0.90210
ki: 0.00217
kd: 93.77339
output_averaging_samples: 3
derivative_averaging_samples: 3
# Autotune parameters
# kp: 0
# ki: 0
# kd: 0
# Study PID parameters
# kp: 1.17530
# ki: 0.00884
# kd: 39.07869
switch:
- platform: template
name: "PID Climate Autotune"
turn_on_action:
- climate.pid.autotune: daikin_pid_thermostat
output:
- platform: template
id: output_dummy
type: float
write_action:
# id(my_climate).fan_mode
- lambda: |-
ESP_LOGD("custom", "PID output Power is %f", state);
if (state == 0) {
return;
}
// TODO
// Sync PID off to Daikin off
// Sync PID target to Daikin target
//
// esphome_config git:(master) ✗ tail -f climate.log|egrep '(Mode changed|Fan speed|State is|Current Temperature)'
// esphome logs ir2.yaml >> climate.log 2>&1
auto call = id(test_ac_remote).make_call();
auto call_pid = id(daikin_pid_thermostat).make_call();
// lo,med,high esphome::climate::ClimateFanMode
auto current_daikin_fan_mode = id(test_ac_remote).fan_mode;
auto current_daikin_mode = id(test_ac_remote).mode; // heat, cool, off
auto pid_action = id(daikin_pid_thermostat).action;
// auto s = LOG_ARG_STR(esphome::climate::climate_action_to_string(a));
bool changed = false;
if ( state >= 0.05 &&
pid_action == CLIMATE_ACTION_COOLING &&
current_daikin_mode != CLIMATE_MODE_COOL) {
ESP_LOGW("custom", "Mode changed to COOL");
call.set_mode(CLIMATE_MODE_COOL);
changed = true;
}
if (state >= 0.05 && pid_action == CLIMATE_ACTION_HEATING &&
current_daikin_mode != CLIMATE_MODE_HEAT) {
ESP_LOGW("custom", "Mode changed to HEAT");
call.set_mode(CLIMATE_MODE_HEAT);
changed = true;
}
if (pid_action == CLIMATE_ACTION_IDLE &&
current_daikin_mode != CLIMATE_MODE_OFF
) {
ESP_LOGW("custom", "Mode changed to OFF");
call.set_mode(CLIMATE_MODE_OFF);
changed = true;
}
if (state >=0 && state < 0.05 && current_daikin_mode != CLIMATE_MODE_OFF ) {
ESP_LOGW("custom", "Mode change to OFF (<.05)");
call.set_mode(CLIMATE_MODE_OFF);
changed = true;
}
if (state >= 0.05 && state < 0.30 && current_daikin_fan_mode != CLIMATE_FAN_LOW ) {
ESP_LOGW("custom", "Fan speed changed to LOW");
call.set_fan_mode( "LOW" );
changed = true;
}
if (state >= 0.30 && state < 0.75 && current_daikin_fan_mode != CLIMATE_FAN_MEDIUM ) {
ESP_LOGW("custom", "Fan speed changed to MEDIUM");
call.set_fan_mode( "MEDIUM" );
changed = true;
}
if (state >= 0.75 && state <= 1.00 && current_daikin_fan_mode != CLIMATE_FAN_HIGH ) {
ESP_LOGW("custom", "Fan speed changed to HIGH");
call.set_fan_mode( "HIGH" );
changed = true;
}
if (changed) {
call.perform();
}
ESP_LOGD("custom", "-----------");