Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stopped working from the last hassio update #154

Closed
daboshman opened this issue Oct 3, 2019 · 50 comments
Closed

stopped working from the last hassio update #154

daboshman opened this issue Oct 3, 2019 · 50 comments

Comments

@daboshman
Copy link

tried a lot of ways to still try and work with it.
tried changing the api_region (the log said i need to move to "as")
tried changing the grace_period to 9999999
tried log-off from ewelink

i can get it to work after an ha reset but a few minutes after that its stopes working and all my entities are unavilable.

there are at least 4 people i know with the same issue (i live in israel and this componnet is popular here)

can you please help?

@peterbuga
Copy link
Owner

hopefully i might take a fresh look on the problem this weekend, no promises though.
meanwhile downgrade could be an option i guess ¯\_(ツ)_/¯, sonoff lan component, tasmota and so on...

@daboshman
Copy link
Author

hopefully i might take a fresh look on the problem this weekend, no promises though.
meanwhile downgrade could be an option i guess ¯\_(ツ)_/¯, sonoff lan component, tasmota and so on...

that would be great.
no way i am moving to sonoff lan component, yours is the best.

@Swiftnesses
Copy link

+1, would love to see this working again!

@primalnow
Copy link

+1 from me.

This is the error getting logged by HASS

2019-10-04 22:17:36 ERROR (Thread-13) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1050f0b50>>: string indices must be integers
2019-10-04 22:17:36 ERROR (Thread-2) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1050f0b50>>: string indices must be integers
2019-10-04 22:17:36 ERROR (Thread-16) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1050f0b50>>: string indices must be integers
2019-10-04 22:17:36 ERROR (Thread-19) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1050f0b50>>: string indices must be integers
2019-10-04 22:17:36 ERROR (Thread-13) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1050f0b50>>: string indices must be integers
2019-10-04 22:17:36 ERROR (Thread-2) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1050f0b50>>: string indices must be integers
2019-10-04 22:17:36 ERROR (Thread-16) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1050f0b50>>: string indices must be integers
2019-10-04 22:17:36 ERROR (Thread-19) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1050f0b50>>: string indices must be integers

@peterbuga
Copy link
Owner

@primalnow i have no idea what's throwing these errors to you, maybe you have a particular different version of websocket-client that's messing things up

for all the others, i push a little fix, it'll be cool if someone could give it a try :)
i'm doing my using & testing in a venv type of HA install (or otherwise known hassbian). both v0.99.3 and v0.100.0b0 are working ok on my side (i'm going to do further - longer - tests in the next days), if you're hassio/docker and still have problems i'm sorry but i'm not planning to do any debuging on either of them

@primalnow
Copy link

@peterbuga Thank you very much for the amazing work you're doing. You're a life-saver for Sonoff.

I have tried the new files. Seems to be working right now. Will test for the rest of the day, and post again, just to confirm.

Thanks again.

@primalnow
Copy link

Problem persists. Everything becomes unavailable after a while.

Restarted HASS - All items disappeared. Nothing came from sonoff.

However. Every time a switch is operated, the following is showing up in the log. (I have altered the API key. ). Which means sonoff is sending updates. It's just the initial registry of the devices, that gets messed up. I'm just guessing here. You know best.

2019-10-05 13:04:35 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"100074f74c","apikey":"a4f8-4446591a08fb","ts":0,"params":{"online":true}}
2019-10-05 13:04:35 DEBUG (Thread-5) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"100074f74c","apikey":"4d-a4f8-4446591a08fb","ts":0,"params":{"online":true}}
2019-10-05 13:04:37 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"100074f74c","apikey":"712-f9b557c6aa75","userAgent":"device","d_seq":64,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-05 13:04:37 DEBUG (Thread-5) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"100074f74c","apikey":"12-f9b557c6aa75","userAgent":"device","d_seq":64,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-05 13:04:37 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event timer_out_of_sync[L]: seconds=2.497829672000023>
2019-10-05 13:04:37 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"100074f74c","apikey":"6ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-63,"staMac":"84:0D:8E:5A:68:1E","startup":"off","init":1,"pulse":"off","pulseWidth":500},"from":"device"}
2019-10-05 13:04:37 DEBUG (Thread-5) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"100074f74c","apikey":"f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-63,"staMac":"84:0D:8E:5A:68:1E","startup":"off","init":1,"pulse":"off","pulseWidth":500},"from":"device"}

