EspHome and esp-01 relay - confusing problem

Hi
I have a problem with ESP-01, i have bought a simple relay no/nc.
now I try to flash it with esphome, I know the way how to flash (at flashing time 2 pins need to be connected). But I don’t know why the device is not working. this is my code that is existing in HA ESP.
after uploading to the device the bin that is generated by HA and putting the device into the relay the result is that the relay is going in loop on / off.
second problem is when I try to upload new yaml by OTA then I get info like
“ERROR Error binary size: Error: ESP has been flashed with wrong flash size. Please choose the correct ‘board’ option (esp01_1m always works) and then flash over USB.”
can anybody help me with this? I will be greatfull.

esphome:
  name: raindance_esp1_temp2
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "xxx"
  password: "xxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Aaa Fallback Hotspot"
    password: "6zDJSadooLeO"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
switch:
  - platform: gpio
    pin: GPIO0
    name: "Relay #1"

image

Check out this post:

Are you sure that you have the Esp01-S that has 1MByte of flash memory. There are Esp01 modules with only 500 Bytes of flash memory. Then you need to change the board type to board: esp01

if I good found info then the color of mainboard when is black then it has 1MB memory, i have a black mainboard.
The problem maybe is not so big that I can’t upload it by ota - it will be nice :slight_smile: But why the espboard is not working when i send this code to the esp. is that related to the memory too?

Yes, I think that’s your problem. In the ESP01 ( 500KBytes) you cannot add the ota: functionality. Try using the esp01 board and remove the ota.

board: esp01

ota: <---Remove this line
1 Like

Without doing what the guy did in the suggested video above. I made this configuration and it works perfectly.

esphome:
  name: singlemodule2
  friendly_name: SingleModule2

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "=========================="

ota:
  password: "======================="

wifi:
# your wifi config

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Single relay fallback"
    password: "vOcGWrNlgW8d"

captive_portal:

web_server:
  port: 80

uart:
  baud_rate: 9600
  tx_pin: GPIO1
  rx_pin: GPIO3

switch:
  - platform: gpio
    name: "Relay Button"
    id: "relay"

    pin: GPIO0 # using ESP module LED
    inverted: false
    on_turn_on:
      - uart.write: [0x0a0, 0x01, 0x01,0x0a2]
      - delay: 6000ms
      - uart.write: [0x0a0, 0x01, 0x00,0x0a1]
    on_turn_off:
      - uart.write: [0x0a0, 0x01, 0x00,0x0a1]