Sonoff /eWeLink component for original firmware

Hi, I do not know if this has been discussed here.
But I wanted to make a request, if possible, of course.

In the tasmota, we get to put some extra functions in the buttons as two touch make Y a touch do X, pressing make Z.Hi, I do not know if this has been discussed here.
But I wanted to make a request, if possible, of course.

In the tasmota, we get to put some extra functions in the buttons as two touch make Y a touch do X, pressing make Z.

Is it possible without changing the firmware? Can you implement something?

definitely not! all the action are strictly limited to what you can do in eWeLink app (or maybe a combination of actions) and nothing more. sorry.

Hi,
Still have problems with connection:
File “/Users/robertp/.homeassistant/custom_components/switch/sonoff.py”, line 58, in turn_off
self._state = self._hass.data[SONOFF_DOMAIN].switch(False, self._deviceid, self._outlet)
File “/Users/robertp/.homeassistant/custom_components/sonoff.py”, line 289, in switch
self._ws = self._get_ws()
File “/Users/robertp/.homeassistant/custom_components/sonoff.py”, line 254, in _get_ws
self._ws = create_connection((‘wss://{}:8080/api/ws’.format(self._wshost)), timeout=10)
File “/Users/robertp/.homeassistant/deps/lib/python/site-packages/websocket/_core.py”, line 511, in create_connection
websock.connect(url, **options)
File “/Users/robertp/.homeassistant/deps/lib/python/site-packages/websocket/_core.py”, line 220, in connect
options.pop(‘socket’, None))
File “/Users/robertp/.homeassistant/deps/lib/python/site-packages/websocket/_http.py”, line 126, in connect
sock = _ssl_socket(sock, options.sslopt, hostname)
File “/Users/robertp/.homeassistant/deps/lib/python/site-packages/websocket/_http.py”, line 253, in _ssl_socket
sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
File “/Users/robertp/.homeassistant/deps/lib/python/site-packages/websocket/_http.py”, line 232, in _wrap_sni_socket
server_hostname=hostname,
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py”, line 401, in wrap_socket
_context=self, _session=session)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py”, line 808, in init
self.do_handshake()
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py”, line 1061, in do_handshake
self._sslobj.do_handshake()
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py”, line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

Hello,

would it possible to add support to this?

1 Like

@robertpe try the fixes mentioned above in this thread or fix your env certificates (check this similar issue too)

@letherwin someone else mentioned this previously here or on github (i don’t remember exactly) but no i will not add support for it. mostly because i can hardly do the tests on my own i can easily introduce bugs that’ll propagate quite fast and break automations, leaving it to manuall update gives everyone a small sense of debug is something goes wrong.

2 Likes

Awesome work. Got a couple Sonoff Basics just to test out so didn’t want to bother flashing/setting up MQTT etc… took literally minutes to get up in HA. Great work, much appreciated.

After update to 0.88 I get this :
Integrations need to be in their own folder. Change switch/sonoff.py to sonoff/switch.py. This will stop working soon.

And this:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 147, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 962, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.sonoff.switch'; 'custom_components.sonoff' is not a package

Before, everything was working just fine

The background is here The Great Migration | Home Assistant Developer Docs

But it shouldn’t stop working in 0.88 accoring to what @balloob has said.

However @peterbuga will need to sort out his code at some point as

too me i have the same problem i changed folder but nothing is changed

So you either renamed the sensor folder to sonoff or created a new sonoff folder and renamed the sonoff.py to sensor.py in that folder did you? Because that will work… it did for 6 custom components I was using…

I have created a folder called sonoff in custom component and in sonoff folder I copied switch.py and sensor.py
Is it right???

You mean you RENAMED switch.py to sensor.py I hope… and deleted the sensor folder… Then restart home assistant and the error will be gone.

1i download from github “custom component.zip” i will extract it
2 i go in home assistant folder and i have a folder custom_components.
3 under custom_components i create a folder called sonoff
4 in sonoff folder i create two other folders switch and sensor
5 in switch folder i copy sonoff.py that i found in switch folder i have downloaded from gituhub
6 in sensor folder i copy sonoff.py that i found in sensor folder i have downloaded from github
is it corrrect??

no
you don’t need the switch and sonoff folder
you should have a switch.py and a sensor.py in the sonoff folder

it’s a bit funny how unnecessary complicated you guys managed to do/explain the renaming of a couple of files :man_facepalming:

there you go, migration change https://github.com/peterbuga/HASS-sonoff-ewelink/tree/master-HA0.88+ courtesy of fantomnotabene
ps: i didn’t test it

1 Like

Renaming is one thing but what about this?
Does Your change fixes it as well?

Hi again. Just a shout out for us in the websocket club as well please :slight_smile:
I am not in a hurry to upgrade to 0.88 as I have about 6 custom components running!
Thanks

so it will be :
1 create a sonoff folder in custom components
2 copy sonoff. py present in switch folder to custom_components/sonoff
3 rename sonoff.py in switch.py to have custom_components/sonoff/switch.py

and the same procedure for sensor?
is it right now?

Ok I solved there is a guide here for all please read this:

3 Likes

yes that’s right

See the readme linked above though as it has slightly different instructions…