2019-10-05 13:09:13 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"1000683294","apikey":"-8c85-4e87-9f90-aa9e5fcc4b2d","ts":0,"params":{"online":true}}
2019-10-05 13:09:13 DEBUG (Thread-8) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"1000683294","apikey":"-8c85-4e87-9f90-aa9e5fcc4b2d","ts":0,"params":{"online":true}}
2019-10-05 13:09:13 DEBUG (Thread-14) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"1000683294","apikey":"-8c85-4e87-9f90-aa9e5fcc4b2d","ts":0,"params":{"online":true}}
2019-10-05 13:09:13 DEBUG (Thread-11) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"1000683294","apikey":"-8c85-4e87-9f90-aa9e5fcc4b2d","ts":0,"params":{"online":true}}
2019-10-05 13:09:13 DEBUG (Thread-5) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"1000683294","apikey":"-8c85-4e87-9f90-aa9e5fcc4b2d","ts":0,"params":{"online":true}}
2019-10-05 13:09:14 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","d_seq":62,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-05 13:09:14 DEBUG (Thread-8) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","d_seq":62,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-05 13:09:14 DEBUG (Thread-14) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","d_seq":62,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-05 13:09:14 DEBUG (Thread-11) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","d_seq":62,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-05 13:09:14 DEBUG (Thread-5) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","d_seq":62,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-05 13:09:15 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-73,"staMac":"DC:4F:22:93:03:00","startup":"off","init":1,"pulse":"off","pulseWidth":500},"from":"device"}
2019-10-05 13:09:15 DEBUG (Thread-8) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-73,"staMac":"DC:4F:22:93:03:00","startup":"off","init":1,"pulse":"off","pulseWidth":500},"from":"device"}
2019-10-05 13:09:15 DEBUG (Thread-14) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-73,"staMac":"DC:4F:22:93:03:00","startup":"off","init":1,"pulse":"off","pulseWidth":500},"from":"device"}
2019-10-05 13:09:15 DEBUG (Thread-11) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-73,"staMac":"DC:4F:22:93:03:00","startup":"off","init":1,"pulse":"off","pulseWidth":500},"from":"device"}
2019-10-05 13:09:15 DEBUG (Thread-5) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000683294","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-73,"staMac":"DC:4F:22:93:03:00","startup":"off","init":1,"pulse":"off","pulseWidth":500},"from":"device"}

@primalnow
Copy link

primalnow commented Oct 5, 2019

I turned a switch on/off.

The following error showed up in the logs. And all devices, immediately, became unavailable.

The updates are still coming in the log (pasted at the bottom), but the interface has marked everything as unavailable.

2019-10-05 13:17:26 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"10007797c8","apikey":"712-f9b557c6aa75","userAgent":"app","sequence":"1570263445519","ts":0,"params":{"switch":"on"},"tempRec":"10007797c8"}
2019-10-05 13:17:26 ERROR (Thread-2) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x1134c8410>>: string indices must be integers
File "/Users/faisal/.homeassistant/deps/lib/python/site-packages/websocket/_app.py", line 343, in _callback
callback(*args)
File "/Users/faisal/.homeassistant/custom_components/sonoff/init.py", line 305, in on_message
if device['deviceid'] == data['deviceid']:
File "/Users/faisal/.homeassistant/deps/lib/python/site-packages/websocket/_app.py", line 343, in _callback
callback(*args)
File "/Users/faisal/.homeassistant/custom_components/sonoff/init.py", line 305, in on_message
if device['deviceid'] == data['deviceid']:


