``/v1.0/devices/`` endpoint - device list functionality errored
Analysis
Suddenly I can't get a list of devices at https://api.switch-bot.com/v1.0/devices/ - I have had an existing piece of software using this endpoint fine for over a month and suddenly it just sends this, killing my ability to pull dynamic data. I am still able to use the same endpoint with the device id to get that sensors' data, but dynamically grabbing that data via a device list is no-longer possible.
{
"statusCode": 190,
"body": { },
"message": "Cannot read properties of undefined (reading 'device_type')"
}
Expected Behavior
Provides a list of devices in json format
Steps To Reproduce
Visit https://api.switch-bot.com/v1.0/devices/ with your valid Authorization header.
Logs
{'statusCode': 190, 'body': {}, 'message': "Cannot read properties of undefined (reading 'device_type')"}
Configuration
N/A
Environment
Issue also possible in browser, unrelated to any of the below.
- OS: Ubuntu 20.04
- Software: Python
- Node: v12.22.9
- npm: 8.5.1
Additional Context
I believe this is an issue on the API side, likely caused by a misconfiguration. Unless somehow the endpoint was recently deprecated.
I have manually worked around this endpoint not working by manually defining all the IDs and Names of my sensors in my code and hitting https://api.switch-bot.com/v1.0/devices/{device_id}/status directly, rather than grabbing a list of devices and picking them out by name to get the data. I hope this is fixed soon, but my code can continue to run for now, thankfully.
@ThatProgrammerr have you tried using version 1.1 of the API?
https://api.switch-bot.com/v1.0/devices/
@ThatProgrammerr have you tried using version 1.1 of the API?
My key from the Switchbot app doesn't work on the 1.1 api.
https://api.switch-bot.com/v1.0/devices/
@ThatProgrammerr have you tried using version 1.1 of the API?
My key from the Switchbot app doesn't work on the 1.1 api.
Have you tried regenerating it?
Sounds like something you have to reach out to Switchbot Support on.
found similar issue. Working fine for over a year then an error Tried to regenerate a new token, using that with v1.0 API I get the 190 error when listing devices. When trying with the 1.1 API I get unauthorized.
The token is right though, if I change the last digit then v1.0 API also says unauthorized. So its the right token. Weird, hopefully fix itself in the next few days. Surprised there is so little noise about it. I only have original lock and virtual infrared remote buttons setup.
This still appears to be down. I'm still using my workaround. Oddly enough, it seems like the Switchbot Cloud integration for Home Assistant - unsure how - manages to bypass this endpoint and still retrieve a device list. I can only assume using some other endpoint.
https://api.switch-bot.com/v1.0/devices/
@ThatProgrammerr have you tried using version 1.1 of the API?
My key from the Switchbot app doesn't work on the 1.1 api.
Turns out I was mistaken when I said this. I was only trying to use the 1.1 endpoint with my web browser and the auth header, as was previously possible. It seems adjusting my current code to use the 1.1 endpoint does resolve the issue. So that explains how the cloud addon for HA works. I will likely hold a cache of my device ids in case this endpoint dies again and save it to a file to avoid losing cache in the event I restart the program. I'm not aware how long 1.1 has been out, but it would have been nice to get some notice that 1.0 was going to be crippled a little bit.
Hi! I've the same problem for my application. Is there another way to get a device id? I did not find it in app.
Can someone please confirm if this is still open? I am unable to get a list of my devices esp. the device IDs using v1.0 as well as v1.1.
It was working before with another Switchbot installation using API v1.1, but now I constantly get authorization errors. I already regenerated the token, but the problem persists. I also waited a day to ensure I am not hitting the request limit, but that didn't help either.
Is there anyone who can at least confirm that /v1.0/devices or v1.1/devices is working for them?