Sonoff /eWeLink component for original firmware

I updated the component, restarted HomeAssistant and presto.

The switches created by this component have a new name tho, they used to be named something like switch.10a72838c (some random alphanumeric). Now they have a suffix switch.*sonoff_*randomalphanumericnumber

there’s a toggle option to restore that behavior, check entity_prefix

for those who complain about the latest updates not working, please provide more details, logs anything. i cannot debug (or fix, but ain’t the case now) on simply not working-s (i don’t have access to sonoff devices and it’s purely theoretical from now on for me). the component still works with the latest update… for me anyway :upside_down_face:

1 Like

for me it’s still working too, I’m on latest hassio build and I never updated the component since first install, around May 10th

If I understand right this is only related to HA (64bit) + Sonoff installed on QNAP?

On Raspberry with 32bit HA etc. everything works for me too.

come hai messo HA in 32Bit? io uso HASSBian
how did you put HA in 32Bit? I use HASSBian

Hi Peter!

I’ve some good and bad news since I’ve updated Sonoff firmware on my Sonoff devices to 3.3.0 release.

Good news: Sonoff switches are very reactive (when I update a switch manually, HA receives immediately change state event and when I use HA to change state of a switch, it commutes immediately)

Bad news: Regarding Sonoff temperature / humidity sensors (TH16) and Sonoff POW R2, HA doesn’t receive any state events changes (temperature, humidity, power, current, voltage): sometimes restarting HA, it reads new values just first time, no further values are tracked; often, restarting HA, it reads no new values, so undefined or “old” vales are shown both inside UI and sensors state page).

I check your HA Sonoff code, so I did on Sonoff debug notifications, but no error. It looks like websocket doesn’t receive state change events (for temperature, humidity, power, current, voltage).

Thank you! :slight_smile:

— INTEGRATION —
For more infos: a Sonoff POW with 2.6.1 firmware version works fine, so problems seems to be limited to my other Sonoff sensors: POW R2 and TH16 with 3.3.0 firmware version.

what you’re saying makes it weirdly interesting :thinking:
clearly they changed something but I strongly believe the data is still sent over websocket otherwise a device with a fw 3.3.0(+) will be incompatible with an older version of the mobile app (and that will be just really bad design).
also I think stuff changed on how the device send’s the temp/hum/etc. data to the server and then the normal update back to HA websocket instance.
i have POW R2 myself, but for summer reasons it’s unaccessible to me right now. also I’ll have to purchase a flasher to dump the current fw so I can test and find the differences between the firmwares.

i’m also waiting for further complains to see if anyone else has this problem.
ps: if i remember right there is already a polling fallback option that updates the HA just in case websocket crashes for whatever reason, so for better or worse the details should still change (just like when you restart HA) just … slower.

Thanks a lot, Peter! :grinning:
Yeah! I agree with you that Sonoff doesn’t changed the data structure, otherwise data never be retrieved.

I just noticed some new strange things:
a) Inside Sonoff (eWeLink app), refresh rate of POW R2 sensors are very slow compared previous firmware and app versions (yes, eWeLink app release, too) and now voltage, current and power has a refresh rate slower that 10 seconds…
b) I find out that new eWelink app has a kind of “background login” and it’s necessary to do an explicit logout to avoid Sonoff login conflict with HA
c) Often, new eWeLink app switch automatically in LAN mode despite my internet connection is stable and fast

So… may be Sonoff messed up something…

Well, I’ll wait some days to see if new firmware version will be released or something changes on Sonoff AWS service or new eWelink app, or…

Thanks a lot again and feel free to ask me more details as you need!

— INTEGRATION (again) —

  1. Because it’s ill-judged be logged in Sonoff from eWeLink app and HA at the same time, I checked all I wrote before after doing an explicit logout from eWeLink app: I can confirm each assertion I did.
  2. I rarely see randomly single value updated (temperature, humidity, voltage, current power) from Sonoff sensors inside HA
  3. As I wrote, eWeLink app often auto switch in LAN mode and I’m able to see sensors change state on app UI during app LAN mode; seems to me that in “internet” mode app doesn’t receive any state change event

Considering what I stated above (points 2) and 3)), do you think it’s possible that new firmware release / eWeLink app loses connection with Sonoff AWS services? This would explain why HA was unable to receive sensor status updates! :roll_eyes:

(P.S.: I’ve checked correct eu-AWS Sonoff URL resolution: each client in my network resolves it correctly)

I also have problems with Sonoff POW R2 after upgrade to firmware 3.3.0.

But I don’t think that this is only connected to home assistant. So what I have noticed:

  • Sonoff POW R2 no longer report Voltage when turned off
  • reporting Power and Current is wierldy slow (in standar Ewelink app), many times, when I turn on with device connected power is no, Voltage showse proper value, but Power and Current values are 0 (it can take couple minutes to show proper values)
  • in home assistant (using your component) state changes even slower, it takes even more then 20 minutes to change state. But not always. It varies.

I need to find a way to downgrade firmware, because now it is unusable in term of sensors (and thats why I wanted to have POW not standare Sonoff basic) :frowning:

@rmilani try to use a 2nd account and share specific devices to be able to test/use HA + ewelink app in the same time (it’s described on project’s page)

@pawelmb as far as i know you cannot downgrade unless you previously dumped and saved a particular firmware of a device. i dabbled above in the thread with the idea that that there might be a possibility to restore a device with a current firmware available (for example if you did tasmota on it) but i’m not aware of a downgrade/download of an older fw (please let me know if you find something about it, i’m interested!)

i would like to throw a theory in the wild, that I (aka the component) might be responsible for this possible change in update reporting :sweat_smile:.
just imagine, the websockets were supposed to be open only by the mobile apps, and while there are 1mil+ of installs/usages I hardly believe someone kept an app open more than 5min (maaaaybe 10 mins) and now there are probably a few thousands of component installs or forked versions that are using the websockets and are online 24/7. this might’ve create a real problem on their servers and they probably started to “sacrifice” what was not completely essential => they might store/capture the data but they are not broadcasting it back on websocket, instead they opted for a polling style update on the app (again, just a hunch based on above reporting).
i’m unable to test it right now, so i guess we’ll just have to wait and see.

ps: truth be told I’m really surprised they didn’t block the non-app logins yet, i guess someone there had a huge :man_facepalming: when they realized it’s bad practice to hard code an API key in the app

Peter! :sunglasses:
Sharing Sonoff components to a secondary login used by HA works without troubles: all original switches / sensors activable / readable without lags!

However, it’s necessary to keep eWeLink app as background task on mobile phone (avoiding logout) to make HA able to receive sensor change states.
So, you again are in right!
Seems that Sonoff implemented a check to see if a their app is really connected, otherwise don’t shares event change status! (and reasons of that are clear (AWS costs)!).

Now I left eWeLink app in background on my phone and I’ll check in next hours if HA will continue to receive change status events (as I think).

Thank you! :smiley:
(Hope this talk will be useful for HA & Sonoff users)

1 Like

Hi,

I can confirm that with firmware 3.3.0 some problem occurs. The state on/off is no more available for my pow R2 but at least voltage, amperage et power are here.

Ok everything is fine now … I had to manually activate the buttons on the appz to be available after in HA

I did a new check of “all things”…

  1. After eWeLink app new release installation, each POW R2 switch is automatically set in “LAN mode”
  2. Sharing switches and sensors to other accont and using this one inside HA seems an apparent “good job”, but after app (app use original Sonoff account, HA using sharing account) is closed on my phone, all stops and no more frequently refreshed change state events will come

So:
I start with disable on each switch the “LAN mode” and keep eWeLink app with original account on an old phone.
I aware it’s a work around.

Now I’m going to monitor HA change state events keeping eWeLink app closed (in an half of hour I’ll be able to give a response to that).

I’ll find out if the issue is the “LAN mode” applied on switches within new firmware release (3.3.0), otherwise some other unpredicted changes occurred about Sonoff devices exchange infos with AWS service.

— INTEGRATION —
Bad news:
(more than 25 minutes occured) eWeLink app needs to be open to receive change status events inside HA! :frowning_face:
So, really, seems Sonoff sensors (POW R2 with 3.3.0 firmware) doesn’t send change status events to AWS service unless eWeLink app is open… (POW and TH16 works as expected, instead)

@peterbuga Your theory seems possible. From my observation it could be as follows: they have noticed much bigger traffic and costs, they have decided to limit trafiic with new firmware (3.3.0) and unfortunately they have done it poorly - even to standard app, update of values seems to have troubles, not only me.
I’ve found the same on official forum, like:
https://support.itead.cc/support/discussions/topics/11000027580
or
https://support.itead.cc/support/discussions/topics/11000027570
all connected with standard official app, so it seams that there is a bug in new firmware.

For now, only thing that I’ve found on downgrading is:


but it requires [FTDI USB To TTL 3.3V & 5.5V Serial Adapter + Cable] which I don’t have. So still looking for some OTA way to do this.

Maybe if I find time, I’ll try to skip ewelink servers and try it locally:

@rmilani pow R2 with 3.3.0 is working flawlessly for you? For me it sometimes works and sometimes not updating Power and Current values :frowning:

@peterbuga I’m even not sure if now orginal app is showing real data of voltage. Here is history of couple last days of voltage, logged from home assistant, but you can see, that:

1 Like

As you can see in the image, before and after I left eWeLink app open on an old iPhone 4S.

I’m monitoring home energy consumption (in kWh) by an integration sensor, so I need a refresh rate of POW R2 power level lower than a minute to avoid seriously underestimated values.

I will do so until better solutions are found.

@peterbuga I found:
sonoff-lan-mode-homeassistant
and
Control Sonoff devices running original firmware, in LAN mode

But:
a) Seems that only 192.168.0.0/24 network are enabled (however I think this is a minor problem: configuration will enable for instance a 10.0.0.0/24 network)
b) No implementation concerns sensors, but only switches (more problematic, I suppose)

Do you think in future is possible to extend “LAN mode” concepts inside your “HASS-sonoff-ewelink component”?

— INTEGRATION —
I’m sad… :frowning_face:
My “work around” doesn’t works for long time… After about an hour (sometime less), eWeLink app on my phone, tells “no connection found” and needs to be refreshed to switch in “online mode”.

@rmilani thanks for the results, it is indeed a :poop: situation. i am aware of the sonoff lan mode options (and i keep a close eye on the updates) but as I already mentioned here it’s not going to happen anytime soon.

also, judging by the forum support links posted by @pawelmb looks like this might be an extended problem and i’ll wait it out and see if they fix something anytime soon before I jump the gun and start finding workarounds (it’s not like I have an option anyway, no further updates on the component till at least end of August)

FWIW, I’m also seeing the same issues with my Sonoff POW R2 with the new 3.3 update.

I am not seeing the data update correctly within the eWeLink app, like rmilani mentioned, so I would agree with peterbuga to hold tight to see if a new update comes down soon.

fingers crossed.

The master branch quit working with my sonoff minis. They would only stay available for a few seconds after power up using Hassio. I switched to the websocket branch which works well. The sonoffs are not showing in the entity registry though. They can be controlled from states or when added to the UI.