SwitchBot gets an open API!

I like the KISS principal/ My curtain work as needed and I really didn't notice the open/ closed issue till I read it here. My curtain open and closed at a certain time and have been working without issue. Thanks for the app @tomw.

1 Like

I'm getting all sorts of strange behavior, but sadly not having the time to work through what's going on.

I think things might be getting confused on mine because switchbot treat 0% as open but Hubitat 0% is closed. In my mind, to make things brighter, you turn it up. So to make a curtain 'brighter' you open them 100%...but I guess they disagree.

Toms latest fix didn't quite work for me, as its just saying its open when its closed (and reverse), I don't need the status reversing...just the 0%-100% logic.

I think I might be in the minority, so not going to push for it anymore

Don't give up yet!

I haven't checked in a new version on GitHub in a long time, so I assume the new version you mentioned is the one I shared in PM.

When you get the time, please let me know in PM what you're seeing.

@tomw I've noticed in the Switchbot app that the curtain bots have a light sensor. Are the values of these Illuminance Sensors something that can bee taped into?

I looked at the debug prints you shared in our other debugging thread, and unfortunately the light/illuminance value isn't in the response from the API.

A couple of people requested it on the API space on GitHub but didn't get a response from SwitchBot.

1 Like

That is a shame. That would have increased the value of these curtain bots by a decent amount.

@tomw Here's what I did with my dashboard for my curtains. They didn't want to show the right state with just open and close command. I created some virtual buttons and programmed them to 1% open and 99% closed, plus I don't like having to use the dashboard pop-up to control them. Works well now.

1 Like

The chatter on this continues. It isn't looking good that lock/unlock will be supported, at least not in their current form. I'll continue to keep an eye on it: Smart lock not working anymore · Issue #121 · OpenWonderLabs/SwitchBotAPI · GitHub

1 Like

And from looking at the github, it doesn't mention any of the plugs - so I presume that means they're not supported yet?

Looks like the API supports both controls, and querying for power use.

Have a few plugs, willing to help with testing and debugging :slight_smile:

Thanks.

They just released v1.1 of the API, which adds back lock commands.

It will require some rework to my driver because they changed the authentication scheme.

I'll look at getting that working and will also take a stab at Plug Mini support for you to try @themcclure

5 Likes

I would be happy to try it out, thanks!
(I also have a contact sensor, still in the box)

Great news! If you need help testing let me know!

  • Shane

I have the v1.1 API implemented and ready for testing.

I am looking for a user of my SwitchBot Events app to test my upgrade instructions. Any volunteers?

Have you seen any way in the API to specify the length of time that a Bot will hold down a button? I can do it in the app but tried doing it using the SwitchBot pallet in Node Red dynamically but it wouldn't change what was setup statically in app.

No, there isn't a documented API entrypoint to adjust that setting.

TomW, mind if I give your new API a try for the two Plug Minis I received this weekend? I already have your contact sensor setup working well, but now want to add my new plugs in.
Thanks!

I haven't added plug minis yet. I need some debug info first.

Will you please PM the 'devices' entry from your State Variables? It should include info about your plugs as a starting point.

For the bots is there a way to know if they are in an on or off position? I know it's just a push, but I would like to run an automation if no motion and the bot isn't in on position push the bot button.

Not sure how to do this if the bot is only push?

I don't believe you can. What I had to do to know about he status is plug my devices into a smart plug. Than using rule machine I created a rule that when the plug turns on the bot activates and vice versa. The off portion probably isn't necessary but I wanted plug state change to equal 1 bot push.

I just posted v0.9.14, which has support for the v1.1 API. This should restore functionality for the Smart Lock. I would appreciate someone validating this, because I do not have a lock.


In order to use the new API version, you have to supply a secret key that is supplied from the newest version of the SwitchBot mobile app. You may need to update your SwitchBot mobile app to get this additional info.

My SwitchBot System driver treats this as an optional preferences input, and it will automatically revert to using v1.0 of the API if it is not supplied. So, I recommend that all users update via HPM.


SwitchBot has said that they will no longer add new functionality in the v1.0 API, so I will focus on new functionality provided by the v1.1 API for all future updates to my Hubitat integration.

3 Likes