ESP-Home Deepsleep with output-component. How does it work

Hello together,

im struggeling now a long time and now i want to ask Community as a last try.

My Simple UseCase:
ESP-Home → Battery powered ESP controlling (Binary) Christmas-lights. For saving Energy the ESP goes to deepsleep then comes up set light on or off and go to deepsleep again.

My Work so far:
I made a small Hardware-setup with two mosfets to be able to toggle my lights on and off and keep state when input pin is floating. IT works perfectly fine, also in combination with the ESP-Home

The Problem:
when entering DeepSleep, the output pin is taken to Ground. I want it floating to have my hardware toggle keep the state. So always it shut my lights off. im googling and reading all the docs about output and deepsleep, but there is no hint how to let the pin simple flowing instead of pulling it to ground

My Code:

esp8266:
  board: esp01_1m
  
esphome:
  name: esphome_lamp
  friendly_name: lamp control with deep sleep

# switch.turn_off: cool

  on_boot:
    priority: -100
    then:
      - delay: 10s
      - logger.log: "Checking state"
      - lambda: |-
         if (id(lightOn).state) {
            ESP_LOGD("main", "go on please");
            id(gpio15).turn_on();
          } else {
            ESP_LOGD("main", "go off please");
            id(gpio15).turn_off();
         }
      - delay: 5s
      #- deep_sleep.enter: deep_sleep_1


deep_sleep:
  run_duration: 1min
  sleep_duration: 1min
  id: deep_sleep_1

binary_sensor:
  - platform: homeassistant
    internal: True
    id: "lightOn"
    entity_id: "input_boolean.tt"

output:
  - platform: gpio
    pin: GPIO15
    id: "gpio15"

btw the deep_sleep enter is just commented out for testing. It now just goes to deepsleep after 1 minute instead of directly after set wanted output. Later it should sleep for 15 minutes come up and directly go to sleep again

thanks a lot in advance

First of all, you have wrong board on your code.

Try with Gpio5 for your output, Gpio15 is strapping pin.

wow Thanks alot for that quick answer, that board seems to be some copy from the internet mistake. i replaced that for esp8266: board: nodemcuv2 what seems to be the right configuration but with my error it does nothing.

Now the pin change, that actually did the business. I need to lookup the pins description why that actually happens. Now my lamp keep state when going to deepsleep but when booting it pulls the gpio on ground, so for my script now i have a 10 second off light.

is there some recover my output state from deepsleep for gpio? i will also try to search that in the docs

Gpios 4-5 and 12-14 are the “safest” general pins to use.
If you are only using your output as on/off, you could use switch component instead.

Read the section for restore_mode.

Thank you, it just works now like it should

Nice. :+1:
Remember the “easy pins” if you play with Esp8266 beyond the current setup.
I suggest Esp32 though.