This Yaml seems overcomplicated for such a simple device.
What happens if you flash it with a simple normal yaml?
Just the bare minimum.
Static IP has been either hit or miss for me. Some just won’t work with static IP.
This Yaml seems overcomplicated for such a simple device.
What happens if you flash it with a simple normal yaml?
Just the bare minimum.
Static IP has been either hit or miss for me. Some just won’t work with static IP.
Thanks for the reply. I just copied the config from the official ESPHome website. I’ll simplify the code by using the default code in ESPHome in HA. I’ll let you know how it goes.
Just my experience.
For new devices usually using minimal configuration: wifi/api/ota
Just to get connected to WiFi & HA.
BTW if it not connected no WiFi - it must startup own Access Point (have ap:
in config).
Do You see this network ?
Thanks, have not set up the AP. But I’ll try that and let everyone know. Thanks a lot to everyone trying to assist. I really do appreciate it.
What does UART output of device says? Conect uart reader to rx/tx and see.
That’s strange… i have 30+ devices on esphome, all have static IP’s and i never had a single problem with it.
And, i don’t see that above yaml would be “too complicated” for esp32…
BTW… what does “magic switch” do?
Ok… I see a lot that is not needed to get ESP-Home running on a device.
BLE for example.
Didn’t you just say?.. Never mind…
Well, I’ve had ble (bt proxy), two switches, one dimmer and BME280 sensor on one esp32 for quite a while without any issues…
And i really do wonder “what does magic switch do”… i’ve looked the source and it doesn’t say much…
That is not the point.
First we establish if there is something wrong with the basic configuration, then we add the rest.
Hi all,
Thanks for the recommendations. So I tried with minium code below:
esphome:
name: sonoff-basic-test
friendly_name: Sonoff Basic Test
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "wOaYwbiLiE+sXZ+tPYpGsfjlhqaawuihcqpgvvrp2pFlAUL5QgCx2hP13jv7ewawawaddd60="
ota:
password: "efklfe;hfawpiwpwawadpuh911972"
wifi:
ssid: "Test"
password: "test"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sonoff-Basic-Test"
password: "Test"
captive_portal:
The device is online!
So now my question is, what “minimum” additional code must I add? Probably a stupid question, but I’m fairly confused at the moment. The reason why I ask is I just copied the sample code from the official ESPHome website for this device which was not working.
Kind regards,
Robbie
I managed to adapt the configuration example from Sonoff BASIC R4 v1.0 | devices.esphome.io in a way that implements all the same functionality (except that it uses a switch
instead of a light
, but that’s mainly an aesthetic difference).
Like you, I started with a minimum install through the ESPhome wizard. Then all you need to do is add the following lines at the bottom:
#magic switch mode
external_components:
- source:
type: git
url: https://github.com/ssieb/esphome_components
components: [ magic_switch ]
magic_switch:
pin: 5
on_switch:
- switch.toggle: switch_1
binary_sensor:
- platform: gpio
pin:
number: GPIO9
mode:
input: true
pullup: true
inverted: true
id: button_1
on_press:
then:
- switch.toggle: switch_1
output:
- platform: gpio
pin: GPIO4
id: relay_1
switch:
- platform: output
name: Switch
id: switch_1
output: relay_1
status_led:
pin:
number: GPIO6
inverted: yes
See Sonoff R4 Basic unable to update · Issue #5757 · esphome/issues · GitHub for the full configuration file.
Great.
Either you do as bemer says above.
Or you add one part at the time until it breaks.
Since it didn’t connect then I would guess we can try manual IP first, that is a good suspect.
If it still works then I would try the external component.
Hi all,
I tried this code and everything is working perfectly. Thank you so much!
I’m not quite sure which post to mark as the solution as all of you helped?
For simplicity, I’ll mark the last reply as the solution.
esphome:
name: robbiejnr-sonoff-basic-blanket
friendly_name: Robbie Jnr Sonoff Basic Blanket
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "wOaYwbiLiE+sXZ+tPYpGwwadwadegq3uy2o1-`112er1"
ota:
password: "0cwwafcf753d0485cab8wadfaa35weeegdwagwaeg698aa2"
wifi:
ssid: "Test"
password: "Test"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sonoff-Basic-Test-Backup-AP"
password: "Test"
binary_sensor:
- platform: gpio
pin:
number: GPIO9
mode:
input: true
pullup: true
inverted: true
id: button_1
on_press:
then:
- light.toggle: power_1
output:
- platform: gpio
pin: GPIO4
id: relay_1
light:
- platform: binary
name: Power
id: power_1
output: relay_1
status_led:
pin:
number: GPIO6
inverted: yes
Again, thanks a lot to each and everyone who helped. I really appreciate it!
I am joining this thread because I have the exact same issue, and I found a solution.
I have ten, maybe more, Sonoff Basic modules around my home. Plus dozens of other ESP devices). I have always been good about updating them as the new firmware is released. It’s never been a problem before ESPHome 2024.4 was released.
Here is the log from a device compiled on ESPHome 2024.4.4:
[13:21:36][D][wifi:462]: Starting scan...
[13:21:42][D][wifi:477]: Found networks:
[13:21:42][D][wifi:479]: No network found!
Compiling with ESPHome 2023.9 works. Here is the same section of the log:
[13:24:31][D][wifi:428]: Starting scan...
[13:24:37][D][wifi:443]: Found networks:
[13:24:37][I][wifi:486]: - 'iot' (5A:91:E3:F1:47:8E)
[13:24:37][D][wifi:488]: Channel: 1
[13:24:37][D][wifi:489]: RSSI: -71 dB
[13:24:37][I][wifi:486]: - 'iot' (46:52:A1:D5:8B:7C)
[13:24:37][D][wifi:488]: Channel: 6
[13:24:37][D][wifi:489]: RSSI: -93 dB
[13:24:37][D][wifi:491]: - 'Kaywinnet' (30:DE:4B:8D:A9:AA)
[13:24:37][D][wifi:491]: - 'Kaywinnet' (50:91:E3:F1:47:8E)
[13:24:37][D][wifi:491]: - 'MannGuest' (56:91:E3:F1:47:8E)
[13:24:37][D][wifi:491]: - 'MannGuest' (42:52:A1:D5:8B:7C)
[13:24:37][I][wifi:277]: WiFi Connecting to 'iot'...
[13:24:39][I][wifi:560]: WiFi Connected!
[13:24:39][C][wifi:382]: Local MAC: 60:01:94:69:2D:B5
[13:24:39][C][wifi:383]: SSID: 'iot'
[13:24:39][C][wifi:384]: IP Address: 192.168.1.69
[13:24:39][C][wifi:385]: BSSID: 5A:91:E3:F1:47:8E
[13:24:39][C][wifi:387]: Hostname: 'closetpir'
[13:24:39][C][wifi:389]: Signal strength: -85 dB
[13:24:39][C][wifi:393]: Channel: 1
Here is a link to a thread that shows how to install older versions of ESPHome add-ons.
hm… going back to an older version of esphome is hardly a (permanent) solution… it’s more like patching things up…
Yet again there are unknown, undocumented breaking changes in ESP-Home.
Don’t get me wrong, I truly love the developers and community for doing all this for us.
But the constant breaking changes in ESP-Home is what truly makes it hard to work with.
In this case Stephen updated from one version to the next, so for find the error is not out of reach.
But most ESP-devices just sit there and you don’t do any changes to them.
I have one device that has not been updated since 2020, because there is no need to.
If I want to add a sensor to this then I’m sure it will break due to some incompatibility.
But the constant breaking changes in ESP-Home is what truly makes it hard to work with.
And that’s why i utterly hate that annoying “update needed” warnings for esphome devices.
Totally unnecessary, almost dangerous. Don’t fix if it’s not broken is very true rule for esphome devices. A beginner then clicks on “update”… and after that esp doesn’t work anymore…
Luckily they can be disabled manually… but they should be DISABLED by default, not enabled. Then anyone interested could enable them.
Ok, totally another story is that many (if not majority) people doesn’t read changelogs BEFORE doing updates…
There was nothing in the change logs that would have indicated a change in how the ESP connects toWiFi. I tried to raise the issue with the ESPHome devs, but they brushed it off.
Yes, i know, i did experience a problem not long ago, which was not described in changelog… i didn’t mean your particular case, but in general… just one example: bme280 was renamed to bme280_i2c. A couple of “problems” immediately appeared here like “latest update broke my bme”… but this one WAS written on changelog.
Regardig wifi problem: it’s more like some bug than breaking change, since in that case all woudl experience wifi problem.
Hey everyone, I recently received my 1st Sonoff Basic R4, but with all the advice and configs I have seen here, devices.esphome.io and on digblurDIY his website, my devices seems to be stuck in a bootloop with 2024.12.2
Anyone any ideas? Thanks in advance!