New custom component: Sonoff LAN Mode (local, with stock firmware)

Yes, the issue is that that key is wrong.

Don’t worry about the debug message, thats expected.

You shouldn’t need to backout zerconf, just make sure you have the latest version of my component, get the API key right and it should just work.

Use one of the other methods of getting the API key. For example you might want to check out this descriptions Sonoff: LAN Mode VS Tasmota

I’ll update the docs when I get a chance.

Thanks for your help. I have latest version from Github.
regarding your link i can’t see the post
image
If you are referencing to enter pairing mode on one of the sonoff devices I’ve tried that also yesterday but without any success. The device is blinking (after pressing the button for more then 7s) but no AP ITEAD-xxxxx is available under WIFI networks. Sorry if this isn’t the topic you have referring to…

He put the link two times after each other.

Thank you @francisp I didn’t check the link from the post, my bad…

Ok, I need a router with DD-WRT on it which I don’t have :frowning: so is there other possibility to sniff via tcpdump apikey?
On more thing - probably noob question. Do I need to obtain apikey for each sonoff device in my home?

Now this is working. But is there a way to make these available on google home (google assistant).
Normally I would go for gbridge (google assistant is not so easy to setup). However then I need MQTT…
Any advise?

I have a sonoff mini. i dont understand one thing. in the doc it is written if i want to use DIY mode with jumper on, then i dont need API key. but while in DIY mode how it will connect to my home network? i thought in DIY mode it only connects to specific ssid!

and then i tried without jumper, i deleted from app, and restarted mini to put it in pair mode (i think), but i couldnt find any ssid starting with ITEAD. but at this point i can pair this in the app. am i doing thing wrong?

i wanted to flash tasmota into this mini. but my DIY tool didnt find the mini, and i tried 3 windows PC. is it a possibility that the mini is somehow corrupted!

The DIY tool needs firmware 3.3 on the mini, so possible you have to upgrade in the app.

Sorry, but you are doing this wrong. DIY mode doesn’t use eWeLink or ITEAD SSID. Its quite poorly documented IMO, but you can find out about it here https://github.com/itead/Sonoff_Devices_DIY_Tools/tree/master/other

You will note there are lots of issues on that repo too. For what it’s worth I stick with eWeLink mode even though you have to sniff the API key.

See instructions here https://pysonofflanr3.readthedocs.io/encryption.html

There are other ways to get the key, but with some devices there is no other way than to sniff.

There are lots of ways to sniff, the LAN, but none are trivial. It’s a whole topic in itself and without knowing your level of expertis, the operating system you are using and your network topology, I don’t think we should get into it here, but you can DM me if you want once you’ve had a google about!

Yes you need a API key per device

Is the API key changing after doing a factory reset to change the SSID?

No it doesn’t change

I want to sniff the API, that’s why I want tried to connect ITEAD***** SSID, but I can’t see this SSID.

If this is a problem with working in DIY mode, I suggest you ask it on the Itead repo I pointed to earlier.

If you are struggling to find the API key when in eWeLink mode, please refer to my link to encryption.md that I pointed to earlier. If you have an issue with that, please raise an issue on my repo.

Finally I have managed to get the API KEY from first Sonof Basic switch - FW:3.3.0.
I have used this method:
https://community.hubitat.com/t/sonoff-ewelink-via-homebridge-node/3753
with my wifes IphoneX and my Macbook as laptop.
I have enter the pairing procedure and when my Sonoff paired (again) i could see in Charles my apikey:


Then i have put this in configuration.yaml and my switch is now available in Home assistant and I can control it from there.
Edit: after few minutes Sonoff device get unresponsive:

and can’t control it from Home Assistant, strange…

Please raise issue on my repo.

I have:
https://github.com/mattsaxon/sonoff-lan-mode-homeassistant/issues/22#issue-556712755

I have success to get Sonoff APIKEY which is not so complicated:

  1. PC/ Laptop (both Win or MAC are just fine, even Linux machine - because main debugging proxy application that is used - Charles is available for all this OS.

  2. Mobile phone (Android / iOS) with eWeLink application installed and configured (registered)

  3. Configure Charles on PC/Mac/Linux as described here, steps 1- 6

  4. If your mobile device is iOS then follow steps from above link from step 7 - step 19

  5. If your mobile device is Android you only need to add manual proxy to WIFI network where your mobile phone is connected. Proxy host is the IP address of your computer where Charles is running and the port ist 8888. In my example, it was 192.168.0.35:8888

  6. On your computer, again go to the Proxy menu, choose SSL Proxy Settings… and check to box to enable us-ota.coolkit.cc:8080 or eu-ota.coolkit.cc:8080 respective of your geographic location and the click OK

  7. Start eWeLink application on your mobile phone.

  8. On your computer, you should see https://us-ota.coolkit.cc:8080 or https://eu-ota.coolkit.cc:8080 respectively, appear in the column on the left of the Charles application.

  9. Set the Sonoff device to pairing mode (press manual switch on the device for more then 7sec) - the green LED will start to blink

  10. On your mobile device in eWeLink go to + to add Device and choose Quick Pairing. Place mobile phone and Sonoff device as close to the router as possible

  11. When pairing is done you will see on the left column (window) in Charles new device appears with some IP address that fits your network (in my case it was 192.168.0.16). Click on it to expand child cards beneath and find device card.

  12. On the right side of Charles select Contents and you will se something like in this picture:

  13. Copy deviceid and apikey to your configuration.yaml file to use with Sonoff LAN Mode custom component.

This is just my small contribution how to use method described in above link with Android phone…

2 Likes

Thanks, I’ve added these instructions to my page too.

I’ve made a new screenshot just to be more clear how to get api key. I’m glad I can contribute to such great community…