I have flashed ESPHome on Sonoff basic some years ago. Get the error message that yaml file is missing “api” line. Would like to add it, but do not have original yaml file that I could adjust and upload OTA to Sonoff. And i have several of sonoffs, some of them basic, others are POW. Is there any way I can read back yaml file from sonoff to my windows pc? Any tool for that?
no
Thanks, is it possible to share working yaml file with: basic code to turn off/on power and LED + connection to wifi, OTA enabling, API for connection from HA and mqtt? So that I could use as the basis and reduce probability for failure…
It’s all there already.
Or for a newer revision:
# Basic Config
esphome:
name: sonoff_basic_esp1
platform: ESP8266
board: esp8285
wifi:
ssid: "ssid"
password: "psw"
logger:
api:
encryption:
key: Z3JldGE3MzYK
ota:
# Device Specific Config
binary_sensor:
- platform: gpio
id: push_button
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
internal: true
on_press:
# Prevents unintended LED lit states.
if:
condition:
- switch.is_off: relay
then:
- switch.turn_on: blue_led
- switch.turn_on: relay
else:
- switch.turn_off: relay
switch:
# The relay switches on the red side of the LED when active.
- platform: gpio
name: "Sonoff Basic Relay"
pin: GPIO12
id: relay
on_turn_off:
if:
condition:
- switch.is_on: blue_led
then:
- switch.turn_off: blue_led
# With this we can control the blue side of the LED.
- platform: gpio
id: blue_led
pin:
number: GPIO13
inverted: True
Tried this to upload via OTA, but getting error message “Update Failed: ERROR[10]: Magic byte is wrong, not 0xE9”
Use manual download, legacy format,
and then flash it using the web portal
Worst case, you’ll have to use a serial port with espflasher
What does that mean?