Skip to content

Conversation

@AviPaperno
Copy link

Fixed error with get_devices()

It returned Error 400

Fixed error with get_devices()

It returned Error 400
@VDigitall
Copy link
Contributor

I checked a few minutes ago and version in master branch works for me, this pr is redundant.

@muhannad17
Copy link

Actually I had the same problem as (Snusmumrick), I managed to get it fixed by adding GET Parameters to the (api/user/device) Request ( find attached code ).

And the commit is necessary for the app to get the devices list. Maybe the api response is country dependant !

sonoff.txt

@ndg63276
Copy link

ndg63276 commented May 8, 2020

In my testing I found that, when getting the list of devices, by sending params to /api/user/device:

  • If you send a 'version' parameter, you get sent back a dict, and your devices are in r.json()['devices']
  • If you don't send a 'version' parameter, you just get the list of devices as r.json()

So be careful and consistent.

This PR is pretty ugly though, URL parameters should be sent using the params keyword in requests.get(), not just appending to the URL.

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 this pull request may close these issues.

4 participants