ESP is not connected to turn off the safety relay

Hello,
I would like to use esp8266 (esp01) for temperature control with esphome via homeassistant. I already have such a solution, but I would need to upgrade (improve) it. I have to heat up to max 28C with homeassistant climate. what I would need to solve: if the temperature value rises above a certain degree (e.g. 30 C) and the esp8266 does not have a wifi connection at that time (that is, it cannot communicate with homeassistant), then I would need to immediately turn off the relay in an emergency.
How could I program it?

I currently use the simplest version:

sensor:

  • platform: dallas
    id: “heater_temp”
    address: 0x1XXXXXXXXXXXXXX8
    name: “heater_temp”

switch:

  • platform: gpio
    id: heater_relay1
    name: “Heater indoor”
    pin: 0
    inverted: True
    restore_mode: RESTORE_DEFAULT_OFF

Sorry for my bad english.

You can add an automation to Dallas using on_value or on_value_range to check if the temperature is above 30

and also check the wifi connection.connected

Or do the whole automation on Esphome, so it takes care of your heating even if wifi or home assistant goes down.

Hello,

Am I right that if I use on_value_range, the relay will turn off above 30C and turn on below 5C? Will I be able to handle the values ​​between the two in homeassistant (for example, between 7C and 28C)?

Something like this:

sensor:

  • platform: dallas
    id: “heater_temp”
    address: 0x1XXXXXXXXXXXXXX8
    name: “heater_temp”
    on_value_range:
    • above: 30
      then:
      • switch.turn_off: heater_relay1
    • below: 5
      then:
      • switch.turn_on: heater_relay1

switch:

  • platform: gpio
    id: heater_relay1
    name: “Heater indoor”
    pin: 0
    inverted: True
    restore_mode: RESTORE_DEFAULT_OFF

As others mentioned, for this kind of scenario it usually makes sense to do it all on the ESP device. There are a couple climate options with ESPHome depending on what you’re trying to do, but here’s probably the most basic/common:

Yes. Between 7 and 28 you can still handle in HA.

Actually between 5 and 30.
Because the logic is below 5 and above 30, then the esphome will control when it reaches 4 or 31.

Please format your code correctly. It will help others identify any issues with spaces (very important in yaml) as well as making your code easier to read.