AlexxIT / SonoffLAN

Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant
https://github.com/AlexxIT/Blog
MIT License
2.66k stars 412 forks source link

Integration stops working after a few seconds (Cloud Mode) #1033

Closed rodrigoasrodrigues closed 1 year ago

rodrigoasrodrigues commented 1 year ago

I am using cloud mode, all devices work fine for a few seconds after I restart the integration but then it all stops reading device statuses. I can still turn things on and off on HA but HA does not detect any status changes from the device itself, making buttons and sensors useless. After I restart the logs output CLOUD=>True and after a few seconds { 'online':False} then it stops working.

2022-11-14 18:19:24 [D] CLOUD True => True 2022-11-14 18:19:43 [D] a4400132a0 <= Cloud3 | {'online': False} | None

StephenMilner commented 1 year ago

I am having the same problem.

I have upgraded from 3.3.0 to 3.3.1 in an attempt to resolve this, but without success. Since this problem started without any changes in HA my guess is that Sonof/eWeLink have changed something on their platform.

For reference I am in the UK.

You can turn on a device and turn off a device without problem, it's just that the device status are not being read within a few short minutes after a reload - Problem first noticed 17:45 GMT 15/11/22

There doesn't seem to be any similar problem with Alexa integration that I can see.

I am currently running an automation every minute. I have a spare channel on a 4CH R2 Pro and I'm toggling the switch, waiting 10 seconds and testing if it has been reported back to HA as toggled - If not it triggers a reload - yaml here:

Apologies, I can't get it to format the below as code

alias: Reload Sonof
description: ""
trigger:
  - platform: time_pattern
    seconds: "30"
condition: []
action:
  - type: turn_on
    device_id: X
    entity_id: switch.sonoff_Y_1
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - if:
      - condition: device
        type: is_off
        device_id: X
        entity_id: switch.sonoff_Y_1
        domain: switch
    then:
      - service: homeassistant.reload_config_entry
        data: {}
        target:
          entity_id: switch.sonoff_1000b1d77a_1
  - type: turn_off
    device_id: X
    entity_id: switch.sonoff_Y_1
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - if:
      - condition: device
        type: is_on
        device_id: X
        entity_id: switch.sonoff_Y_1
        domain: switch
    then:
      - service: homeassistant.reload_config_entry
        data: {}
        target:
          entity_id: switch.sonoff_1000b1d77a_1
mode: single
StephenMilner commented 1 year ago

I tried out this suggestion:

https://github.com/AlexxIT/SonoffLAN/issues/887#issuecomment-1175877543

Since doing so my automation above has not needed to reloaded the Sonoff integration for the last 30 minutes.

For reference the lines to change are now 108 and 159 for V3.3.1

I do not understand why this would make a difference though.

Edit: I've not needed a reload for over an hour now. Edit: 3 hours now.

StephenMilner commented 1 year ago

Now all my bulbs have stopped responding but my 4CH RC2 Pro is fine!

I've reverted the above mentioned change now and restarted HA - Bulbs working but reload needed regularly again.

rodrigoasrodrigues commented 1 year ago

It did not work for me, I tried changing both lines, and tried one at a time, but the problem persist.

StephenMilner commented 1 year ago

It did not work for me, I tried changing both lines, and tried one at a time, but the problem persist.

It did not work for my cloud entities for me either - LAN was fine. I reverted back to running my Automation every 5 minutes and reloading Sonoff if needed. At the last check about 45 minutes ago everything had been working without a reload for 4 hours.

StephenMilner commented 1 year ago

Been fine now for 8 hours since 04:20 GMT

rodrigoasrodrigues commented 1 year ago

I reverted back to running my Automation every 5 minutes

Did you change it back to app=0 or just turned the automation on? I am still facing the same issue

StephenMilner commented 1 year ago

I reverted back to running my Automation every 5 minutes

Did you change it back to app=0 or just turned the automation on? I am still facing the same issue

Change back to app=0

pavelspitz commented 1 year ago

I had the same problem as described higher. The all zigbee Sonoff devices did not send any states and these states could not be get from. I tried to enable multicast in my router and now everything have seemed to work properly.

StephenMilner commented 1 year ago

I had the same problem as described higher. The all zigbee Sonoff devices did not send any states and these states could not be get from. I tried to enable multicast in my router and now everything have seemed to work properly.

I think the problem is at the Sonoff end - The reliability is very intermittent at the moment - Things work for hours, then it stops working every minute or two for a while, and then OK again. I've made no changes during this different behaviours from a HA point of view.

pavelspitz commented 1 year ago

