Sonoff /eWeLink component for original firmware

Thank you, Peter! :slightly_smiling_face:
Ok! No problem if HASS-sonoff-ewelink updates needs time! :wink:
May be Sonoff remedies soon the disservice (many users are complaining) :sweat_smile:

Finally same here … no more power,voltage,current updates for my pow R2 :frowning: …why I flashed to 3.3 … :frowning: :frowning: :frowning:

Hi!!!
Finally I made what you asked me to do and I posted on github.

Just to refresh, my first post:
"First of all, sorry about my english (ain’t my native language).
I bought a generic (aliexpress) dimmer switch. It works perfectly on ewelink app.

On HA (hassio), just shows on off (switch) without dimmer, at least I couldn’t find these entities. In “services” just appear the switch’s entity (switch.sonoff_xxxxxxxxx).

Did you find any advanced user to follow you up on this question (I’m a newbie one)? How can I make my self useful to this task? I promiss that I’ll respond ASAP.

Running:
RPI 3B
Hassio HassOS 1.13
HA 0.94.4"

Original message on the github site:

Hi! I made a persistant notification debug and the results are these:

Steps that I did:
1 - ewelink app turn on switch (brightness 50 by default)
2 - ewelink app set brightness to 20 (not exactly this value)
3 - ewelink app set brightness to 0
4 - ewelink app set brightness to 30 (not exactly this value)
5 - ewelink app set brightness to 60 (not exactly this value)
6 - ewelink app set brightness to 90 (not exactly this value)
7 - ewelink app set brightness to 100
8 - ewelink app set brightness to 50 (not exactly this value)
9 - one touch on physical button (I think it was the lower brightness button)
10 - one touch on physical button (I think it was the bigger brightness button)
11 - three fast touches on physical button (I think it was lower button)
12 - three fast touches on physical button (I think it was bigger button)

OBS: There are some sonoffs, the dimmer is switch.sonoff_1000437aef.

That’s the debug persistant notification:

------------COPY-FROM-HERE--------------

2019-08-07 20:38:14.016 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "params": {"bright": 30}, "sequence": "1565221235087", "tempRec": "1000437aef", "ts": 0, "userAgent": "app"}

2019-08-07 20:38:14.703 [s] {"entity_id": "switch.sonoff_1000437aef", "outlet": null, "state": "on"}

2019-08-07 20:38:14.704 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"bright": 30, "switch": "on"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:38:31.013 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "params": {"bright": 10}, "sequence": "1565221252110", "tempRec": "1000437aef", "ts": 0, "userAgent": "app"}

2019-08-07 20:38:31.702 [s] {"entity_id": "switch.sonoff_1000437aef", "outlet": null, "state": "on"}

2019-08-07 20:38:31.703 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"bright": 10, "switch": "on"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:38:53.895 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "params": {"bright": 38}, "sequence": "1565221275070", "tempRec": "1000437aef", "ts": 0, "userAgent": "app"}

2019-08-07 20:38:54.607 [s] {"entity_id": "switch.sonoff_1000437aef", "outlet": null, "state": "on"}

2019-08-07 20:38:54.609 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"bright": 38, "switch": "on"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:39:12.013 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "params": {"bright": 67}, "sequence": "1565221293126", "tempRec": "1000437aef", "ts": 0, "userAgent": "app"}

2019-08-07 20:39:12.708 [s] {"entity_id": "switch.sonoff_1000437aef", "outlet": null, "state": "on"}

2019-08-07 20:39:12.710 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"bright": 67, "switch": "on"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:39:27.410 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "params": {"bright": 85}, "sequence": "1565221308684", "tempRec": "1000437aef", "ts": 0, "userAgent": "app"}

2019-08-07 20:39:28.957 [s] {"entity_id": "switch.sonoff_1000437aef", "outlet": null, "state": "on"}

2019-08-07 20:39:28.958 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"bright": 85, "switch": "on"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:39:30.207 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"fwVersion": "2.0.2", "rssi": -58, "staMac": "xx:xx:xx:xx:xx:xx"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:39:50.714 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "params": {"bright": 100}, "sequence": "1565221331828", "tempRec": "1000437aef", "ts": 0, "userAgent": "app"}

2019-08-07 20:39:51.409 [s] {"entity_id": "switch.sonoff_1000437aef", "outlet": null, "state": "on"}

2019-08-07 20:39:51.411 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"bright": 100, "switch": "on"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:40:03.135 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000236d45", "from": "device", "params": {"rssi": -39}, "ts": 0, "userAgent": "device"}

2019-08-07 20:40:07.917 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "params": {"bright": 56}, "sequence": "1565221349082", "tempRec": "1000437aef", "ts": 0, "userAgent": "app"}

2019-08-07 20:40:08.622 [s] {"entity_id": "switch.sonoff_1000437aef", "outlet": null, "state": "on"}

2019-08-07 20:40:08.624 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"bright": 56, "switch": "on"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:41:40.934 [S] {"entity_id": "1000437aef", "new_state": "off", "outlet": null}

2019-08-07 20:41:41.603 [W] {"apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "error": 0, "sequence": "1565221300927625"}

2019-08-07 20:41:42.334 [s] {"entity_id": "switch.sonoff_1000437aef", "outlet": null, "state": "off"}

2019-08-07 20:41:42.335 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000437aef", "from": "device", "params": {"bright": 56, "switch": "off"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:41:47.934 [s] {"entity_id": "switch.sonoff_1000236d45", "outlet": null, "state": "off"}

2019-08-07 20:41:47.935 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000236d45", "from": "device", "params": {"switch": "off"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:42:53.424 [s] {"entity_id": "switch.sonoff_1000236d45", "outlet": null, "state": "on"}

2019-08-07 20:42:53.425 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000236d45", "from": "device", "params": {"switch": "on"}, "ts": 0, "userAgent": "device"}

2019-08-07 20:43:03.145 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "1000236d45", "from": "device", "params": {"rssi": -42}, "ts": 0, "userAgent": "device"}

---------------END-OF-COPY----------------

Thank you!

I have problem with 0.97.1 custom component is not good can anyone help me?

Hi @peterbuga
about Sonoff POW R2 , even if you downgrade to ver 2.8.0 like I did it will not work .
how-to-backup-restore-official-firmware-on-any-espressif-esp8266-esp32
I think they are keeping our information on the server { Country, ID 1000643xxx, Name, Pass…}
The only way I found to let it work was by using a fake location GPS (mobile rooted), and changing my Country plus a New subscription .

Not with that level of information. See How to help us help you - or How to ask a good question

as far as i know ewelink doesn’t require any location services (i do all my debugging on ios) and one can easily change the so-called originating country simply by using a proxy. i think what you’re mentioning is the server-side stored data on various chunks on their side, the problems above we’re related to the instant reporting part that’s not working anymore as it has been mentioned.
please give more details of what you achieved, i’m in the same boat as @nickrout

@Fernando_Donan thanks for dumps, very useful!

nickrout was replying to @Hdjweb .

I am using Android and to Register you must enter your Country .
after that to add your first Sonoff device they ask you to turn on your GPS .

they are trying to do like NOKIA did before, you can only upgrade but not downgrade FW.


if you remember our old discussion

waiting for someone who can crack there FW.

I’m 100% sure the location was not needed in previous app versions (and I still think is not needed it’s just a constrain on app’s side not server side), I know this because I was always selecting “Andorra” out of laziness and let the app figure it out my country in background based on my ip (the same flow is used in the component as a failsafe for people who misconfigure the location in HA). maybe they’re just trying to optimize/analyze where&how the users are located to deploy the servers better and whatnot
ps: i live in Milano for the time being and I had an italian IP all the time :stuck_out_tongue:

regarding the previous FW conversation, the idea was to be able to restore a sonoff device to current available firmware by downloading its firmware file from itead servers just like a device would & ready for flashing (aka tasmota -> original sonoff) and NOT downgrading. i don’t think the time i might spent on cracking this will make much of help

1 Like

I love this component, I have been using it for months now with no issues.

Any chance to get this added to HACS, its a nice easy way to stay on top of new versons/changes

for the time being no :slightly_smiling_face:

Ok with the latest firmware with Home Assistant 0.97.2 all is ok and I have a smart circuit breaker

@Hdjweb

what type? a link if possible.
thanks

Thanks a lot peterbuga for your incredible work and your time. After activate my Home Assistant’s python virtual environment (source bin/activate) and install websocket and websocket-client (pip3 install websocket websocket-client) your component works as expected. Are there any option to put my switch in living room area?. I can’t put the switch in any area beacause i can’t see it in “Integrations” panel.

Tahnks a lot for your great work!!!

Just make a custom button and place it in Lovelace in a living room group.

Thanks a lot for your answer CoreyMaxim. I have searched about “custom buttom” in Home Assistant but i don’t find specific official documentation. Maybe you refer to Button Card? Lovelace: Button card

Thanks a lot.

That’s absolutely the one, that button card is awesome. You can do pretty much whatever you want to do with them.

This is pretty much how my whole ui is setup as.

friend I had the same problem as you, after the last update my sonoff pow did not give an updated reading of consumption, just disable lan mode in each sonoff pow and the problem will be solved

I returned back to Tasmota with teleperiod of 10 Sec.
now everything is fine especially with Grafana.