2019-10-05 13:19:17 INFO (MainThread) [custom_components.sonoff] Grace period active
2019-10-05 13:19:29 INFO (MainThread) [custom_components.sonoff] Re-login component
2019-10-05 13:19:35 DEBUG (Thread-11) [custom_components.sonoff] (re)init websocket
2019-10-05 13:19:38 DEBUG (Thread-11) [custom_components.sonoff] websocket msg: {"error":0,"apikey":"69abcc4e-9b5d-4a55-8034-94f9f65301d3","config":{"hb":1,"hbInterval":145},"sequence":"15702635775509388"}
2019-10-05 13:20:01 DEBUG (Thread-5) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000760502","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off"},"from":"device","seq":"51"}
2019-10-05 13:20:01 DEBUG (Thread-11) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000760502","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off"},"from":"device","seq":"51"}
2019-10-05 13:20:01 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000760502","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off"},"from":"device","seq":"51"}
2019-10-05 13:20:01 DEBUG (Thread-8) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000760502","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off"},"from":"device","seq":"51"}
2019-10-05 13:20:43 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-10-05 13:20:54 INFO (MainThread) [custom_components.sonoff] Grace period active
2019-10-05 13:21:05 INFO (MainThread) [custom_components.sonoff] Grace period active
2019-10-05 13:21:16 INFO (MainThread) [custom_components.sonoff] Grace period active
2019-10-05 13:21:26 INFO (MainThread) [custom_components.sonoff] Grace period active
2019-10-05 13:21:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.02007254dc4f2 is taking over 10 seconds
2019-10-05 13:21:37 INFO (MainThread) [custom_components.sonoff] Grace period active

@peterbuga
Copy link
Owner

@primalnow thanks for the debugs 👍
but unfortunately i don't have good news to follow up on that. i don't understand what is happening on your side and/or what types of responses you might have to trigger those errors, they simply do not show on my side ¯\_(ツ)_/¯.
unless someone who has this problem (and knows a bit of python to help me out debug) is willing to help there's not much i'll keep this bug unfixable, you should start considering alternatives.

i'm also led to believe that this happens only on hassio installs, someone else reported it yesterday working just fine on a venv type of HA v0.99.3

ps: truth be told i really think this might require a basic fix but without being able to replicate it i'm dead in the water

@primalnow
Copy link

Another interesting thing happened. Came back after lunch, and all devices were showing again. But then they have become unavailable again.

The error in the logs is:

2019-10-05 13:53:57 DEBUG (Thread-26) [custom_components.sonoff] websocket closed
2019-10-05 13:53:57 DEBUG (Thread-26) [custom_components.sonoff] (re)init websocket
2019-10-05 13:54:00 ERROR (Thread-571) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-10-05 13:54:00 DEBUG (Thread-571) [custom_components.sonoff] websocket closed
2019-10-05 13:54:00 DEBUG (Thread-571) [custom_components.sonoff] (re)init websocket
2019-10-05 13:54:01 ERROR (Thread-17) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-10-05 13:54:01 DEBUG (Thread-17) [custom_components.sonoff] websocket closed
2019-10-05 13:54:01 DEBUG (Thread-17) [custom_components.sonoff] (re)init websocket

@primalnow
Copy link

primalnow commented Oct 5, 2019

I'm running homeassistant on a mac.
My Ewelink is a share, so not the primary account.
I have tried downgrading HASS, but that didn't help either.
It may be some other updated module.

websocket │ 0.2.1 │ 0.2.1 │ https://pypi.python.org/pypi/websocket

Python version: /usr/local/lib/python3.7/site-packages/homeassistant/components

The devices keep coming and going.

As for alternate solutions - I have already decided to switch over to Tuya devices. But my installation is too big, to just switch over. I have almost 75 devices in place.

I can program, but I have almost zero python experience. I could start learning, but I doubt if I'd be any use to you.

@primalnow
Copy link

The problem is definitely here. This is what screws things up. This was triggered when I turned a switched on. First few operations worked fine, and then BOOM.:

2019-10-05 14:11:46 DEBUG (Thread-5) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"100060ceeb","apikey":"-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-84,"staMac":"84:0D:8E:50:AE:C0","startup":"off","init":1,"pulse":"on","pulseWidth":1800000},"from":"device"}
File "/Users/faisal/.homeassistant/deps/lib/python/site-packages/websocket/_app.py", line 343, in _callback
callback(*args)
File "/Users/faisal/.homeassistant/custom_components/sonoff/init.py", line 308, in on_message
2019-10-05 14:11:46 ERROR (Thread-5) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x10be18b90>>: string indices must be integers
File "/Users/faisal/.homeassistant/deps/lib/python/site-packages/websocket/_app.py", line 343, in _callback
callback(*args)
File "/Users/faisal/.homeassistant/custom_components/sonoff/init.py", line 308, in on_message

@Swiftnesses
Copy link

Things are working again for me - HASS on Ubuntu Server. Thanks!

@primalnow
Copy link

I've downgraded hass to 0.97.1, and it's the same problem. Which means, it's neither hass, nor your component. Something else has changed.

I would suspect Sonoff has changed something on their end.

Can you give me a hint on how to debug this?

Is there anything I can do to show you what's going on?

@peterbuga
Copy link
Owner

@primalnow just for the kinks i installed & ran Hassio VM version, copy-paste files and config and boom just works!!!
so it's clearly something on your side, most likely some other component installed a particular package version and messed things up.
the only thing i could recommend is to start from scratch (fresh OS, fresh HA install), activate sonoff component first and then re-add/re-activate all the other components one by one. i know it's a lot of work but i myself waste a lot of time trying to fix a (as of time of speaking) non-reproducible bug.

until new information comes up to point me into some direction i'm dropping the possible fix on this problem ...

@primalnow
Copy link

Oh I don't mind the time. :-)
This is what I do for entertainment.

Just that I can't reinstall my MacOS :)

However I do have a spare Mac lying around. Will set things up on it.

Watch this space for an update :)

@primalnow
Copy link

Or maybe I should stop being a stubborn git, and order a Raspberry Pi :)

@shemtov-m
Copy link

shemtov-m commented Oct 5, 2019 via email

@peterbuga
Copy link
Owner

@primalnow you mean you have HA installed straight into MacOS 😱? no containment or anything else? if so, that’s a huuuuuuge big mistake! do yourself a favour and install HA in a virtual machine or run Hassio VM, it took me < 10 min to set it up

Sent with GitHawk

@shemtov-m
Copy link

shemtov-m commented Oct 5, 2019 via email

@shemtov-m
Copy link

shemtov-m commented Oct 5, 2019 via email

@primalnow
Copy link

@peterbuga yes. I've been living dangerously :) I guess it's time to fix that, and do a VM. Or just get a Pi4.

I had an old installation running on another mac. Ver .92.2

I am getting the following error. BUT IT IS WORKING. The error is there, but sonoff devices seem to be stable so far.

46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switches":[{"outlet":0,"switch":"off"},{"outlet":1,"switch":"on"},{"outlet":2,"switch":"off"},{"outlet":3,"switch":"off"}]},"from":"device","seq":"956"}
File "/Users/faisalqureshi/.homeassistant/deps/lib/python/site-packages/websocket/_app.py", line 343, in _callback
callback(*args)
File "/Users/faisalqureshi/.homeassistant/custom_components/sonoff/init.py", line 309, in on_message
self.set_entity_state(data['deviceid'], switch['switch'], switch['outlet'])
File "/Users/faisalqureshi/.homeassistant/custom_components/sonoff/init.py", line 337, in set_entity_state
attr = self._hass.states.get(entity_id).attributes

@peterbuga
Copy link
Owner

46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switches":[{"outlet":0,"switch":"off"},{"outlet":1,"switch":"on"},{"outlet":2,"switch":"off"},{"outlet":3,"switch":"off"}]},"from":"device","seq":"956"}
File "/Users/faisalqureshi/.homeassistant/deps/lib/python/site-packages/websocket/_app.py", line 343, in _callback
callback(*args)
File "/Users/faisalqureshi/.homeassistant/custom_components/sonoff/init.py", line 309, in on_message
self.set_entity_state(data['deviceid'], switch['switch'], switch['outlet'])
File "/Users/faisalqureshi/.homeassistant/custom_components/sonoff/init.py", line 337, in set_entity_state
attr = self._hass.states.get(entity_id).attributes

@primalnow are you 100% sure you have the latest master code? 1st i don't think you pasted the whole error message and most of all the line number error messages DO NOT MATCH THE CURRENT CODE 😑

@primalnow
Copy link

@peterbuga What do you mean by "master code"?

@primalnow
Copy link

@peterbuga Installed hassio.vmk. Sonoff not working. I have no errors, but no devices either. Since I can't figure out where the logs, etc. are, I can't see what's going on.

Will set up a Virtual Ubuntu box, and then try to runn hassio from there. Tomorrow. :-)

Thanks for "wasting" your time with me.

-Faisal Qureshi
http://www.faisalqureshi.com

@peterbuga
Copy link
Owner

Screen Shot 2019-10-05 at 20 14 43

@daboshman
Copy link
Author

i am using a pai.
and its still not stable for me.
sometimes its working and sometimes its stops worrking and all the sonoff devices becomes unavilable.
what can i do in order to help with a fix?

@primalnow
Copy link

@peterbuga Double checked. Definitely using the master branch.

Interestingly, in the logs - Sonoff is sending continuous updates on devices (see log below), but there are no sonoff devices in the interface. Since I restarted HASS, they never got registered, so they're not "unavailable". They just did not register.

--

2019-10-06 14:23:32 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"1000760502","apikey":"9436de0a-16a9-43ab-8ed4-46328b026347","ts":0,"params":{"online":true}}
2019-10-06 14:23:33 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000760502","apikey":"5cea6ac2-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","d_seq":2,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-06 14:23:33 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"1000760502","apikey":"5cea6ac2-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-76,"staMac":"DC:4F:22:F7:BB:AC","startup":"off","init":1,"pulse":"on","pulseWidth":1200000},"from":"device"}
2019-10-06 14:23:33 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"10007792c9","apikey":"f43b4204-598a-48cb-a3d0-103c54a21a5f","ts":0,"params":{"online":true}}
2019-10-06 14:23:34 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"10007792c9","apikey":"5cea6ac2-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","d_seq":2,"ts":0,"params":{"sledOnline":"on"},"from":"device"}
2019-10-06 14:23:34 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"update","deviceid":"10007792c9","apikey":"5cea6ac2-dce8-46ad-b712-f9b557c6aa75","userAgent":"device","ts":0,"params":{"switch":"off","fwVersion":"3.3.0","rssi":-73,"staMac":"C4:4F:33:88:AE:E4","startup":"on","init":1,"pulse":"off","pulseWidth":500},"from":"device"}
2019-10-06 14:23:34 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"1000524ba9","apikey":"5cea6ac2-dce8-46ad-b712-f9b557c6aa75","ts":0,"params":{"online":false}}
2019-10-06 14:23:35 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"10002c6886","apikey":"15bf38e6-c928-4bb1-b118-9b30da81106b","ts":0,"params":{"online":true}}
2019-10-06 14:23:35 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"action":"sysmsg","deviceid":"1000686ae8","apikey":"6bf023ca-fefc-41a7-ac6a-41f5c006bc1b","ts":0,"params":{"online":true}}

@peterbuga
Copy link
Owner

yes i know, it's related to this 8b2955f#r35375118

@peterbuga
Copy link
Owner

@primalnow ( and @ everyone-else) can you please give a try to fresh-out-of-the-oven latest push i've done on master branch? i found a slight change in itead api, might fix the above problems ¯\_(ツ)_/¯

@primalnow
Copy link

@peterbuga And we have touchdown. The Eagle has landed. You're a star. Thank you so much for struggling with us.

One little thing in the logs though :-)
I haven't touch an iphone since 2017. So I assume, this is coming from your code . I have changed the IMEI code.

2019-10-06 16:57:55 DEBUG (MainThread) [custom_components.sonoff] Create the main object
2019-10-06 16:57:55 DEBUG (MainThread) [custom_components.sonoff] {"model": "iPhone11,6", "romVersion": "11.2.2", "appVersion": "3.6.0", "imei": "xxxxxxxxx9e-49b528f1d642"}
2019-10-06 16:57:57 WARNING (MainThread) [custom_components.sonoff] found new region: >>> as <<< (you should change api_region option to this value in configuration.yaml)
2019-10-06 16:57:57 DEBUG (MainThread) [custom_components.sonoff] {"model": "iPhone10,1", "romVersion": "10.3.4", "appVersion": "3.5.4", "imei": "ddddddda-88fe8f40f91b"}
2019-10-06 16:58:02 INFO (MainThread) [custom_components.sonoff] Found websocket address: as-pconnect1.coolkit.cc
2019-10-06 16:58:02 DEBUG (Thread-2) [custom_components.sonoff] (re)init websocket

@peterbuga
Copy link
Owner

finally some good news 🙌!

the imei/iphone/etc are all fake and randomized every time the HA component boots in a struggle to make this component's login possible harder to track soo no need to worry about that (also i never had an android - and hopefully never will - to add the request information of that os... and i'm too lazy to put out a virtual machine just for that)

let's wait & hope more people report the same positive output as you did 🤞

@primalnow
Copy link

Running stable. No errors. No warnings. Thank you for your hard work. Any way of buying you coffee? :)

-Faisal Qureshi
http://www.faisalqureshi.com

@daboshman
Copy link
Author

+1 on the coffee.
Where do i donate?

@shemtov-m
Copy link

shemtov-m commented Oct 6, 2019 via email

@peterbuga
Copy link
Owner

@primalnow @daboshman there's a paypal button at the bottom of the project's page if you feel generous to express gratitude in any way 😊! all donations go towards buying new sonoff devices so that i can integrate/debug them easier without constant pinging people over the world if it works or not 😒

@daboshman
Copy link
Author

@primalnow @daboshman there's a paypal button at the bottom of the project's page if you feel generous to express gratitude in any way 😊! all donations go towards buying new sonoff devices so that i can integrate/debug them easier without constant pinging people over the world if it works or not 😒

done!
thanks again for the fix

@david78455
Copy link

Thanks peterbuga
Where can I find the final fix ?
Thanks
David

@primalnow
Copy link

@peterbuga sent some love via paypal. Thanks once again for your amazing work. It wasn't for this script, I'd have thrown away my Sonoff investment :). Godspeed.

@Ajaxhanna
Copy link

Another interesting thing happened. Came back after lunch, and all devices were showing again. But then they have become unavailable again.

The error in the logs is:

2019-10-05 13:53:57 DEBUG (Thread-26) [custom_components.sonoff] websocket closed
2019-10-05 13:53:57 DEBUG (Thread-26) [custom_components.sonoff] (re)init websocket
2019-10-05 13:54:00 ERROR (Thread-571) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-10-05 13:54:00 DEBUG (Thread-571) [custom_components.sonoff] websocket closed
2019-10-05 13:54:00 DEBUG (Thread-571) [custom_components.sonoff] (re)init websocket
2019-10-05 13:54:01 ERROR (Thread-17) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-10-05 13:54:01 DEBUG (Thread-17) [custom_components.sonoff] websocket closed
2019-10-05 13:54:01 DEBUG (Thread-17) [custom_components.sonoff] (re)init websocket

