Open HaTaX2 opened 2 years ago
Something I'll add to this since my goal was to get it integrated with home assistant. I used the SonoffLAN integration by AlexxIT: SonoffLAN GitHub and it works with the plug in eWeLink mode without connecting it to the cloud by using the Local only mode (manual get devicekey) mode. I took the deviceid and apikey I got from 'http://10.10.7.1/device' and configured it according to the config listed at the linked URL, added a name: Sonoff Plug 1
to the config and now I can see and control it in HA just fine. It also reports back power consumption numbers as watts, current, and voltage properly.
So even though I can't seem to get it going in DIY mode, I was able to get it integrated with HA without having to create an account with eWeLink and it works in local only mode using the device ID and ApiKey. This might actually be a more preferred way for use with HA as without the API key it likely won't respond to commands, so it's not wide open in this mode or so I assume...
Here's what my configuration.yaml has in it for this device with the devicekey obscured (Edited to add force_update & scan_interval of 30 seconds as without this the plugs stop updating energy usage after a while):
sonoff:
sensors: [power, current, voltage]
mode: local
reload: always
force_update: power
scan_interval: '00:00:30'
devices:
10014f7fac:
devicekey: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
name: Sonoff Plug 1
I think the DIY configuration for the S31 plugs might just be broken. Picked up a 2nd plug from Amazon a few days ago and I ran into exactly the same issue with the webpage being unresponsive. I didn't spend a lot of time trying every different device and button pressing, standing on hands while waving with my feet routine to get it to work however. Just grabbed the info from the '/device' page and pasted that into my HA configuration after setting it up on wifi with the eWeLink app and everything works perfectly.
Sonoff, you need to change the documentation with these plugs and remove the DIY 'option' as it doesn't work with this firmware. Either that or release a new firmware update that actually fixes the issue. I still like the plugs for the power monitoring functionality at the price point, but not having advertised functionality is a big turnoff.
I hit this too - can't connect to http://10.10.7.1 and http://10.10.7.1/device worked.
I can configure it using the eWeLink app via both the "quick pair" or "compatibile mode" methods.
I might have it setup enough to move forward but haven't tried much else yet.
Just thought I'd update this since my setup stopped working after updating the SonoffLAN integration by AlexxIT to version 3.X. Looks like a LOT changed in how it operates and it wasn't recognizing my plugs anymore, first off it looks like it needs the Sonoff integration HA offers natively. Once I added that and just entered a fake number to enter DIY mode, it displayed my two plugs named properly and everything again and I didn't even have to change my dashboard config.
Here's my current configuration yaml block now:
sonoff:
sensors: [power, current, voltage]
mode: local
devices:
10014f7fac:
devicekey: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
name: Sonoff S31 Plug 1
reporting:
power: [1, 29, 0] # min seconds, max seconds, min delta value
current: [1, 29, 0]
voltage: [1, 29, 0]
10014f7d08:
devicekey: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
name: Sonoff S31 Plug 2
reporting:
power: [1, 29, 0]
current: [1, 29, 0]
voltage: [1, 29, 0]
I added the reporting blocks as I also added an automation to refresh the sensors every 30 seconds. With the new version the force_update and scan_interval values aren't used, so in the new documentation it says to force an update using an automation. Here's what my automation looks like:
alias: Update Sonoff Plug Data
description: ''
trigger:
- platform: time_pattern
seconds: /30
condition: []
action:
- service: homeassistant.update_entity
data: {}
target:
entity_id:
- switch.sonoff_10014f7fac
- switch.sonoff_10014f7d08
mode: single
Thank you HaTaX2, thank you very much. I have a smart circuit breaker, din rail style. Same issue, only able to get to 10.10.7.1/device to get the credentials. Switching the SonoffLAN integration by AlexxIT from auto to local did not work - my circuitbreaker is simply unavailable when moving to local. Had to remove it, and reinstall with no Ewelink account.
I don't like what Ewelink/Sonoff is doing here, because they force you to use their app to put your own private wifi credentials into the device - and without being paranoia, I don't like that a bit.
We need international laws that forbid that. Anticipating such laws, Sonoff/Ewelink should provide easy and accesible and well documented procedures to use their devices. Security should not be their concern and can't be use as an excuse to make it all so obscure and complicated. Amen.
But sofar I am happy with the solution you gave. Thanks again!
I got a Sonoff S31 from Amazon with firmware 3.5.0 (FW Name: PSC-B67-GL) and have been struggling to get it in DIY mode. I feel like I've tried everything but no matter what I do, when I try to access the device via a browser at 'http://10.10.7.1/' I get no response and eventually they device falls out of pairing mode. If I try accessing 'http://10.10.7.1/device' I do get a response back that looks like:
{"deviceid":"10014f7fac","apikey":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","accept":"post","chipid":"009FF275"}
So I know it is listening on port 80 properly, it just refuses to bring up the page where I can enter my wifi network connection information.Tried linking it to the eWeLink application in guest mode and it hooks right up and connects to my wifi network just fine. After connection with the eWeLink app I've tried deleting it in the application as well as leaving it and putting it back into compatible pairing mode and it still won't bring up the wifi config page at http://10.10.7.1. I've repeated this process at least 10 times and never can get into the wifi config page in compatible paring mode.
Some other things I've tried after putting it in compatibility mode:
Using tcpdump to capture the traffic between the eWeLink app and the S31, this didn't show me anything new that I haven't seen on other posts about Sonoff and DIY mode. Basically the app configures the device at 'http://10.10.7.1/ap' with a rest post that looks like:
{"ssid":"WifiSSID","password":"WifiPassword","serverName":"us-dispd.coolkit.cc","port":443}
Tried to configure it via REST myself and was unsuccessful with that way as well, I tried sending a few different REST posts but they didn't seem to do anything or configure the wifi properly on the device. When in compatible pairing mode it only seems to listen on port 80 and won't accept any of the other REST commands in their documentation like 'http://10.10.7.1:8081/zeroconf/wifi' on port 80 or 8081.
Used different devices; Windows 10 laptop, apple ipad, 2 different android devices. All just get stuck on loading 10.10.7.1 forever trying to load the webpage and I'm unable to enter wifi information.
Any ideas here? All I really want to do is use these with home assistant in local only / DIY mode without having to flash Tasmota or ESPHome to the device. Seems like they really messed things up with DIY on FW 3.5 and they haven't released any updates recently which doesn't give me hope they plan on cleaning up the current DIY V2.0 process.
One thing that might be helpful is if someone else that can get into the wifi config page in DIY / compatible pairing mode would be a tcpdump of the traffic. That would let me test doing a POST of that form data to the device even without being able to get the page to come up. Not sure if it'd work, but it's worth a shot. Since I've only got one device that's not working I'm unable to get a capture of what the device expects from the form post.