Sonoff SV, Upload Failed Program flash size is larger than real flash size

trying to upload the below code

esphome:
  name: sonof_sv
  platform: ESP8266
  board: nodemcuv2
  board_flash_mode: dout


wifi:
  ssid: "xxx"
  password: "xxx"
  manual_ip:
    static_ip: 192.168.1.1
    gateway: 192.168.1.2
    subnet: 255.255.255.0
    
# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

web_server:
  port: 80
  
ota:


uart:
  rx_pin: RX
  baud_rate: 4800


output:
  - platform: esp8266_pwm
    id: sonoff_sv_green_led
    pin:
      number: GPIO13
      inverted: True

light:
  - platform: monochromatic
    name: "Sonoff SV green LED"
    output: sonoff_sv_green_led
    id: led

sensor:
  - platform: wifi_signal
    name: "Sonoff SV WiFi Signal"
    update_interval: 60s
  - platform: uptime
    name: "Sonoff SV Uptime"



# Enable time component to reset energy at midnight
time:
  - platform: homeassistant
    id: homeassistant_time   

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Sonoff SV Button"
    on_press:
      - switch.toggle: sonoff_sv_fakebutton


  - platform: status
    name: "Sonoff SV status"

switch:
  - platform: template
    name: "Sonof SV"
    optimistic: true
    id: sonoff_sv_fakebutton
    turn_on_action:
    - switch.turn_on: relay
    - light.turn_on: led
    turn_off_action:
    - switch.turn_off: relay
    - light.turn_off: led
  - platform: gpio
    id: relay
    pin: GPIO12


  - platform: restart
    name: "Sonoff SV restart"



text_sensor:
  - platform: version
    name: "Sonoff SV ESPHome Version"

Try setting board to esp01_1m and removing flash mode.

1 Like

yep, that did it

for the cookbook

esphome:
  name: sonoff_sv
  platform: ESP8266
  board: esp01_1m


wifi:
  ssid: "xxx"
  password: "xxx"
  manual_ip:
    static_ip: 192.168.1.1
    gateway: 192.168.1.2
    subnet: 255.255.255.0
    
# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

web_server:
  port: 80
  
ota:


uart:
  rx_pin: RX
  baud_rate: 4800


output:
  - platform: esp8266_pwm
    id: sonoff_sv_green_led
    pin:
      number: GPIO13
      inverted: True

light:
  - platform: monochromatic
    name: "Sonoff SV green LED"
    output: sonoff_sv_green_led
    id: led

sensor:
  - platform: wifi_signal
    name: "Sonoff SV WiFi Signal"
    update_interval: 60s
  - platform: uptime
    name: "Sonoff SV Uptime"



# Enable time component to reset energy at midnight
time:
  - platform: homeassistant
    id: homeassistant_time   

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Sonoff SV Button"
    on_press:
      - switch.toggle: sonoff_sv_fakebutton


  - platform: status
    name: "Sonoff SV status"

switch:
  - platform: template
    name: "Sonof SV"
    optimistic: true
    id: sonoff_sv_fakebutton
    turn_on_action:
    - switch.turn_on: relay
    - light.turn_on: led
    turn_off_action:
    - switch.turn_off: relay
    - light.turn_off: led
  - platform: gpio
    id: relay
    pin: GPIO12


  - platform: restart
    name: "Sonoff SV restart"



text_sensor:
  - platform: version
    name: "Sonoff SV ESPHome Version"

It is already documented: https://esphome.io/devices/sonoff.html#sonoff-sv