Sonoff /eWeLink component for original firmware

@marciokoko pretty much all your questions have been already answered (some of them even twice), start reading :wink:

Ok I hadnt noticed how far back the thread went, I didnt realize it was a pull-to-refresh kind of page.

(Dec 18)
I think I understand that to solve the 4-toggles vs 3-gang issue as well as the periodic disconnect between HA and ewelink where HA toggles arent updated, might both be solved by this WebSockets branch?

(Jan 2)
Later on I found michael’s post (related to the websockets branch) about updating his sonoff switches which confused me. It doesnt mean I need to update my fw on my sonoff if I use that branch, right?

(Jan 8)
I looked at my t13c online and apparently itead states my t13c should have at least t/h sensor. Of course it would make sense that it had the P/I sensors as well. I have not seen that displayed anywhere in my HA.

My current install is:
04

I just found these branch options:
48

Things I need to do:
I know I need to upload the sonoff-debug folder if I want to be able to participate in this thread productively. I never uploaded that folder. Do I just uploade it inside of sonoff/ folder?

As for the websockets branch, which branch should I try?

The Master which is what I currently have includes a sensor folder, so Im guess I dont need that one.
The sonoff-bulb seems to be component specific.
The websockets-debug or should I install the websockets one?

Fwiw I’m still happily using Websocket-debug.
It pops a few errors in the log now and again but I haven’t got around to posting then recently. I haven’t tested on a T1 as, while I have a couple, i haven’t worked up the nerve to install them yet!

But websocket tracks status very promptly (less than a second to show updates in the HA gui) and is pretty reliable.

It also gets sensor data if you have a POW. I have a TH16 on the way so that’s next to test.

hello
i am trying to setup the configuration but it is not working:
i created folder custom_components inside config file…
when i check configuration before booting, it keeps showing the “wheel” endless…so i am afraid of rebooting and get stucked.
can please help? thanks

So sensor data is only for POW?

as stated in 1st post “sensor entities are generated for devices that return values for power/current/voltage/temperature/humidity”. If your device has any other sensors capabilities please provide the output of sonoff_debug and could be easily added too.

Ok and since there was a file renaming bit for the master, Im guessing the renaming scheme for this one should be:

custom_components/sonoff/sensor/sonoff.py > sensor.py
custom_components/sonoff/switch/sonoff.py > switch.py
custom_components/sonoff/sonoff.py > init.py
custom_components/sonoff/sonoff-debug/sonoff-debug.py

have you tried this https://github.com/peterbuga/HASS-sonoff-ewelink/tree/master-HA0.88+ ?

This is the one I have:

HASS-sonoff-ewelink-master 2

I just noticed that the 88+ has this name:

HASS-sonoff-ewelink-master-HA0.88-

So no, I havent tried it. So let me go ahead and try that one.

I moved in the new files and it works. Although I get this message in the dev-info panel:

Log Details (WARNING)

Mon Mar 18 2019 14:16:16 GMT-0600 (Central Standard Time)

You are using a custom component for sonoff.sensor 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.

So how do I view the tmp/hum values the t1 is supposed to give?

please back up a bit, do you have the temp/hum values in the eWeLink app for this device? because if they are not present here they will definitely not be available in HA.

personally i cannot find a t1 reference with original firmware where it says that you get temp/hum sensors with it. there are some options that involve tasmota tho’…
in the same time, no one mentioned this before, so, can you please post a link to the exact device you have to see its capabilities? (or just run the sonoff_debug that’ll clear the waters a bit)

OK no it doesn’t show up in the app.

I guess I was misled by the Smart Scene feature here:
https://www.itead.cc/sonoff-t1.html

One last thing, when you say “run sonoff_debug”, what do you mean exactly? Do you mean I should log into my hassio via terminal and run python sonoff_debug.py?

Hi, if I have a second account only for home assistant whic are the parameter to have very fast reading(for sensor) and also for light.
Can I put
Scan interval: 5
And as grace period: 999999
So I sayd I have another account only for home assistant.

I have my Sonoff TH16s now.
@peterbuga they work perfectly so far :grinning:
The temperature and humidity sensors are both reporting correctly and promptly.
FYI I’m still using the Websocket branch from a while back.
Thanks again!

@peterbuga I’ve noticed a few command to turn on and off failing for a few weeks. The error in the log looks like this.

2019-03-21 18:47:33 ERROR (Thread-3) [custom_components.sonoff] websocket error: Connection is already closed.
2019-03-21 18:47:34 ERROR (Thread-3) [websocket] error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x723a6990>>: 'switch'

Any thoughts? Thanks.

How can I use websocket there is a tutorial to install it???

@Michaelrch by any chance does any of the devices might get intermittently offline/online?
Truth be told the log messages are not revealing too much and I’m trying to figure out when/how/why the connection might drop. Clearly I need to handle the websocket a bit better somehow :thinking:

Not as far I know… In the case above, I ran the script again about 10 seconds later and it worked ok. This particular switch is about 3m from the AP with line of sight. The AP has about 10 devices on it using 802.11n, all switches and other quiet devices, so the frequency shouldn’t be too noisy.

FYI If am running the websocket-debug branch, downloaded yesterday.

@peterbuga @Michaelrch Does it happen with sending multiple commands rapidly?

I mean I have had a pretty stable connection over months now. The only time I faced an issue was when I was rapidly turning off a 4 channel device (basically a command was being sent for each channel) which to me seemed to be the issue. Don’t know for sure though.

Thanks for the suggestion.
I did have some scripts that would follow a turn_off with a turn_on. I have separated those two steps with a 1 seconds delay. Unfortunately I am still getting the error in the log from time to time, though I’ll test for a while to see if the actually functionality is more reliable.