Offline Sonoff S31

I’m new to HA so please be gentle … I have HA setup with Sonoff S31 switches as well as an S40. I’ve loaded Sonoff LAN and put in FW blocks to keep the switches from talking back to the eWelink portal. Initially setup it all works, except that cumulative power consumption on the S40 breaks. Some hours later, the switches start going offline in HA, although the eWelink app still sees them. Am I doing something wrong or is this not possible to have these switches with stock firmware completely disconnected from the internet?

Do you have the proper sign in id/pw? Did you pull the API key(s)?

Sonoff Lan logged into my ewelink account, saw all switches, the switches are functioning for a “while” and then become “unavailable”. What do you mean API key? Did I miss something? Once they become unavailable if I reboot HA it starts working. I removed the internet block it starts working.

This is so it stays connected for 3rd party apps.

Read under Mode and debugging sections, also check your MDNS (multicast and uni-cast) setups on your networks.

https://coolkit-technologies.github.io/eWeLink-API/#/en/PlatformOverview

Thank you for taking the time to reply. I’ve set the mode now to local, was in auto. I turned on debugging and can see the log. After a period of time when everything was working I see a log entry that says:
=> Local4 | {‘cmd’: ‘info’}| File “/config/custom_components/sonoff/core/ewelink/local.py”, line 195, in send| r = await self.session.post(|aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected|
and then:
!! Local4 | Device offline

The switch now shows unavailable. In this case it is a Sonoff S40. I have both S31 lite and S40. They both do it.

I have not resorted to apikey/device key at this point.

I am not sure about MDNS. I have Pfsense and Pihole in the home. I can change the switches to NOT use Pihole if that might be the issue and point them at Pfsense for DNS.

You need mDNS (multicast and uni-cast enabled across your internal network(s)) to allow those items to discover and talk to HA. So if you IoT device are on their own subnet and your HA is on another you need both of those subnets enabled for that communication to happen. If on different VLANs they need to talk to each other not blocked. Sounds to me like you have isolated something, or not activated something.

It’s a totally flat lan, all one subnet, all one VLAN (yes I know not ideal). I tried disabling Pihole and I even added host file entries on the HA Vmware appliance, changed nothing. After a few hours the switches all go unavailable when the internet is cut off from them.

Check the mDNS (multicast/unicast) setup on the router (pfSense). You keep ignoring that part with no response. HA needs that enabled to work.

See: Network Configuration - Home Assistant

pfSense setup for mDNS: pfsense and Rules For IoT Devices with mDNS - Lawrence Technology Services

Apologies, I’m not intending to ignore your comment, I just don’t know where to start with MDNS. My lan is flat 192.168.2.x subnet 255.255.255.0, no VLANs. Pfsense is my DNS. The HA VM is running on ESX, the network on ESX is set to allow everything, ie promiscuous mode etc. The virtual NIC is E1000. The Vm is the HA OVPA appliance with no modifications. So the VM goes through ESX, through a dumb switch a Dlink GO-SW-8GE up to the wireless router a TPLink AXE75 running in AP mode. So given everything is in a flat lan there are no FW rules at play, unless I’m missing something?

1 Like

Now we are getting somewhere.
I could not find anything other than protection (only mentioned, no instructions) for your IoT devices.
I downloaded the information (manual, QI, datasheet). NADA in any of it for mDNS

Did find this as I widen my search: mDNS Service - Business Community
Also checked on a new beta firmware release tied to V 1.6.0 which runs your AXE75
ER605 V1_1.2.3_Build 20230224 Beta Firmware For Trial (Released on Feb 28th, 2023) [Thread Closed] - Business Community

I think with that router/AP you can only use TPLink and Kasa IoT devices, unless that beta firmware allows for more manufacturers.

Hopefully it can be fixed with a firmware update, but it is up to you to dig and confirm for your hardware.

I have two wireless aps in different sections of the home. One is the TP Link AX75 and the other being a linksys dir 878. I’ve moved the wireless switches over to the Linksys, see if that changes anything. All things to try. I’ve alse enable Avahi services on pfsense as per the video. Fingers and toes crossed. Thank you again for taking you time to reply.

You may very well be onto something, with the switches on my Dlink DIR-878 AP instead of the TPLink and with Avahi running on Pfsense, it’s been up for over 12 hours at this point. I will narrow down which fixed it and post back … Thank you so much LordWizard, I appreciate your help.

I’m pleased to report, you were 100% correct LordWizard the issue was the router TPLink AX75. With Avahi disabled, given I have a flat lan, the issue is resolved by having the switches on a different access point. I’ve tried a Dlink DIR878 and Linksys E3000, both work perfectly in LAN mode with Home assistant and a firewall rule in place to block the switches from talking to the internet. I’ve put back PiHole and removed the host file entries for the switching on the HA VM and everything is still working. So it was the AP. Thanks a bunch!

Great to hear that!! I built my network 1 piece at a time after lots of googling, reading, trying.