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

API PUT/POST not functioning since 2.9.0 upgrade #1189

Closed
1 of 3 tasks
kiwi-cam opened this issue May 12, 2024 · 2 comments · Fixed by #1192
Closed
1 of 3 tasks

API PUT/POST not functioning since 2.9.0 upgrade #1189

kiwi-cam opened this issue May 12, 2024 · 2 comments · Fixed by #1192

Comments

@kiwi-cam
Copy link
Contributor

Describe the bug

It might be related to the authentication changes, but I've got the GET requests working fine and can replicate the issue in CURL. When using a POST request to set a value the response is the current value and the state does not update.

When running 2.8.3 I get this using CURL:

pi@ScryptedPi:/var/lib/docker-wyze-bridge $ sudo docker compose up -d
[+] Running 2/2
 ✔ Network docker-wyze-bridge_default  Created                                                                                                                                 0.2s
 ✔ Container wyze-bridge               Started                                                                                                                                 0.9s
pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl http://localhost:5000/api/kitchen-cam/power
{"response":{"pid":"P3","ts":1715556721000,"value":"1"},"status":"success","value":"on"}
pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl -H "Content-Type: application/json" -X POST -d '{"value":"off"}' http://localhost:5000/api/kitchen-cam/power
{"response":2,"status":"success","value":"off"}
pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl -H "Content-Type: application/json" -X POST -d '{"value":"on"}' http://localhost:5000/api/kitchen-cam/power
{"response":2,"status":"success","value":"on"}
pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl http://localhost:5000/api/kitchen-cam/power
{"response":{"pid":"P3","ts":1715556819000,"value":"1"},"status":"success","value":"on"}

Note that when I post data with off, the response is off, and the opposite with on - as expected.

With v2.9.0:

pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl http://localhost:5000/api/kitchen-cam/power
{"error":"Unauthorized"}
pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl http://localhost:5000/api/kitchen-cam/power?api=<apikey>
{"response":{"pid":"P3","ts":1715556819000,"value":"1"},"status":"success","value":"on"}
pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl -H "Content-Type: application/json" -X POST -d '{"value":"off"}' http://localhost:5000/api/kitchen-cam/power?api=<apikey>
{"response":{"pid":"P3","ts":1715556819000,"value":"1"},"status":"success","value":"on"}
pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl http://localhost:5000/api/kitchen-cam/power?api=<apikey>
{"response":{"pid":"P3","ts":1715556819000,"value":"1"},"status":"success","value":"on"}
pi@ScryptedPi:/var/lib/docker-wyze-bridge $ curl -H "Content-Type: application/json" -X POST -d '{"value":"off"}' http://localhost:5000/api/kitchen-cam/power?api=<apikey>
{"response":{"pid":"P3","ts":1715556819000,"value":"1"},"status":"success","value":"on"}

Now I post "value":"off" and the response is the current state: "value":"on", and the state does not change.

Environment (if applicable)

  • Affected Camera(s): v2 and v3
  • Affected Camera Firmware: latest
  • Affected Bridge Version: 2.9.0
  • Bridge type:
    • Docker Compose/Docker Run
    • Home Assistant
    • Other
@mrlt8
Copy link
Owner

mrlt8 commented May 13, 2024

Thank you for the heads up! Should be fixed in the dev branch and also work with an api header

-H "api: WxDAAFB8k0jBocpTR_j841ZkxvS9jmJ1F80wZcgq" 

@kiwi-cam
Copy link
Contributor Author

Thanks @mrlt8. I've switched back to the dev build and can confirm my API calls are now working again - using the API key.

@mrlt8 mrlt8 linked a pull request May 13, 2024 that will close this issue
mrlt8 added a commit that referenced this issue May 13, 2024
* unpack k10050 response #1185

* add back bitrate check for HL_CFL2 #1112

* Ignore api request value and add api header #1189

* changelog
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

Successfully merging a pull request may close this issue.

2 participants