domo_ufh: "916"
domo_temp: "917"
domo_thresh: "915"
-
+ adc_pin: GPIO32
+
esphome:
name: ${name}
packages:
base: !include base.yaml
+ ufh: !include ufh.yaml
wifi:
power_save_mode: none
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_pw
- bssid: !secret wndr3800_bssid
+ bssid: !secret lantiq_bssid
priority: 1
script:
- - id: back_to_auto
+ - id: submit_cooker
mode: restart
then:
- - delay: 30 min
- - climate.control:
- id: ntc_climate
- mode: HEAT
-
+ - delay: 100ms
+ - lambda: |-
+ id(tell_domo_svalue)->execute(918, std::to_string(id(cooker_temp).state) +
+ ";" + std::to_string(id(cooker_hum).state) +
+ ";0");
time:
- platform: sntp
on_time:
on_connect:
then:
- light.turn_on: blue_led
- - 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_svalue)->execute(${domo_thresh},
- std::to_string(id(ntc_climate).target_temperature));
-
on_disconnect:
then:
- light.turn_off: blue_led
int nvalue = x["nvalue"].as<int>();
// ESP_LOGD("on_json_message", x["name"]);
- switch (idx) {
- case ${domo_ufh}: /* UFH relay */
- if (nvalue) {
- id(ufh_relay).turn_on();
- } else {
- id(ufh_relay).turn_off();
- }
- {
- auto offcall = id(ntc_climate).make_call();
- offcall.set_mode("OFF");
- offcall.perform();
- }
- id(back_to_auto).execute();
- break;
-
- case ${domo_thresh}: /* Temperature setpoint */
- double temp = x["svalue1"].as<double>();
- auto call = id(ntc_climate).make_call();
- call.set_mode("HEAT");
- call.set_target_temperature(temp);
- call.perform();
- ESP_LOGD("mqtt", "Got temp_setpoint %f", temp);
- break;
- }
light:
- platform: status_led
id: blue_led
restore_mode: ALWAYS_OFF
-switch:
- - platform: gpio
- id: ntc_vcc
- pin: GPIO25
- restore_mode: ALWAYS_OFF
-
- - platform: gpio
- name: "Kitchen UFH"
- id: ufh_relay
- pin: GPIO16
- restore_mode: ALWAYS_OFF
- on_turn_on:
- then:
- - lambda: |-
- id(tell_domo_nvalue)->execute(${domo_ufh}, 1);
- on_turn_off:
- then:
- - lambda: |-
- id(tell_domo_nvalue)->execute(${domo_ufh}, 0);
-
sensor:
- platform: dht
pin:
pullup: true
model: DHT22
temperature:
- name: "${room_name} Temperature"
+ id: cooker_temp
+ name: "Cooker Temperature"
+ on_value:
+ - script.execute:
+ id: submit_cooker
humidity:
- name: "${room_name} Humidity"
+ id: cooker_hum
+ name: "Cooker Humidity"
+ on_value:
+ - script.execute:
+ id: submit_cooker
update_interval: 10s
- - platform: ntc
- id: ntc_temperature
- sensor: ntc_resistance
+ - id: !extend ntc_temperature
calibration:
# Hiwell E91.716 gives these in detail. The SunStone Touchstat manual just says
# "10kΩ at 25°C, 12.1kΩ at 20°C, 14.7kΩ at 15°C, which looks basically the same.
# - 12.55 kOhm - > 17.6°C
- 12.30 kOhm -> 18.2°C
- 9.97 kOhm -> 23.5°C
- filters:
- - exponential_moving_average:
- send_every: 1
- send_first_at: 1
- - clamp:
- min_value: 5
- max_value: 35
- ignore_out_of_range: true
- on_value:
- then:
- lambda: |-
- if (!isnan(x))
- id(tell_domo_svalue)->execute(${domo_temp}, std::to_string(x));
-
- - platform: resistance
- id: ntc_resistance
- sensor: ntc_adc
- reference_voltage: 3.28v # measured
- resistor: 9.97 kOhm
- configuration: DOWNSTREAM
- filters:
- - median:
- window_size: 5
- send_every: 5
- send_first_at: 5
-
- - platform: adc
- id: ntc_adc
- attenuation: 12dB
- update_interval: never
- pin: GPIO32
+ - id: !extend ntc_adc
filters:
- multiply: 0.987 # Calibrated vs. multimeter
# 0.80 -> 0.78
# 2.52 -> 2.49
# 1.99 -> 1.96
-climate:
- - platform: thermostat
- id: ntc_climate
- name: "Kitchen floor"
- sensor: ntc_temperature
- min_heating_off_time: 300s
- min_heating_run_time: 300s
- min_idle_time: 30s
- heat_deadband: 0.2°C
- heat_action:
- - switch.turn_on: ufh_relay
- idle_action:
- - switch.turn_off: ufh_relay
- on_control:
- - lambda: |-
- 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:
- - interval: 60s
- then:
- - switch.turn_on: ntc_vcc
- - delay: 1s
- - component.update: ntc_adc
- - delay: 0.5s
- - component.update: ntc_adc
- - delay: 0.5s
- - component.update: ntc_adc
- - delay: 0.5s
- - component.update: ntc_adc
- - delay: 0.5s
- - component.update: ntc_adc
- - switch.turn_off: ntc_vcc
-
-