bssid: !secret wndr3800_bssid
priority: 1
-globals:
- - id: relay_stable_time
- type: time_t
- initial_value: '0'
-
- - id: temp_setpoint
- type: float
- initial_value: '21.0'
- restore_value: true
-
- - id: ufh_manual_delay
- type: int
- initial_value: '1800'
- restore_value: true
-
- - id: ufh_auto_delay
- type: int
- initial_value: '120'
- restore_value: true
-
+script:
+ - id: back_to_auto
+ mode: restart
+ then:
+ - delay: 30 min
+ - climate.control:
+ id: ntc_climate
+ mode: HEAT
time:
- platform: sntp
- delay: 2s # Too soon and the first messages don't get through!
- lambda: |-
id(tell_domo_nvalue)->execute(${domo_ufh}, id(ufh_relay).state);
- id(tell_domo_nsvalues)->execute(${domo_thresh}, 2, std::to_string(id(temp_setpoint)));
+ id(tell_domo_svalue)->execute(${domo_thresh},
+ std::to_string(id(ntc_climate).target_temperature));
on_disconnect:
then:
} else {
id(ufh_relay).turn_off();
}
- // Delay for longer if turned on manually
- id(relay_stable_time) = ::time(NULL) + id(ufh_manual_delay);
+ {
+ auto offcall = id(ntc_climate).make_call();
+ offcall.set_mode("OFF");
+ offcall.perform();
+ }
+ id(back_to_auto).execute();
break;
case ${domo_thresh}: /* Temperature setpoint */
- id(temp_setpoint) = x["svalue1"].as<float>();
+ double temp = x["svalue1"].as<double>();
auto call = id(ntc_climate).make_call();
call.set_mode("HEAT");
- call.set_target_temperature(id(temp_setpoint));
+ call.set_target_temperature(temp);
call.perform();
- ESP_LOGD("mqtt", "Got temp_setpoint %f", id(temp_setpoint));
+ ESP_LOGD("mqtt", "Got temp_setpoint %f", temp);
break;
}
light:
- platform: status_led
- internal: true
pin: GPIO23
id: blue_led
restore_mode: ALWAYS_OFF
then:
- lambda: |-
id(tell_domo_nvalue)->execute(${domo_ufh}, 1);
- id(relay_stable_time) = ::time(NULL) + id(ufh_auto_delay);
on_turn_off:
then:
- lambda: |-
id(tell_domo_nvalue)->execute(${domo_ufh}, 0);
- id(relay_stable_time) = ::time(NULL) + id(ufh_auto_delay + 30);
sensor:
- platform: ntc
idle_action:
- switch.turn_off: ufh_relay
on_control:
- - lambda: ESP_LOGI("CLIMATE", "on_control");
- on_state:
- lambda: |-
- if (id(ntc_climate).target_temperature != id(temp_setpoint)) {
- ESP_LOGI("UFH", "Tell domo target changed from %f °C to %f °C",
- id(temp_setpoint), id(ntc_climate).target_temperature);
- id(temp_setpoint) = id(ntc_climate).target_temperature;
- id(tell_domo_nsvalues)->execute(${domo_thresh}, 2, std::to_string(id(temp_setpoint)));
- }
+ auto temp = x.get_target_temperature();
+ if (temp && temp.value() != id(ntc_climate).target_temperature) {
+ ESP_LOGI("CLIMATE", "on_control, set target %f to %f",
+ id(ntc_climate).target_temperature, temp.value());
+ id(tell_domo_svalue)->execute(${domo_thresh},
+ std::to_string(temp.value()));
+ }
interval: