- take 2minutes and carefully read the project’s README (aka the main page)
- it’s a pending issue work-in-progress. i’m quite confident that i might be able to integrate it buuut there’s always the possibility that might not work as intended
Seems like great progress has been made! Kudos to our amazing man @peterbuga
I haven’t updated my files since before holidays (Dec 2018). Added Sonoff POW R2 to my collection.
Planning to upgrade files, will be using Websockets branch, as it works insanely fast!
Currently my devices are named switch.deviceid_outlet (have entity_name: False in my config), I would prefer to keep it this way. Do the new files change this? What should I do to get this working?
Thanks a lot for the amazing work!
Love the component.
Thanks you!!
It works well on my sonoff basic
The current websocket
branch works with this naming model (but it has been reported to be broken … oops) all others have the legacy switch.sonoff_deviceid_outlet
even so, i think a quick global find and replace could bring everything in place.
i’ve been a bit busy lately so the updates are showing up a bit slower (not to mention that my SD card that was holding the HA installation decided to bravely give up and kinda killed my mood to push new stuff for now )
So that means new files have the switch.deviceid_outlet naming model right?
You’re not using the switch.devicename or something in the latest version right?
Thanks.
Hi, I’m having problem with HASSIO running on docker Raspberry Pi.
I got this error:
2019-01-22 13:58:15 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-01-22 13:59:18 ERROR (SyncWorker_3) [homeassistant.util.package] Unable to install package uuid: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75a3fe50>: Failed to establish a new connection: [Errno -3] Try again’,)’: /packages/ce/63/f42f5aa951ebf2c8dac81f77a8edcc1c218640a2a35a03b9ff2d4aa64c3d/uuid-1.30.tar.gz
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75a0f550>: Failed to establish a new connection: [Errno -3] Try again’,)’: /packages/ce/63/f42f5aa951ebf2c8dac81f77a8edcc1c218640a2a35a03b9ff2d4aa64c3d/uuid-1.30.tar.gz
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75a0f730>: Failed to establish a new connection: [Errno -3] Try again’,)’: /packages/ce/63/f42f5aa951ebf2c8dac81f77a8edcc1c218640a2a35a03b9ff2d4aa64c3d/uuid-1.30.tar.gz
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75a0fe10>: Failed to establish a new connection: [Errno -3] Try again’,)’: /packages/ce/63/f42f5aa951ebf2c8dac81f77a8edcc1c218640a2a35a03b9ff2d4aa64c3d/uuid-1.30.tar.gz
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75a0ff90>: Failed to establish a new connection: [Errno -3] Try again’,)’: /packages/ce/63/f42f5aa951ebf2c8dac81f77a8edcc1c218640a2a35a03b9ff2d4aa64c3d/uuid-1.30.tar.gz
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Max retries exceeded with url: /packages/ce/63/f42f5aa951ebf2c8dac81f77a8edcc1c218640a2a35a03b9ff2d4aa64c3d/uuid-1.30.tar.gz (Caused by NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75a0f750>: Failed to establish a new connection: [Errno -3] Try again’,))
2019-01-22 13:59:18 ERROR (MainThread) [homeassistant.requirements] Not initializing sonoff because could not install requirement uuid
2019-01-22 13:59:18 ERROR (MainThread) [homeassistant.setup] Setup failed for sonoff: Could not install all requirements.
Can anyone help?
@e-budianto for some reason, this is not quite a sonoff-component problem but more like your HA install / network problem. while enabling this component it tries to install automatically the needed dependencies but you are encountering a problem on this level.
try this (or google how to install pip packages under HASSIO install):
pip3 install uuid
pip3 install websocket-client
@forums2012
i just updated (hopefully fixed) the websocket
branch and i can confirm the switches are under switch.deviceid_outlet
format + all the other updates added recently (switch-outlets names when available, sensor data)
backup current files and give a try with the current one and let me know how (and if) it works
thanks for prompt reply @peterbuga , tried to install in docker via
sudo docker exec -it homeassistant /bin/bash
then
pip3 install uuid --proxy https://myserver.com:8080
now it installs successfully, but when restart hassio, or reboot pi, it still cannot load custom component with exactly same error.
2019-01-22 16:52:14 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-01-22 16:53:12 ERROR (SyncWorker_17) [homeassistant.util.package] Unable to install package uuid: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7590a7b0>: Failed to establish a new connection: [Errno -3] Try again’,)‘: /simple/uuid/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7590a9f0>: Failed to establish a new connection: [Errno -3] Try again’,)‘: /simple/uuid/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7590a470>: Failed to establish a new connection: [Errno -3] Try again’,)‘: /simple/uuid/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7590a8d0>: Failed to establish a new connection: [Errno -3] Try again’,)‘: /simple/uuid/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7590a450>: Failed to establish a new connection: [Errno -3] Try again’,)': /simple/uuid/
Could not find a version that satisfies the requirement uuid (from versions: )
No matching distribution found for uuid
2019-01-22 16:53:12 ERROR (MainThread) [homeassistant.requirements] Not initializing sonoff because could not install requirement uuid
2019-01-22 16:53:12 ERROR (MainThread) [homeassistant.setup] Setup failed for sonoff: Could not install all requirements
tried again run this command:
bash-4.4# pip3 install uuid --no-cache-dir --proxy https://myproxy:8080
Requirement already satisfied: uuid in /usr/local/lib/python3.6/site-packages (1.30)
bash-4.4#
still error during loading custom components.
@e-budianto unfortunately I stand by my original post that it’s a problem on your HA install! judging from the output above you use a proxy to access internet, the above commands were executed properly but clearly where pip3 installs the package is not accessible by HA. i think a better way would be to find a way properly give internet access to docker and let HA do its thing and install the package where it needs to (or try to find where the HA install resides and manually copy uuid package there, i wouldn’t recommend this but mostly as a last resort)
i never used HASSIO so i’m a bit blind in this matter, maybe someone else with hassio experience can shed some light in this matter!
Many thanks @peterbuga
I have installed this (Websocket branch) and am testing now. I am getting no errors on startup which is great!
I am able to control switches just as before
On the sensors, I am getting mixed results.
I have 3 POW switches installed. When I started up, they were all set to state=0.
I turned one on. It has a thermostat controlled heater connected to it. The state went to unknown. Then about 60 seconds later, it started showing the correct load in W, which is great. I turned it off. It went to unknown for a couple of minutes, then went back to 0.
I tried on a second switch. That one went to unknown and just stayed like that for at least 5 minutes, I turned off the switch and after a couple more minutes it returned to 0. FWIW this switch is not on the same LAN as my HA instance. I don’t know if that matters. I can see the readings on the Ewelink app whichever network I am on.
Thanks again for your work on this. If you would like me to do any other testing, or if you have any advice, please just let me know. I’ll stick with this rev as it’s at least as functional as the previous one.
@Michaelrch thanks from prompt reply too, appreciate it!
I have to admit the sensors part (like most of work on this component lately ) has been purely theoretical from the dumps (thanks everyone for providing this data).
That being said the sensors data is refreshed every 60seconds (default) or whatever refresh-value you had it setup, I just assumed that despite the switches, getting second-like updates on sensors might not be such a high priority. I’m actually unaware if any sensor data is sent over the websocket connection (if this would be the case that would be extremely useful!) or it’s just available over the device details.
I sort of got stuck while trying to integrate some new devices and I’m going to integrate a deeper debug-logging option inside the component that will capture device data + websocket data and this way I will have more information of what exactly happens over a period of time.
If you (or anyone else) are willing to get the hands dirty and generate some log files I will, again, highly appreciate it!
No problem. Count me in for testing
Least I can do.
I am not very technical and python is way over my head but happy to change files, switch things on/off, update yaml and send logs etc!
Just an update. The power sensor is looking more predictable now
The state goes to unknown for <60s then to a number which looks right. Then after switching off the switch it goes back to 0 within another 60s.
So looks like it’s behaving as expected
@peterbuga the fact is i’m running without proxy since my internet uses home cable so no proxy and my HA is running within hassio which is in docker running in Pi3 B+ and it’s exposed to internet so i can manage my HA from mobile phone, I’m still confused why I have to use proxy option anyway .
You’re correct maybe this post a bit off topic, I’ll post somewhere else regarding how to install python addon properly within docker/hassio.
anyway, kudos for such a breakthrough , I hope this component will keep improving and included in HA next releases.
First of all, I have to say thank you @peterbuga ! I have 4 Sonoff S26 plugs at home and I had been managing them using IFTTT Webhooks so far. Worked OK, but this solution is far better, purely because the plugs states are synced in this case. Thank you, thank you, thank you.
My set up is Home Assistant is installed in a virtual environment in Debian 9.6.0, which is installed in QNAP as a VM. Home Assistant is accessed using HTTPS (with Let’s Encrypt). I first used the master branch, it didn’t work. I kept getting the async error some others mentioned above. Switching to websocket branch version fixed it and it works flawlessly. This is amazing!
When you have time, it would be great if you could integrate this into custom updater so it can update itself automatically when you have a new version, maybe with a support for different branches.
Can I donate you anything?
@peterbuga While my devices work perfectly, I am pasting the debug.json output below, in case it helps you with anything. I am not an expert developer like you so I don’t know if the below is helpful in any way but here it is just in case:
[
{
"__v": 0,
"_id": "[hidden]",
"apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"brandName": "Sonoff",
"createdAt": "xxxx-xx-xxxxx:xx:xx.xxx",
"deviceStatus": "",
"deviceUrl": "",
"deviceid": "[hidden]",
"devicekey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"extra": {
"_id": "[hidden]",
"extra": {
"apmac": "xx:xx:xx:xx:xx:xx",
"brandId": "58e5f344baeb368720e25469",
"description": "WO18237",
"mac": "xx:xx:xx:xx:xx:xx",
"manufacturer": "\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8",
"model": "PSA-B01-GL",
"modelInfo": "5aca25ef85a15a8f032672f7",
"ui": "\u5355\u901a\u9053\u63d2\u5ea7",
"uiid": 1
}
},
"group": "",
"groups": [
"5b33da93c7d29425c69488ba"
],
"ip": "[hidden]",
"location": "",
"name": "[hidden]",,
"offlineTime": "xxxx-xx-xxxxx:xx:xx.xxx",
"online": true,
"onlineTime": "xxxx-xx-xxxxx:xx:xx.xxx",
"params": {
"controlType": "7",
"fwVersion": "2.6.0",
"rssi": -74,
"staMac": "xx:xx:xx:xx:xx:xx",
"startup": "off",
"switch": "off"
},
"productModel": "S26",
"settings": {
"alarmNotify": 1,
"opsHistory": 1,
"opsNotify": 1
},
"sharedTo": [],
"showBrand": true,
"type": "10",
"uiid": 1
},
{
"__v": 0,
"_id": "[hidden]",
"apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"brandName": "Sonoff",
"createdAt": "xxxx-xx-xxxxx:xx:xx.xxx",
"deviceStatus": "",
"deviceUrl": "",
"deviceid": "[hidden]",
"devicekey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"extra": {
"_id": "[hidden]",
"extra": {
"apmac": "xx:xx:xx:xx:xx:xx",
"brandId": "58e5f344baeb368720e25469",
"description": "WO18237",
"mac": "xx:xx:xx:xx:xx:xx",
"manufacturer": "\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8",
"model": "PSA-B01-GL",
"modelInfo": "5aca25ef85a15a8f032672f7",
"ui": "\u5355\u901a\u9053\u63d2\u5ea7",
"uiid": 1
}
},
"group": "",
"groups": [
"5b33da93c7d29425c69488ba"
],
"ip": "[hidden]",
"location": "",
"name": "[hidden]",,
"offlineTime": "xxxx-xx-xxxxx:xx:xx.xxx",
"online": true,
"onlineTime": "xxxx-xx-xxxxx:xx:xx.xxx",
"params": {
"controlType": "7",
"fwVersion": "2.6.0",
"rssi": -46,
"staMac": "xx:xx:xx:xx:xx:xx",
"startup": "off",
"switch": "off"
},
"productModel": "S26",
"settings": {
"alarmNotify": 1,
"opsHistory": 1,
"opsNotify": 1
},
"sharedTo": [],
"showBrand": true,
"type": "10",
"uiid": 1
},
{
"__v": 0,
"_id": "[hidden]",
"apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"brandName": "Sonoff",
"createdAt": "xxxx-xx-xxxxx:xx:xx.xxx",
"deviceStatus": "",
"deviceUrl": "",
"deviceid": "[hidden]",
"devicekey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"extra": {
"_id": "[hidden]",
"extra": {
"apmac": "xx:xx:xx:xx:xx:xx",
"brandId": "58e5f344baeb368720e25469",
"description": "WO18237",
"mac": "xx:xx:xx:xx:xx:xx",
"manufacturer": "\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8",
"model": "PSA-B01-GL",
"modelInfo": "5aca25ef85a15a8f032672f7",
"ui": "\u5355\u901a\u9053\u63d2\u5ea7",
"uiid": 1
}
},
"group": "",
"groups": [
"5b33da93c7d29425c69488ba"
],
"ip": "[hidden]",
"location": "",
"name": "[hidden]",,
"offlineTime": "xxxx-xx-xxxxx:xx:xx.xxx",
"online": true,
"onlineTime": "xxxx-xx-xxxxx:xx:xx.xxx",
"params": {
"controlType": "7",
"fwVersion": "2.6.1",
"init": 1,
"pulse": "off",
"pulseWidth": 500,
"rssi": -61,
"sledOnline": "on",
"staMac": "xx:xx:xx:xx:xx:xx",
"startup": "off",
"switch": "off",
"timers": []
},
"productModel": "S26",
"settings": {
"alarmNotify": 1,
"opsHistory": 1,
"opsNotify": 1
},
"sharedTo": [],
"showBrand": true,
"type": "10",
"uiid": 1
},
{
"__v": 0,
"_id": "[hidden]",
"apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"brandName": "Sonoff",
"createdAt": "xxxx-xx-xxxxx:xx:xx.xxx",
"deviceStatus": "",
"deviceUrl": "",
"deviceid": "[hidden]",
"devicekey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"extra": {
"_id": "[hidden]",
"extra": {
"apmac": "xx:xx:xx:xx:xx:xx",
"brandId": "58e5f344baeb368720e25469",
"description": "WO18237",
"mac": "xx:xx:xx:xx:xx:xx",
"manufacturer": "\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8",
"model": "PSA-B01-GL",
"modelInfo": "5aca25ef85a15a8f032672f7",
"ui": "\u5355\u901a\u9053\u63d2\u5ea7",
"uiid": 1
}
},
"group": "",
"groups": [
"5b9ce2f48397cd2254ae1978"
],
"ip": "[hidden]",
"location": "",
"name": "[hidden]",,
"offlineTime": "xxxx-xx-xxxxx:xx:xx.xxx",
"online": true,
"onlineTime": "xxxx-xx-xxxxx:xx:xx.xxx",
"params": {
"controlType": "7",
"fwVersion": "2.6.1",
"init": 1,
"pulse": "off",
"pulseWidth": 500,
"rssi": -66,
"sledOnline": "on",
"staMac": "xx:xx:xx:xx:xx:xx",
"startup": "off",
"switch": "off"
},
"productModel": "S26",
"settings": {
"alarmNotify": 1,
"opsHistory": 1,
"opsNotify": 1
},
"sharedTo": [],
"showBrand": true,
"type": "10",
"uiid": 1
}
]
@brightonguy glad that you find it useful & got it working eventually
i’ve been quite lazy lately in making the websocket implementation the default one, focusing mostly on adding support for new devices (which is somehow easier with old implementation ) but i’m working on improvements nonetheless.
regarding the custom updater part, might not happen anytime soon (might actually be an easy thing to do, who knows) but being quite an active development and not being able to test most of the stuff on my side it would be easy to break flow/automations on people’s side and i kinda try to avoid that for now
you can donate some of your time and report back any of the bugs you might encounter instead of just magically waiting for them to be fixed