Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Encryption support (which will support for non DIY switches with firmware v3+) #3

Closed
mattsaxon opened this issue May 8, 2019 · 12 comments

Comments

@mattsaxon
Copy link

Thanks for the implementation, it runs for me now. However the code is not discovering any devices on my LAN.

I appreciate I don't have an R3 device, but it looks like the new 3.0.x firmware that I have downloaded to my S26 device implements exactly the interface described in the PDF in this repo.

However the mDNS.py file specifically filters by type = 'diy_plug', the type reported by S26 is just 'plug'.

When I change this in the code, I get a failure due to the code in this repository not having encryption implemented.

What are the plans for this code to support other devices at latest firmware and/or to support encryption?

@martin3000
Copy link

martin3000 commented May 8, 2019

if I run mdns-scan, I don't see my r2 sonoff with firmware 3.1!?

@ZZLinvec
Copy link
Contributor

ZZLinvec commented May 9, 2019

In DIY mode, the device has no encrypted information.

We haven't had a plan to support encryption for nearly a month.

Currently, this tool only supports Basic R3, RFR3 and mini.

I'm so sorry!Neither S26 nor r2 supports the DIY model.

@mattsaxon
Copy link
Author

@ZZLinvec, would you consider accepting pull requests from outside ITEAD that add encryption support to the existing code base? I have a working prototype based on PyCryptodome

@mattsaxon
Copy link
Author

mattsaxon commented May 9, 2019

@martin3000, mine is visible in mdns, i have blocked by device from accessing the Internet, so that could be the reason? My firmware is 3.0.1.

To be clear, it is NOT visible in the tool in this repo at present.

@ZZLinvec
Copy link
Contributor

ZZLinvec commented May 9, 2019

@mattsaxon Thank you very much. Your suggestion is very good.We just don't have any plans to add encryption right now.You can tell me about your library connection, and if we use encryption in the future, we will prioritize it.

@mattsaxon
Copy link
Author

I have created a minimal commit here in my forked repo. I appreciate this is not ready for merging by some stretch, but I wanted others to be aware I was working on this.

If you insert your API key in the code, the UI works to report the status of my S26 device with firmware 3.0.1

@peterbuga, are you interested in collaborating on this as I see you have forked the repo too?

@mattsaxon mattsaxon changed the title Encryption support? Feature Request: Encryption support (which will support for non DIY switches with firmware v3+) May 10, 2019
@peterbuga
Copy link

@mattsaxon thanks for the proposal but after I've spent enough time trying to reverse engineer the sonoff devices I've seen the bad part of it and I prefer to keep out of any official implementation. any changes that I might do to this fork I'll solely keep it that way and no future PRs.

@hdjweb
Copy link

hdjweb commented May 28, 2019

So peterbuga have you abandoned the project of your wonderful custom component???? No please help us with your wonderful project.

@gambalaya
Copy link

@mattsaxon - I was pleasantly surprised to discover that your forked repo version with encryption support successfully finds and faithfully reports status on my non-DIY 4ch Pro with firmware 3.0.1 (with tweaks to accommodate the longer status by concatenating data1 + data2 + data3 payloads, retrieving only the first subkey of switches (plural), and adding type of 'strip' to the mdns search types). However it ignores any control commands, even though it returns success status. Were you able to open/close your S26 with your forked version? I can see my 4ch Pro is actually reading the /switch control command because it returns 0, whereas sending to /switches (as an experiment) returns error 400. I guess the control API's of my 4ch Pro are just dummy placeholders - so close!
@ZZLinvec - nice to see this tool, and here's another vote for supporting non-DIY switches one day (even though there are no current plans to do so).

@mattsaxon
Copy link
Author

Yes, the S26 works well with this. I think the switch command is different for multi-channels. I don't own one so can't work this through, but I suspect you would be able to trace your network whilst running eWeLink to work out the correct JSON format for multi-channel switches.

@gambalaya
Copy link

@mattsaxon, thanks for the confirmation on S26. I now realize the eWeLink app itself doesn't seem to find the 4ch Pro in LAN mode (even though your tweaked tool clearly does, and the Pro is in double-blinking mode etc). The iPhone app says connecting to 0 devices in LAN mode and grey's out the device when it is blocked from the internet. An iTead support article mentions S26 supports LAN mode but 4ch Pro doesn't. I think I will park any further investigation until there is more clear support from iTead for the Pro. Great work, and I am still surprised the tool communicates with the Pro at all given the above!

@mattsaxon
Copy link
Author

For V3 firmware, the 'found x devices in LAN mode' should not be trusted, this is only referring to pre V3 firmware's found! You can tell if it is in LAN mode for V3+ by looking at the icon of the device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants