Sonoff /eWeLink component for original firmware

update what exactly? the listed devices are confirmed to be working just fine

@peterbuga first I tried to change primary dns to 1.1.1.1 then restart my pi, it works, I can see and control my sonoff basic & PoW, but I lose pihole ad filtering, wondering whether the real culprit is the dns, I changed back my primary dns to pihole, and restart HA service thru configuration screen, somehow it still works, even though i"m using pihole as primary dns.

Anyway thanks for great component :+1: :smile:

Yes all is good but I downloaded your component a month ago will you release a new version or it I only one pheraps more quickly or with same new feature? To replace component old with another…

If you go to https://github.com/peterbuga/HASS-sonoff-ewelink you will see that each branch has a list of Commits. That tells you when the code was last updated.

I have succesfully added 1 channel sonoff for garage door:
https://www.itead.cc/inching-self-locking-wifi-wireless-switch.html. Thanks @peterbuga! It worked fine on 2.6 firmware, and works now fine on 2.6.1 firmware.
But how to set the switch, to be acting like inching switch? Now when I turn on the switch it open door and stays on. To close door I must power off switch and power on again to close door and then power off at end. Any idea how to change the switch to go off by itself or act like inching?

@warcanoid for starters have you tried to customize the entity with the assumed_state option https://www.home-assistant.io/docs/configuration/customizing-devices/#assumed_state? this might give you a slightly better experience i hope.

truth be told in this very moment i have no idea how to represent an inching device in HA, in theory it should be a button that stays on for 0.5-2sec (or whatever is setup) and turns off automatically, right? if someone knows another component that implements an inching device please let me know so i can study the code and replicate it here
in the same time i’m not sure how i can detect a sonoff device in inching mode (i saw that a sonoff basic for example can be setup as one, but in the same time one can be hardcoded in inching modes only) would it be too much to ask to provide a device output using this script https://github.com/peterbuga/HASS-sonoff-ewelink/tree/master/sonoff-debug in order to get a better view of the problem (or even better if you follow these steps? thanks :slight_smile:

@peterbuga thanks! Have modified the switch with node-red automation: https://imgur.com/a/sNHFMhV, to turn off after 5s, I will shorten it now to 0.5 or something like that. So everything fine :slight_smile:.

Can not run the script on hassio, get permission denied or command not found. Added debug: True in configuration.yaml, copied script in config/python_scripts.

@warcanoid why don’t you just use the inching support from eWeLink app itself? i believe it might be a bit more reliable than fast switching the state with node-red

This device goes default on then off, have enabled now inching and the garage door went crazy. But the switch stayed on in HA. With automation it works well.

I’m having this problem: 2019-01-28 20:05:53 ERROR (Thread-3) [custom_components.sonoff] websocket error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)

How do I fix it? Its not a raspberry pi, a generic venv virtual environment install of HASS.

@marksev1 i saw you posted sort of same issue a few days ago, did you actually tried the fix mentioned then?

Yes this fix doesn’t work, and I’m not using it on a MacOS but Linux.

Any further feedback? How could I debug it, what should I try? I’d really like to use it as is without reflashing it…Aha I see I will send you the debug log from the websocket-debug branch…

I tend to believe that the problem might actually be in the same realm, upon further google-ing I’ve seen that certifi package might fix the problem.
Please confirm that this command pip/pip3 install --upgrade certifi really didn’t work, don’t just exclude it because it’s written macOS all over.

The websocket-debug won’t work as it relies on exactly same code above :sweat_smile: this branch is used mostly useful to catch messages to/from a device for better integration with this component.
Maybe if you give me more details, I might spin up fast a virtual machine and try to replicate your problem and hopefully push a fix for it, but don’t hold your breath over it…
(alternatively you could try the eWeLink LAN mode component but you lose the cloud connectivity part)

Feature :slight_smile:

1 Like

@peterbuga Just want to report so far so good with this component running with HASSIO in docker with Pi3B+, except just a minor thing I found, I’m curious how could Sonoff Pow sends watt usage to HA while powered off or HA misinterpret the data send by Sonoff at 02:19AM ?

here’s screenshot from my ewelink app.

@e-budianto that’s a really good question/observation! As I mentioned many times so far, the implementation of any devices other than Sonoff Basic were purely theoretical on my side and I never got them to test.

the data that you see/get, it’s exactly what I get from eWeLink API and nothing more. I recently found out that sensor data is propagated over websocket messages too, not just basic requests (as it now), when I do find the time I’ll update the component to take advantage of this and hopefully an overall better output :crossed_fingers:

1 Like

Sorry for stupid question

I have put into configuration.yaml:

sonoff:
  - username: [email protected]
    password: MyPassword1
    scan_interval: 60
    grace_period: 600
    api_region: 'eu'

I have created folder “custom_components” under confing on hassio and copied files and folders from github.

Then I have rebooted HA and tried to add Entity for switch, but I can not find any sonoff entity. Did I miss something?

You missed the instructions. There is no - before username

Also, did you follow exactly the paths in the instructions? There are 3 different files named sonoff.py, all in different directories.

Ok, deleted -, no difference
I downloaded .zip and have keept them in the folders as they were, then checked and they are there.

Actually even validation gives me error:

Invalid config for [sonoff]: expected int for dictionary value @ data['sonoff']['grace_period']. Got '600 (optional)'
offset 60 (optional) should be format 'HH:MM' or 'HH:MM:SS' for dictionary value @ data['sonoff']['scan_interval']. Got '60 (optional)'
value should be a string for dictionary value @ data['sonoff']['password']. Got ['MyPassword1']
value should be a string for dictionary value @ data['sonoff']['username']. Got ['[email protected]']. (See /config/configuration.yaml, line 149). Please check the docs at https://home-assistant.io/components/sonoff/

@peterbuga First, a lot! Very! Thank you for putting your time on this project and making it available to us!
I think some users in the community have always looked for this solution until you came along!
I have installed on my rp2 and it works perfectly !!! It worked the first time I installed it!
Perfect!!! Thanks again!!!

1 Like