SwitchBot gets an open API!

6.14 is the required minimum version. You have to tap App Version in the app ~10 times to get the developer options to show up, and then you'll see the token and secret key there.

2 Likes

I've had "Live Logs" window open whilst adding Switchbot events.
Unfortunately, there is no details on the failure.
I am currently running Hubitat beta 2.3.3.117.

Your screenshot shows that the main app page was loaded. When did it actually fail? Was it when you clicked Done?

It works for me in the release version of 2.3.2.x. Does it work for you in that version?

I'll need to find a way to reproduce the issue and get Logs, else I don't know how to even begin debugging it.

Yes, it fails when I click done.

Which version of my SwitchBot System driver and SwitchBot Events app do you have? Just check the revision history in the two source files on your system.

This ended up being a bug in Hubitat 2.3.3.

@gopher.ny fixed it in 2.3.3.122: Release 2.3.3 Available - #3 by gopher.ny

@iEnam, please try the new version again of my SwitchBot Events app. Just uninstall your current version from Apps first.

1 Like

It's working now!
Thanks

1 Like

It has a switchbot hub mini and curtains.
Switchbot system, curtain, and switchbot event were installed with HPM.
I received tokens and secret keys from the switchbot app and input them into the switchbot system device, but an authentication error occurs.
It was the same even if you regenerated the token and entered it.
The app version is 6.14.
What did I do wrong?


Everything looks correct to me, assuming the token and key are the most up-to-date version you have pulled from your SwitchBot app. I sent you a PM with some ideas to troubleshoot further.

Thank you for your answer.
The Switchbot Hub Mini has two Switchbot curtains connected and the cloud service is also on.
I tried initializing the hub mini and reinstalling the app, but it's frustrating because it doesn't work.

I did as I said, but it's the same.
Is the switchbot token value a problem?

I'll write down the method I installed again.

  1. Install hub mini and curtain on switchbot application.
  2. Connecting the Switch Curtain Cloud Service
  3. Tap the app version continuously to receive the token value
  4. Add hubitat driver code and install virtual device (switchbot system)
  5. Enter token value into switchbot system device



Both of your configuration examples look correct to me, and the fact that it falls with both v1.0 and v1.1 authentication methods (using both the old and recently updated version of my driver for Hubitat) makes me wonder whether there's an issue with your SwitchBot account for some reason.

Some users reported authentication errors that showed up randomly and were resolved by rebooting their SwitchBot hubs. Please give that a try if you haven't already.

Otherwise, you may need to contact SwitchBot to ask for any help getting this resolved with your account. Sorry that I don't have other suggestions, but it looks like you are doing everything correctly and it just isn't working for some reason.

Looks like I'm getting hit with this issue as well.. I'll try rebooting their hubs, etc. Can't even get an api key from their app.

Update, it wasn't the hubs.. I'll give it some time maybe their API is down right now. I get a "Failed to load, please try again later" When opening the developer options in the app, or tapping on the "Get Token" button.

I was able to pull a new token and key just now. Maybe give it another try?

1 Like

Yeah I did, no luck.. I opened a support ticket.

I proceeded yesterday because there was a mini update of Switchbot Hub.
And when I received a new token and secret key and entered it, the authentication was completed.
I don't know why it was suddenly authentication.
What's certain is that I updated the Switchbot Hub Mini and it worked.

I wrote a reply because I thought it might help someone.

2 Likes

Thank you for the update. It seems like the SwitchBot cloud has been having issues based on what you and @NerdShowAndTell have been experiencing. Hopefully they are all resolved now.

So I kept having these API disconnect issues off and on for the past few days and finally got a chance to troubleshoot. I thought to myself, I bet it's hitting the API request limit.. Sure enough.. Checked the logs

"resp.data = [statusCode:190, body:[:], message:Requests reached the daily limit]"

I had the default of 300 seconds polling set, so I doubled that to 600 to see if this resolves the issues, and I'll then see what effect this has on my automations.

Good catch! They claim a limit of 10,000 interactions per day.

The polled refresh should make about 1 request per device. Any commands you send to the device make at least 2 requests (one for the command, one to refresh). The curtain driver tended to use a lot of requests due to trying to update its status while it was moving, though I have a stripped down version of that pending that should reduce its usage.

My point in all of that was that it should take a lot of polled refreshes to hit the limit, unless you have a ton of devices or maybe if you are using device commands fairly often in your automations.

What kind of devices do you have, and how many of each are there? Are you using my SwitchBot Events app to get real-time events? You could experiment with dialing the polling even farther down to see if the events are giving you the attribute updates that you need.

Hey @tomw , first I have to say, I was using v1.0 for my Switchbot curtains for quite a while, want to say about a year? and your app made having Switchbot worthwhile. THANK YOU.

That said, I had all sorts of problems with the app and Switchbot support finally sent me a sideload 6.16, which took a while, but then provided me the secret key in addition to my token.

But now, only after upgrading, am I getting the API request limit. Like immediately after. Screenshot below.

That said, I've noticed in my device page the same thing I've seen above with other folks having trouble with the 1.1 version; the state variables -- which used to have half a screen of information -- are now empty, screenshot below.

Any advice to troubleshoot from my side?

1 Like