esphome: name: thermobureau esp8266: board: esp8285 # Enable Home Assistant API api: encryption: key: "K61VpR3UU3CTtHaOZcHROEdk7rtB2HWbMJ5VHcJLhEU=" ota: - platform: esphome password: "315848030ef60c32adaba1857437a2ae" wifi: ssid: "Freebox-789E5E" password: "sftbdqn5nnqwn6x4q2sxvc" min_auth_mode: WPA2 # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Sonoff Fallback Hotspot" password: "v0xOuZTqfR75" captive_portal: logger: mqtt: broker: 192.168.1.53 username: mqtt password: Secr3t sensor: - platform: mqtt_subscribe name: "Room Temperature" id: room_temp topic: "zigbee2mqtt/your_sensor" # Change to your sensor topic unit_of_measurement: "°C" value_template: "{{ value_json.temperature }}" switch: - platform: gpio pin: 12 id: relay name: "Heater Relay" select: - platform: template name: "Thermostat Mode" id: thermostat_mode options: - "Off" - "Hors gel" - "Eco" - "Confort" - "Boost" initial_option: "Eco" optimistic: true climate: - platform: thermostat name: "Heater Thermostat" id: heater_thermostat sensor: room_temp min_temperature: 5 max_temperature: 30 heat_action: - switch.turn_on: relay idle_action: - switch.turn_off: relay number: - platform: template name: "Hors gel Temperature" id: hors_gel_temp min_value: 5 max_value: 10 step: 0.5 initial_value: 7 optimistic: true - platform: template name: "Eco Temperature" id: eco_temp min_value: 10 max_value: 25 step: 0.5 initial_value: 18 optimistic: true - platform: template name: "Confort Temperature" id: confort_temp min_value: 15 max_value: 25 step: 0.5 initial_value: 21 optimistic: true - platform: template name: "Boost Temperature" id: boost_temp min_value: 18 max_value: 28 step: 0.5 initial_value: 23 optimistic: true - platform: template name: "Boost Duration (min)" id: boost_duration min_value: 5 max_value: 120 step: 1 initial_value: 30 optimistic: true interval: - interval: 1s then: - lambda: |- static unsigned long boost_start = 0; static bool boost_active = false; if (id(thermostat_mode).state == "Boost") { if (!boost_active) { boost_start = millis(); boost_active = true; } id(heater_thermostat).set_target_temperature(id(boost_temp).state); id(heater_thermostat).turn_on(); unsigned long boost_duration_ms = (unsigned long)(id(boost_duration).state * 60 * 1000); if (millis() - boost_start > boost_duration_ms) { id(thermostat_mode).publish_state("Eco"); boost_active = false; } } else { boost_active = false; if (id(thermostat_mode).state == "Hors gel") { id(heater_thermostat).set_target_temperature(id(hors_gel_temp).state); id(heater_thermostat).turn_on(); } else if (id(thermostat_mode).state == "Eco") { id(heater_thermostat).set_target_temperature(id(eco_temp).state); id(heater_thermostat).turn_on(); } else if (id(thermostat_mode).state == "Confort") { id(heater_thermostat).set_target_temperature(id(confort_temp).state); id(heater_thermostat).turn_on(); } else { id(heater_thermostat).turn_off(); } }