Sonoff S31 watts not updating unless eWeLink app is open

To compare notes, I am using this to control my S31 locally - without the eWeLink cloud.
GitHub - AlexxIT/SonoffLAN: Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant
This is the same one ALDIY mentioned in post #8 of this thread, and could be installed/updated via HACS.

I am still on version 3.3.1, so have not updated to the latest (which is 3.5.2 as of today). So if you are trying 3.5.2, let me know how your S31 behave also - I’d love to compare notes.

To use Alex’s integration, this is what I have got in my configuration.yaml:

sonoff:
  username: !secret sonoff_usr
  password: !secret sonoff_pwd
  mode: local
  #reload: always  # update device list every time HA starts
  #default_class: light  # (optional) to set the class, default class being switch
  #force_update: [power]
  #scan_interval: 300  # this is in seconds; so every 5 minutes
  #sensors: [power]
  devices:
    1000aabbcc:
      name: S31 Plug with Power Meter
      reporting: 
        power: [30, 3600, 1]  # min seconds, max seconds, min delta value
        current: [5, 3600, 0.1]
        voltage: [60, 3600, 1]

I have not touched the config for years. Likely there are new config format or configurable options or both these days.
And when I set it up, I’d only need the eWeLink app to register the account once, to get everything going (for the integration to go to eWeLink cloud to grab a token for local control)… do not even have the app on my phone any more.

And I can’t recall how to check the firmware version of the S31 now.

AlexxIT/SonoffLAN is how I am utilizing my S31s also… I watched a youtube video quite awhile back, and actually made my decision to buy the S31s based on the ease of setup vs the flashing route. I saw the Sonoff integration in Devices and Services and thought I was using some kind of regular integration, but in deed I see it is in HACS now and shows up as AlexxIT/SonoffLAN Custom Component. But I can completely disconnect from the Internet and everything still works (this has been a design goal from the start of my HA journey, because I plan to give the RPi4 away with the sale of my house. That is why I am trying to keep it very simple.), so I have no idea how it is even working now.

I had to use Homekit hashes for a couple other integrations, but other than that I can not recall ever having to provide authentication for the S31s outside of the ewelink app. Once I configured them, I installed the Integration and I believe HA just found them and I added them to a card during the install.

Another odd thing I did not realize is that I do not even know how to find the version number of the integrations I am running, so I have no idea what I am running outside of the basic HA info in About…

Home Assistant 2023.8.4
Supervisor 2023.08.1
Operating System 10.5
Frontend 20230802.1 - latest

I am only running 11 integrations, and I literally have 6 lines of actual config in my configuration.yaml:

# Loads default set of integrations. Do not remove.
default_config:

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

my secrets.yaml file is empty with a couple comment lines explaining what the file is. And I created a single script that does a quick run of my sprinkler zones from an automation that fires at sunset if the high temperature was above 90F for 10 minutes at anytime during the day. Everything has been configured from the UI though. I have looked at the yaml from time-to-time and figured out how to customized a few gauge colors, I just don’t use it because I do not know the syntax well enough to trust myself. HA is pretty much a universal remote for my house on an iPad. Pretty much just “Smart Home Ready” eye candy for a buyer when I sell.

I do plan to take some of the devices with me, as well as the knowledge I can learn in the process on to the next house, and I have much bigger plans for the Energy piece then. Right now, I am trying to figure out which appliances I am keeping, and if I can balance my breaker panel across phases better… the S31s are coming in handy for that, so I want the history graphs back. :wink:

I appreciate your sharing though. If you have any other thoughts I am interested. I am going to continue to look through the directory structure when I have time and see if I can glean anything else with my limited knowledge of the underlying system.

Thanks again.

I did some nosing around in the file system and found the manifest.json file for SonoffLAN. Looks like I am running “version”: “3.5.2”, with pycryptodome>=3.6.6 as a dependancy.

I found the firmware version of the S31s in the eWelink app. They are all running 3.5.0 firmware (3.6.0 is available) with LAN control turned on.