follow this link

https://community.home-assistant.io/t/sonoff-ewelink-component-for-original-firmware/81369/682?u=ajaxhan_anna

@peterbuga
Copy link
Owner

@daboshman @primalnow love has been received ❤️ thank you! with your permission i'd like to add you to the credits section of this project 😊 (i know it's not much but it's the best i can do so far)

from the fact there are no more complains i assume the latest fix it's stable-ish, i'm going to wait a bit more (and might sound a bit odd) but i'm really eager to close this issue and focus on implementing new stuff rather than fixing bugs

@primalnow
Copy link

@peterbuga I'd be honored. I wish I could help you with the maintenance. I'm afraid, my python skills are quite slim.

The latest fix is actually more stable than it was, before the problem started.

Curiosity demands that I ask. What new stuff do you have planned?

-Faisal Qureshi
http://www.faisalqureshi.com

@peterbuga
Copy link
Owner

peterbuga commented Oct 7, 2019

What new stuff do you have planned?

  • as always the plan was add as many devices as possible to get the bigger picture on how the devices are controller (for example sonoff B1 is controlled different than a L1 even though they do kinda the same thing), followed by a refactoring to prettify stuff
  • asses the non-stopping bugs, like switching multiple entities at once (usually used in automations or in grouped entities toggles), POW R2 not properly reporting values in the latest updates
  • maybe tryyyyying to add the component to main HA, but i don't think it'll ever get accepted

but next thing to add (now that donations pilled up a bit, thanks again 👐 ) Sonoff RF Bridge - it's a common request and quite tricky do debug in remote mode

@primalnow
Copy link

@peterbuga

1 - New devices -> Yaayyyy

2 - RF Bridge -> waste of time. The 4 device limit, makes it almost useless.

3 - Bulbs -> If you could get them to turn on/off, that would be enough too.

4 - Switching multiple entities -> This is SUPER CRUCIAL. Without this, HASS groups, and scenes, are practically useless. This is the biggest limitation of your API. I need to keep figuring out work-arounds, which are not so nice. So my vote is to attack this problem ASAP. I promise you even more coffee, if you can get this going :)

And thanks for the latest update. Installed it.

-Faisal Qureshi

@skelgaard
Copy link

I have to agree on point 4.... this is really anoying have to add 3-4-5 shedules to get things to turn on/off instead of just 1 which should be enough.

@peterbuga
Copy link
Owner

Sonoff B1 are fully supported (in branch sonoff-bulb which as a part of this issue is sort of not-working right now) + a little extra features not present in the main app (i just need a lazy afternoon to merge it master branch too 🙄 )

Switching multiple entities in the same is kinda harder than it sounds (because the API doesn't support this) and truth be told I wasn't sure this was a big problem => never a top priority for me.

1 thing at a time...

@skelgaard
Copy link

i have 5 sonoffs connected to one button and one shedule... but this newer works... i'm lucky if 2 are turned on/off by it.... so each time i have to do 5 clicks or 5 shedules to make stuff turn on/off all of them

@primalnow
Copy link

@peterbuga

1- Bulb - Yep would be great if you can merge

2- Multiple switches in a burst - Oh this is a major problem. Like I said, it renders groups, scenes, and even automations, useless. The only work around is to put a 5s delay between every switch. Groups/Scenes not doable.

I would do a 100+ for this feature.

How about you queue, and insert a 4s delay between bulk on/off calls? I have no idea how the API works, so it may be a useless suggestion. I am just suggesting to replicate what I am doing in my scripts.

@peterbuga
Copy link
Owner

Multiple switches in a burst

we'll continue this discussion here #92 it holds more details regarding this problem

for now, i'm gonna close this issue... finally 🤝

@primalnow
Copy link

@peterbuga Please do. Well done. Moving to #92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants