Sonoff all disconnected

Hello,
Since 2 days my Sonoff devices are disconnecting all the time to finally completely not working on HA.
Here is a log that maybe can help ?

«
Logger: custom_components.sonoff.core.ewelink.cloud
Source: custom_components/sonoff/core/ewelink/cloud.py:322
Integration: Sonoff (documentation, issues)
First occurred: 17:14:42 (8 occurrences)
Last logged: 20:36:01

Cloud WS exception
Traceback (most recent call last):
File “/config/custom_components/sonoff/core/ewelink/cloud.py”, line 322, in connect
raise Exception(resp)
Exception: {‘error’: 406, ‘reason’: ‘Authentication Failed’, ‘apikey’: ‘0803fff1-25e4-4011-a6d9-0dac01a77228’, ‘sequence’: ‘1693736082416’, ‘actionName’: ‘userOnline’}
«

Any idea please ? I have more than 40 devices that are not working anymore.
Thank you so much
Yann

I got those too! I simple logged out and re-logged in using the eWeLink HA integration when it happens. Just check my log and have another twenty as of right now. Looks like eWeLink is having/causing the issue. I also have the Sonoff/AlexxIT (HACS) running and is still working just fine.

Try restarting the eWeLink add-on and then individually polling each device.

Looks like they final restarted the server after I reported issues with it.

Hello :slight_smile:
Thank you for the answer. Well, I do not have EWeLink integration I only use HACS SonoffLan.
So I made an update and it came back. I wait to see during the day if they disconnect again.
Thank you
:slight_smile:

Hello,
So I update and it worked correctly couple of hours then again all disconnected. That is really bad :frowning:
Any idea what I should check now?
Thank you :slight_smile:

One of the log I get :

Logger: custom_components.sonoff.core.ewelink.cloud
Source: custom_components/sonoff/core/ewelink/cloud.py:323
Integration: Sonoff (documentation, issues)
First occurred: 13:26:02 (6 occurrences)
Last logged: 14:47:20

Cloud WS exception
Traceback (most recent call last):
File “/config/custom_components/sonoff/core/ewelink/cloud.py”, line 323, in connect
raise Exception(resp)
Exception: {‘error’: 406, ‘reason’: ‘Authentication Failed’, ‘apikey’: ‘0803fff1-25e4-4011-a6d9-0dac01a77228’, ‘sequence’: ‘1693808762759’, ‘actionName’: ‘userOnline’}

I experienced similar behavior some time ago. I downgraded SonoffLAN to v3.3.1, let it “settle” on that older version for a couple of days until the mysterious disconnections started again. Then I upgraded SonoffLAN to the latest v3.5.2 again. This finally “fixed” the issue and those disconnections stopped. Worth a try, Laurent.

Ok thank you Tamsy :slight_smile:
Will try to downgrade so, I never do it before. Will search how to do that and give an update after to you guys.
Thank you :slight_smile:

Simple enough:

HA → HACS → Intergrations → Sonoff LAN → 3 vertical dots on upper right corner → Re-Download → Dropdown “Choose Version” → v.3.3.1 → Download

Note: You have to restart Home Assistant after downgrading/upgrading!

Thanks,a lot for the information :slight_smile:
So I have now downgraded and after a restart, it shows that I need to re-configure Sonoff integration, and 2 account appeared (same tel# but country code only and second with +).
Anyway I enter my informations and get this message:

Update:
I search and found that some people change these informations:
Try changing the 0 to 1 in line 107 of /custom_components/sonoff/core/ewelink/cloud.py

SonoffLAN/custom_components/sonoff/core/ewelink/cloud.py

Line 107 in c317407

async def login(self, username: str, password: str, app=0) → bool:

async def login(self, username: str, password: str, app=1) → bool:

edit:

and do the same change from 0 to 1 in line 157 of the same file:

SonoffLAN/custom_components/sonoff/core/ewelink/cloud.py

Line 157 in c317407

async def login_token(self, token: str, app: int = 0) → bool:

async def login_token(self, token: str, app: int = 1) → bool:

and restart HA

So I try and it works :slight_smile: even if I do not understand really what these changes means :-)-)

Which one?

Are you using SonoffLAN and the official Sonoff integration in parallel?

Yes. Before I had EWeLink. Then I delete it and install SonoffLAN. I thought Sonoff integration was part of SonoffLAN. Seems that I missed something here… should I also delete Sonoff Integration ?

So eWeLink Support sent me this earlier today:

Greetings,

We appreciate your engagement with our services.

Our server has observed a substantial influx of requests originating from this project. After a thorough analysis, we’ve identified that many users are utilizing default personal APPID configuration parameters. However, as this project still employs the v1 interface, which is no longer under maintenance, it’s leading to various issues.

To ensure interface security and mitigate potential risks, we are gradually discontinuing the v1 interface and will render it entirely inaccessible in the future.

We encourage individual users to utilize the eWeLink Developer Center for free. By visiting https://dev.ewelink.cc/, you can create your own application and obtain a unique APPID. This personalized APPID can be used continuously within reasonable limits.

We’ve also taken note of reports from numerous users indicating certain feature limitations due to the project being inactive for the past three years. An alternative option available is the ewelink-api-next - npm library. This library leverages the v2 interface and has comprehensively encapsulated all available v2 interfaces. It offers local area network discovery, and control functionalities, and facilitates bidirectional communication with devices through established WebSocket connections. This enables real-time data exchange and receipt of device-generated updates.

Should you require further information or assistance, please don’t hesitate to contact us.

So it looks like the SonoffLan Integration by AlexxIT will need to be update to the eWeLink V2 standard and the documentation also updated.

I 've posted this same response in the AlexxIT - Sonoff repository issues area.

Thank you, that’s good informations.
So about Sonoff device, do you use SonoffLAN and Sonoff integration, or only SonoffLAN?

I’m using the SonoffLan (AlexxIT/HACS) and the eWeLink Sonoff Add-On (Which could be disabled very soon since they are working on a Web App that looks like HA (there maybe a subscription cost involved).
So I’m hoping that AlexxIT will redo the SonoffLAN to use the new V2 API instead and drop eWeLink (except to use the phone app to pair it to the home network (LAN).
I can do things with HA that their Web App and phone app won’t let you do currently, so I’ll stick with SonoffLAN (AlexxIT) over all that other stuff :frowning:
Otherwise I may have to resort to flashing my plugs, another learning curve and hardware purchase involved.

That’s interesting. You mention Ewelink Sonoff Add-on…is it this add-on ? :

I start to be confuse :slight_smile: in fact, it is,installation in HACS of SonoffLAN then configuration in add-on app Sonoff. Right? If yes, it means that I have only SonoffLAN.

That is the HACs (AlexxIT-Sonoff).
The eWeLink could be listed in the left hand menu panel like this:


OR
It should be listed in the Add-Ons under settings:

Thank you Lordwizzard :slight_smile: so I have only SonoffLAN installed :slight_smile:

is this come ffrom alexxit Sonoff screen shot?.
mine do not have the add-on menu