I am tempted to upgrade the firmware, but eWelink just upgraded their app, and I do not want to take a chance of the new firmware locking me in to using only their app. I haven’t decided if I want to sacrifice one of my S31s to test, or just buy a couple more. I hesitate to do either though, because I understand I have to delete a file and have it redownload the device info from the cloud, and then restart HA. Plus the devices were not the easiest to even pair with the stupid app as I recall. I don’t have time to read and play right now, but I will try to get a backup of my system sometime this weekend, and maybe I will find some time to play. :crossed_fingers:

@k8gg it is really weird, because I can not find where I am authenticating with anything. How is this working? lol
I have a Shelly 1 that apparently is having an issue since the update too. I just noticed I have a Repair notice… It is complaining about “Push update Failure” even though I have CoIoT set, and that functioned for months without complaining before the update.
I am going to purchase a couple more S31s, and hope they have the new firmware already installed. I am going to backup the SD card tomorrow afternoon, and then see if I can add the new S31s to HA, and see if the firmware makes a difference.

UPDATE:

I added the following to my configuration.yaml:

sonoff:
  username: !secret sonoff_usr
  password: !secret sonoff_pwd
  mode: local
  reload: always  # update device list every time HA starts
  #default_class: light  # (optional) to set the class, default class being switch
  force_update: [power]
  scan_interval: 300  # this is in seconds; so every 5 minutes
  sensors: [power]

and obviously made the additions in my secrets.yaml

2 new smart plugs are using firmware 3.6.0. It was the usual pain to pair them, but they finally do work both in the eWelink app, and in HA. However, they are significantly slower to respond than my 12 original S31s running firmware 3.5.0.

using the eWelink app it takes almost 15 seconds to respond. my original S31s take about 1 second.

HA takes about 2 seconds with the new S31s, but my original S31s are instantaneous (I would say milliseconds). Very disappointing!

AND the same symptoms with the power monitoring. If the eWelink app is not open I just get a flat line of the last state it saw when the app was open. Turning it off and on works, but the amps and watts do not change in developer tools or history.

One thing I noticed is that if I remove all the yaml I added, it now reports 0A 0W when the device is on, and when I turn the device off it will report the last known state. very weird. It happens on old and new S31s. This was not the case prior to adding the yaml. I have not tried to pop the clone I made of my SD card in yet, but the core is now 2 versions back. I keep hoping the newer versions will somehow magically fix the issue. :persevere:

I am in the middle of house repairs, so time is a commodity, but I will play more when I get a chance. Let me know if you have any thoughts.

I ended up sending the new S31s back. I am wondering if I received counterfeit units… the MAC addresses had a totally different prefix and even with the firmware update I could not resolve the lag in HA or the eWelink app. Oddly, the power readings started working again in HA, until I removed the units I sent back, and reloaded the integration. :persevere:

After doing some research I found this issues post, and it looks like there is a v2 API that maybe the culprit: https://github.com/AlexxIT/SonoffLAN/issues/1219#issuecomment-1705530160 and if this issue persists, it is likely there is a fix, but it appears it may require a reinstall with a new API Key or at least copying the new files and editing the YAML.

ADDITIONAL UPDATE: After the last Core Update, and subsequent HACS update, I noticed the original S31s are reporting Amps, Watts, and Voltage again. I have not intentionally changed anything with the SonoffLAN Integration, so I am not sure what made it start working again, but it has been working since the 2023.9.3 update. :crossed_fingers:

I think I have similar issue with S31. I have to open the eWeLink to get power and current updates. However, I found it was resolve after I restart my HA. I want to get everything from LAN. so I select local in sonoff LAN then it cannot be updated again. Do you have any solutions?

Fought this battle for some time. Gave up and flashed all my Sonoffs with ESPHome. Never looked back! :slight_smile:

omg this is my issue also what the hell happened on this past updates now it wont even update… sometimes it does sometimes it doesnt