I think the problem is at the Sonoff end - The reliability is very intermittent at the moment - Things work for hours, then it stops working every minute or two for a while, and then OK again. I've made no changes during this different behaviours from a HA point of view.

Yes, I have to agree with you that the problem is probably in Sonnof end. The router multicast settings did not have long lasting effect. The problems are back.

Jones1982 commented 1 year ago

Similar problem to mine: the zigbee gateway is no longer receiving data from all zigbee devices. i have 3 thermometers, 10 door sensors, and 2 PIRs...and they ALL stop sending status for 4/6/8 hours. The zigbee button doesn't work either. If I reload the Sonoff Lan integration, it works again for a few minutes, but then starts again.

pavelspitz commented 1 year ago

I finally installed official add-on "ewelink smart home" and now there is most of my zigbee devices show relevant status on the ewwlink dashboard. I have 2 zigbee Sonoff thermometer and 4 zigbee Sonoff sockets. Thermometers are OK, but sockets time-to-time have outages, which are repaired via restart of ewelink add-on (for example I tried to turn on one socket and this was in "on" state in ewelink mobile app, but in ewelink dashboard was still "off" until restart the add-on) . I have also 7 zigbee smoke detectors (not produced by Sonoff) which are sucessfully connected to Sonoff Zigbee Bridge and these are not suported via this official ewelink add-on. In my Node-red flows I enforced by time receiving status from the themometers devices added by ewelink add-on --> and they all get relevant temperature values. The smoke detectors control via Sonoff LAN get already irrelevant status --> if I tried test the smoke of one sensor this sensor did not send information about this event (i.e. "smoke" attribute was absent in the message).

But the most interesting thing is that the ewelink app in my mobile does not register any problem with any devices - all zigbee devices are connected and can be controled via app UI without any problem and lags.

I think that the problem is only in applications usage sonoff (ewelink) web-interface.

pavelspitz commented 1 year ago

I probably found the solution of this problem. This is caused by the restriction of ewelink API which doesn't allow loggin one person with the same account to two or more applications and also web services (on the various devices) at the same time (exception has only using application in web browser environment which is payed). Thus I tried to create new account and share him all my home from my main account. This new account I used in Sonoff LAN integration. The previous intalled integration I had to uninstalled and after this I installed the same with my new account and choose home in settings of this add-on. After HA restarted all devices and entities were back under the same enity IDs and thus I even didn't have to change any entities in my flow in Node-Red automatizations.

Now all automatizations have been running without any problem about 24 hour.

jcdnxs commented 1 year ago

No that solution also don´t work pavelspitz. I tried all the solutions explained in this tread but none of them work. I have to reload the integration every time i want to see what is happening in sonoff devices or to reboot the HA!!! What a boring and frustating situation....

JKSniper1 commented 1 year ago

It started working on it's own around 8 hours ago again. Probably fault on Ewelink side.

image

jcdnxs commented 1 year ago

For me nope, the problem persist! I have to reload the integration always i want to use sonoff devices. I whish i have a button in HA to reload always i want or an automatic reload every minute!!!!!

StephenMilner commented 1 year ago

There are periods when it works for hours, and then times when I have to reload all the time.

It worked fine between GMT 16:00 and 00:00 21/11/22 and then has required constant reloading.

StephenMilner commented 1 year ago

For me nope, the problem persist! I have to reload the integration always i want to use sonoff devices. I whish i have a button in HA to reload always i want or an automatic reload every minute!!!!!

It's quite easy to use an automation to reload.

jcdnxs commented 1 year ago

i am waiting for another solution or let ewelink solve the problem. Otherwise I will have to change the firmware of all my devices and never buy sonoffs again! It is a huge risk to have devices that depend on third parties mainly from china. One of these days we find our house controlled by others and totally dependent on third parties.

rodrigoasrodrigues commented 1 year ago

I have tried to remove my account from every other device to make sure it wasn't the session problem. Still, the problem persists, I have another house that is using an older version of the integration (2.4.6) and there seems to be no problem (maybe it's in local mode, don't know how to check in that version), that version, however, does not support my NSPanels. I moved everything Zigbee to ZHA and most of the other things work on local mode, but my L2 led strips only work on cloud mode and my daughter is constantly changing those from the NSPanel, I can't get the status of the leads but I can set the status on cloud mode.

jcdnxs commented 1 year ago

Boa noite Rodrigo, temos que esperar mais uns dias e ver como é que a
situação evolui. 

Cumprimentos

João Xavier

----- Mensagem de Rodrigo Rodrigues @.***> ---------

Data: Tue, 22 Nov 2022 08:08:24 -0800

De: Rodrigo Rodrigues @.***>

Assunto: Re: [AlexxIT/SonoffLAN] Integration stops working after a
few seconds (Cloud Mode) (Issue #1033)

Para: AlexxIT/SonoffLAN @.***>

Cc: jcdnxs @.>, Comment @.>

I have tried to remove my account from every other device to make
sure it wasn't the session problem. Still, the problem persists, I
have another house that is using an older version of the integration
(2.4.6) and there seems to be no problem (maybe it's in local mode,
don't know how to check in that version), that version, however,
does not support my NSPanels.

I moved everything Zigbee to ZHA and most of the other things work
on local mode, but my L2 led strips only work on cloud mode and my
daughter is constantly changing those from the NSPanel, I can't get
the status of the leads but I can set the status on cloud mode.

Reply to this email directly, view it on GitHub[1], or unsubscribe[2].

You are receiving this because you commented.Message ID:
@.***>

----- Fim da mensagem de Rodrigo Rodrigues @.***> -----

Ligações:

[1] https://github.com/AlexxIT/SonoffLAN/issues/1033#issuecomment-1323911121 [2]
https://github.com/notifications/unsubscribe-auth/ACRTL35U7XAOM3NNJERALDTWJTVXRANCNFSM6AAAAAASA7ZEWE

pavelspitz commented 1 year ago

Hello everyone, I am very sorry that my method didn't work for you. For me this method has been still working without any problem. Below I attach the sources where I found the informations about:

  1. Another Sonoff add-on which was mentioned in SonnofLAN documentation https://github.com/peterbuga/HASS-sonoff-ewelink ... please try to find out description of meaning grace_period.
  2. The eWelink staff themself described this problem in this https://help.ewelink.cc/hc/en-us/articles/360060200471-Is-it-possible-to-use-the-same-eWeLink-account-on-multiple-devices-
  3. There is described how to share device with another account https://help.ewelink.cc/hc/en-us/articles/360020151692-How-to-share-a-device-with-another-account-in-eWeLink-app

There is settings of my SonoffLAN add-on which used secondary account - I have ticked "Domov" as my shared home for this account: image

I hope that this information could be helpful for you.

jcdnxs commented 1 year ago

Good Morning pavelspitz. I tried your solution (i use Sonoff LAN integration from HACS) and after a few minutes everything returns to the same.

jcdnxs commented 1 year ago

Any news?

rodrigoasrodrigues commented 1 year ago

I have just updated my other home from 2.4.6 to the current version and everything went from perfectly working to the same problem, so I don't think it is on the sonoff end if older versions work.

jcdnxs commented 1 year ago

Let me understand, you update the SONOFF LAN integration? from 2.4.6 to v3.3.1? I'm starting to think that the problem is not in ewelink end but with the SONOFFLAN integration...

JKSniper1 commented 1 year ago

Hey. I commented 4 days ago that it started working for me. It is indeed still working. I have 3.3.1 and latest update on everything. image

rodrigoasrodrigues commented 1 year ago

Let me understand, you update the SONOFF LAN integration? from 2.4.6 to v3.3.1?

Correct, I have two installations, one that was in the current version and another that I hadn't updated in a while (2.4.6 doesn't even have the GUI config). v3.3.1 is displaying the issue while v2.4.6 was fine. After the update I have the same behaviour on both.

Jones1982 commented 1 year ago

in previous versions of HACS, you could choose whether to update the integration or not, now it does it automatically. however, I've had the same problem for days, and I'm thinking of buying the sonoff usb stick, so I solve every problem with zigbee devices once and for all. I just don't know which version to use...

rodrigoasrodrigues commented 1 year ago

I'm thinking of buying the sonoff usb stick, so I solve every problem with zigbee devices once and for all

@Jones1982 if you have the sonoff Zigbee hub connecting everything you could just flash tasmota to it and use ZHA which is precisely what I am about to do, I did it before and it works very well.

Jones1982 commented 1 year ago

I'm thinking of buying the sonoff usb stick, so I solve every problem with zigbee devices once and for all

@Jones1982 if you have the sonoff Zigbee hub connecting everything you could just flash tasmota to it and use ZHA which is precisely what I am about to do, I did it before and it works very well.

yes, I have the sonoff zigbee hub, but I have stability problems on some door sensors, despite my repeated tickets on the ewelink app, and the latest updates, I have not solved anything. however I can't flash it, because I don't have the other stick to be able to flash.

and since I also have another zigbee hub from tuya, on which t&u sensors with display are connected, I would like to unify everything under a single zigbee hub, that's why I was asking about the sonoff zigbee usb stick https://www.amazon.it/dp/B0B6P22YJC/?coliid=IUFSU8CV86MSR&colid=O9WAAGSJTG8N&psc=1&ref_=lv_ov_lig_dp_it which of the 2 firmwares: "EZNet 6.10.3 o Z-Stack 3.x.0"???

andreasbuff commented 1 year ago

Hello, had the same problem with "non status updateing", since one or two weeks.

Today I reconfigured the Integration in HA and found out, that there is a new Option in the configuration UI (see picture). If you have assigned sonoff-devices, in your EWE app to a specific "house", then you have to check this box! Once checked the box and restarted, the device status is updated again.

Sonoff

adaminaus commented 1 year ago

Hello, had the same problem with "non status updateing", since one or two weeks.

Today I reconfigured the Integration in HA and found out, that there is a new Option in the configuration UI (see picture). If you have assigned sonoff-devices, in your EWE app to a specific "house", then you have to check this box! Once checked the box and restarted, the device status is updated again.

Sonoff

This worked for about all of 90mins then back to no good. It is killing me I have so many devices.

image

StephenMilner commented 1 year ago

I’ve tried the specific home, which hasn’t fundamentally changed the situation.

It can’t be needing a second account as eWeLink wouldn’t work with Alexa if that was the case.

From 3am to 3pm it worked. Then stopped.

StephenMilner commented 1 year ago

Hello, had the same problem with "non status updateing", since one or two weeks. Today I reconfigured the Integration in HA and found out, that there is a new Option in the configuration UI (see picture). If you have assigned sonoff-devices, in your EWE app to a specific "house", then you have to check this box! Once checked the box and restarted, the device status is updated again. Sonoff

This worked for about all of 90mins then back to no good. It is killing me I have so many devices.

image

If you have a spare or unused device you can set up an automation to turn it on, wait 2 minutes to test if HA thinks it’s still on and if not reload the Sonoff integration. Don’t forget to do the reverse, switch it off and check and if still on reload the integration.

I trigger this every 20 minutes

StephenMilner commented 1 year ago

Let me understand, you update the SONOFF LAN integration? from 2.4.6 to v3.3.1? I'm starting to think that the problem is not in ewelink end but with the SONOFFLAN integration...

Mine was already at 3.3.0 when it started showing the problem.

I upgraded to 3.3.1 to see if the problem was resolved.

rufica commented 1 year ago

after update HA core. everything worked

StephenMilner commented 1 year ago

after update HA core. everything worked

What version have you updated to?

adaminaus commented 1 year ago

Ok lets see i have gone from Installed version 2022.11.5 to the Latest version 2022.11.5

Fingers Crossed

adaminaus commented 1 year ago

It has been 10hrs so far so good

adaminaus commented 1 year ago

And over night it stoped again so that did not work! (:

StephenMilner commented 1 year ago

Upgrade to 2022.11.5 didn’t help me.

sandrobastos commented 1 year ago

Hi All, I have the same problem. I installed a whole new system from the scretch, moved some DualR3 to it for tests and I have the same problem. On this new environment I didn't install anything beyond HACS and SonoffLAN. I am using Home Assistant 2022.11.5 and SonoffLan v3.3.1. I quite new on HA world so I am totally lost on how to progess. Any help here would be very apprecianted

jcdnxs commented 1 year ago

already solved the problem "tasmotized all things" SONOFF cloud is a problem, run away from everything chinese....

sandrobastos commented 1 year ago

I will need to learn how to "tasmotized" first, but thanks for the suggestion.

JKSniper1 commented 1 year ago
StephenMilner commented 1 year ago
  • For me, it's still working. It wasn't working and then I was toggling some things about debug options, home check, uncheck, etc. etc. - and it started working and it's working for 10 day+ image
  • BTW -> Do Tasmota run via Cloud aswell? I have sensors on different network than HA, so I can't actually have local system I presume...

Where are you based geographically? Just wondering if you are using the European servers.

JKSniper1 commented 1 year ago

I am. central Europe. It wasn't working for me for a few weeks, than I've went and fiddle around with settings and it's working since. Did not change anything significant.

StephenMilner commented 1 year ago

I am. central Europe. It wasn't working for me for a few weeks, than I've went and fiddle around with settings and it's working since. Did not change anything significant.

Well, I followed your advice and also tinkered a bit. Turned on debug mode and turned off My Home. No better. Downloaded latest HACS update. Switched on My Home and restarted HA.

I won’t be declaring this a success yet, but I’ve not needed a reload for the last 4 hours since the HA restart.

Good spot.