Sonoff S31 flashed with EspHome keep on becoming “unavailable”

Just last night I flashed my sonoff s31 with esphome hoping for a better/stable control. But the switch keeps on going unavailable for some reason.

Anyone have any ideas? Thanks!!

Entity history:

Seeing this in the logs:

If you have a blind spot in your WiFi network or something that makes EM noise, then switching firmware will not help.

I had to set the ping option under the add-on ESPHome extra settings or else nodes did drop like flies.
Further thought, how many nodes or devices do you run per router, there is a max number that they can support before wifi gets iffy.

One of the switches is barely 20 feet away from the wifi router. I checked the network strength and it’s pretty good.

This is the network strength for this specific “pathway” switch:

[10:06:00][C][wifi:367]:   Hostname: 'pathway-lights-switch'
[10:06:00][C][wifi:369]:   Signal strength: -54 dB ▂▄▆█
[10:06:00][C][wifi:373]:   Channel: 2
[10:06:00][C][wifi:374]:   Subnet:
[10:06:00][C][wifi:375]:   Gateway:
[10:06:00][C][wifi:376]:   DNS1:
[10:06:00][C][wifi:377]:   DNS2:

I only have 5 esphome devices. All of them are sonoff S31.

Can you pls tell me where in the add-on setting can I configure the ping option? I am not able to find it.

fyi this is the esphome config for this switch:

  name: pathway-lights-switch
  platform: ESP8266
  board: esp8285

  ssid: "MyWifi"
  password: "x"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "pathway-lights-switch-fallback"
    password: "x"

# Enable Home Assistant API    

  password: "x"

  - platform: gpio
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "pathway-lights-switch Basic Button"
      - switch.toggle: relay

  - platform: gpio
    name: "pathway-lights-switch Relay"
    pin: GPIO12
    id: relay

    number: GPIO13
    inverted: yes

  baud_rate: 0

  rx_pin: RX
  baud_rate: 4800

  - platform: cse7766
      name: "pathway-lights-switch Pow R2 Current"
      name: "pathway-lights-switch Pow R2 Voltage"
      name: "pathway-lights-switch Pow R2 Power"
      name: "pathway-lights-switch Pow R2 Energy"

Under settings add-ons/esphome/ the rest in the picture.

That are not too many nodes so no problem there.

you could also try:

  power_save_mode: none
  output_power: 20db
  fast_connect: true
1 Like

thanks a lot! the “use ping for status” bit seems to have stabilized all the sonoff switches.

when you get a chance, could you pls explain what does this part do? just in case things go bad again and i have something else to try out.

  power_save_mode: none
  output_power: 20db
  fast_connect: true

If you use one access point for your node, you can use fast_connect to reconnect faster, to that AP. If you had set multiple AP in your ESPHome yaml code you would not be able to do so.
The Power safe is what it is, do you run it on batteries it is wise to have a rest, so the beaconing goes down, and the transmission too, if you set power safe mode to none, it will always send and receive.
Then the power mode, well some nodes I have run at 17db I hope it will not fry them but it does help to set the signal strength… sometimes!

That is why I did recommend this for you or others to try if they get stuck with dropping nodes or bad connections. If it does not help well then we need to look further it is just what does the trick for me.

The pinging of the nodes does give you more traffic on your router, but seen the fact that it is not maxed out yet, you can use it, and it will keep a constant stream of asking and answering going, like node are you still in the air, and then the node needs to answer if so, so this goes on in set intervals.

1 Like