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

422 When Sending State Change #218

Open
animaxcg opened this issue Dec 11, 2020 · 2 comments
Open

422 When Sending State Change #218

animaxcg opened this issue Dec 11, 2020 · 2 comments

Comments

@animaxcg
Copy link

  • pySonoffLAN version: v1.1.2,v1.1.3,v1.1.4
  • Python version: 3.9, 3.7
  • Operating System: Mac OS X, raspbian

Description

I know this is unsupported now but I am getting 422 when trying to set state

What I Did

pysonofflanr3 --host someip --device_id id --api_key wouldnt_u_like_to_know -l DEBUG state
returns state
pysonofflanr3 --host someip --device_id id --api_key wouldnt_u_like_to_know -l DEBUG on
2020-12-11 00:10:55,765 - warning: error received: id, b'{"seq":37,"sequence":"1607667055588","error":422}'

looking at http://developers.sonoff.tech/sonoff-diy-mode-api-protocol.html I see that - 422: The operation failed and the request parameters are invalid. For example, the device does not support setting specific device information. this is a TH16 with firmware 3.4.1

I even modified the code to make sure the data was being sent correctly by passing the data from format_encryption_msg to decrypt and getting the unencrypted byte data that was passed into encrypt. Does this just mean that the TH16 on 3.4.1 isn't supported? Should I try to set up home assistant and sniff my traffic to see if it is the device or this api? That seems like a ton of work

@dauheeIRL
Copy link

dauheeIRL commented Dec 30, 2020

Hi, what results do you get when you run discover? Also can you look at mDNS output (i.e. use bonjour browser or similar application) and see what TH16 presents. Just looking at type field is normally "plug". I forked this project recently to pass outlet to the cli, as outlet is required for multi-gang wall switch (TX3C) which is "strip" type which luckily was handled by the code already, just not with the cli. I would guess the TH16 is different hence the error you get

@dauheeIRL
Copy link

you can see pull request here - someone has already put in on/off support for TH16 #151

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

2 participants