Thermostat card turned off when there’s a power outage

Did you read the link in post #6? What you posted above is unreadable for debugging purposes. Spaces are critical to the format.

Open the ESPHome tab then click on “Edit” in the device. When you are editing the configuration code, select all then copy to clipboard. In the forum, start a post and click on the </> icon at the top. Then paste your code in the message body where prompted. This preserves the indentation of YAML code. If it isn’t properly indented, we can’t efficiently read the code.

esphome:

name: ac-thermostat

esp8266:

board: d1_mini

# Enable logging

logger:

# Enable Home Assistant API

api:

encryption:

key: 

ota:

password: "1dd0f806a587ddc1fa1f9b045984e848"

wifi:

ssid: !secret wifi_ssid

password: !secret wifi_password

# Enable fallback hotspot (captive portal) in case wifi connection fails

ap:

ssid: "Ac-Thermostat Fallback Hotspot"

password: "dpW9xUvghNvi"

mqtt:

broker: 192.168.1.134

username: mqtt

password: 427sohc

sensor:

- platform: dht

pin: D7

temperature:

name: "Living Room Temperature"

id: livingroom_temp

humidity:

name: "Living Room Humidity"

id: livingroom_humity

update_interval: 60s

switch:

- platform: gpio

pin: 05

name: "Heat"

id: Heat

- platform: gpio

pin: 04

name: "AC"

id: "AC"

climate:

- platform: thermostat

visual:

min_temperature: 10 °C

max_temperature: 37.7°C

temperature_step: 1 °C

name: "Home Climate Controller"

sensor: livingroom_temp

min_cooling_off_time: 300s

min_cooling_run_time: 150s

min_heating_off_time: 300s

min_heating_run_time: 150s

min_idle_time: 30s

cool_action:

- switch.turn_on: AC

heat_action:

- switch.turn_on: Heat

idle_action:

- switch.turn_off: AC

- switch.turn_off: Heat

default_preset: Home

preset:

- name: Home

default_target_temperature_low: 25 °C

default_target_temperature_high: 26 °C

captive_portal:

did exactly as Instructed. If I reboot or remove the power from the pi the HA is on everything work properly. Which make me believe that the problem is with wifi router and d1min not connecting quick enough. It also pass the validate.

I did not see anyone instruct you to cut the power to HA.
Glad it worked, but you really shouldn’t do that.

did exactly as instructed to up load my yaml. Shutting down the pi or restarting HA ever thing works fine, but when there is a loss of power to the whole house it doesn’t .
Which make me believe that the problem is with wifi router and d1min not connecting quick enough. It also pass the validate.
And now did an update to ESPHome and now can not update the d1mim oat.Went back and restored from back up fix that issue.

Nope…

If you had done it correctly then it would look like this:

esphome:
  name: david-remote

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "RsveWB6pJa72QSBcf08G7wgVJRm9idmX+VIXyzDOQmA="

ota:
  password: "e38d3ee526ecc0aec7d8fcd1c98a20ac"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "David-Remote Fallback Hotspot"
    password: "cIHaBV9Kv5xC"

captive_portal:

binary_sensor:
  - platform: gpio
    pin: GPIO5
    name: "David TV on/off"

light:
  - platform: neopixelbus
    type: GRB
    id: light1
    variant: WS2811
    pin: GPIO9
    num_leds: 8
    name: "David TV front light"
    internal: true

  - platform: partition
    name: "David TV front light Partition Light 1"
    segments:
      # Use first 10 LEDs from the light with ID light1
      - id: light1
        from: 0
        to: 1

See how there is spaces on the left of some words?
That shows that you did not copy the code from the ESP-Home editor. You (again) just copied the code you pasted in post 14, right?

Looking at the screenshot you posted before, we can see that there are spaces. But you didn’t copy from there.
So… No, you did not do as instructed.

When the ESP device has a power loss it will reboot and return to the state it was programmed to have at boot.
Most likely that is a low output on the pin that controls the relay.

I did exactlyas told to do in post 20 and copy and pasted from esphome editor same pace I took screen shot. don’t know why its is coming out this way.

In that case there is something wrong with your computer that does not copy spaces.

that bing the case can you just look at a text file or a screen shot.if it passes the validate than the spacing is correct right.