SwitchBot gets an open API!

Thank you! Glad to be able to help out :grinning:

1 Like

Not exactly a question for this app exactly but has anybody been able to get their Switchbot Humidifier setup? The switchbot app found it once, errored out, and now can't find the damn thing again.

update: I got it to connect. Not exactly sure what happened but the app either errored or did connect by Bluetooth but it advanced to entering wifi info. It still didn't work until it timed out and the light went from flashing blue to solid yellow. Anyways it may have just been brute force and trying hundreds of times.

@tomw Can you check the code for the humidifier temperature type. It displays as Celsius no matter what is selected.

That's odd- please PM me logs from my driver and SwitchBot Events app (if you're using it) so I can see what the API and events are sending back.

I am sorry but I have no clue how to do that. I looked at the logs for the hub and it shows Celsius there. I did come across a much bigger problem though. The slider function to adjust the output is sending crazy amounts of API requests. Some sort of delay needs to be introduced I think to stay under the limit. I wouldn't think the slider is even needed since the unit only supports low, medium,high in their own app even if it can report the exact % on the slider.

Which slider? Is this on a dashboard? You might be the first person to use the Humidifer driver, so I haven't been able to see issues like this that actually show up.

Please send some screenshots and info on how you're using it (PM may be easier to cut down noise in this thread and in case you want to share any personal info).

As far as Logs go, you can just enable logging on the virtual device and in my SwitchBot Events app (if you're using it). Then wait a little while and then go to the Logs window and Past Logs, then filter to the virtual device and to the app and share that also in PM.

@tomw,

I have three bots; two in “switch mode” which are working fine and reporting correct switch status.

However, the bot in “press mode” is also working but it does not change the status of the switch i.e. it always reads “on” even when off is pressed.

As a work around for this bot, I have used the old driver from toffeehoff and this seems to be showing the correct switch status for the bot.

Would be great if you can see what the issue is, using API v1.1, thanks.

I don't have a Bot anymore, but I'm sure we can figure something out if you can help me with some log prints.

What is the behavior in "press mode"? Is it basically a toggle, as in pressing it just inverts the state each time (on/off/on)?

Will you please PM me logs from both the SwitchBot Bot driver and the SwitchBot Events app? Just press the button a few times using my driver. Be sure to enable debug logging on both the device and app page.

1 Like

This works great !
I have also managed to integrate it to HomeKit using a Virtual Shade Device and a rule so now i have vocal command for my curtains.
I think that is enough for every day use. I will try to pass the Position Attribute to HomeKit as well.

1 Like

I am totally new at setting up my HE7. I was able to get my ZigBee devices (mostly Sengled lights) on my hub with no problem. I am running into problems with my switchbot devices (hub, motion sensor, contact sensor, strip light, bot). I have come across your driver which contains Drivers Codes for my items. I added the drivers codes for all the items. I got a token from the switchbot app (don't know where to use it) I made a virtual device but I may be missing inputting some info (I did put in the BLE address of one of my bots and nothing worked when I tried to press the virtual button.) I am lost with how to get the devices recognized so they can be used. I am sorry if this is all over the place, but my brain is going crazy because I feel this is over my head. I'd love a step by step tutorial. Thanks for any help!

Check out the readme in my GitHub repo: SwitchBot gets an open API! - #17 by tomw

It's fairly close to a step-by-step. Of particular note, you only create a SwitchBot System device manually (which is where you enter your token and other info). The others are then created automatically.

Please give it a shot with the readme as a reference, and let me know if you still run into issues.

What Device do I use to get the network ID for the Switchbot System?

I don't understand your question. Can you explain what you are trying to do with the network ID? Which ID are you referring to?

When creating my virtual device "Switchbot System, under device information, it asks for a Device Network ID. I went into Switchbot and got the WIFI ID from my Switchbot hub. I entered in my token and secret code and a list of my devices was populated. I went into my apps and downloaded "Rule Machine". I try to do a simple Trigger "Motion Sensor" Turn off "Specific Bulb" but nothing happens.

That device network ID will get set automatically, so you can just leave it as its default value.

Will you please post a screenshot of your Rule Machine rule so that I can see what you are trying to do?

If you try to control that same bulb from its device page directly, does it work?

Is the motion sensor a SwitchBot sensor? Does its status appear correctly on its device page directly? Did you install and configure my SwitchBot Events app? You need it for real time events on the motion and contact sensors (among other devices).

Network ID : Thank you, leaving it as default.

I am attaching a photo of my rule from rule Machine.

I can control the bulb from its device page directly. It works quite quickly.

The motion sensor is a Switchbot Sensor. I have to hit the refresh button for the status to appear accurately. If I hit initialize or refresh, the light turns on. It will not turn on when the motion is detected in the Switchbot app.

And then you asked about the switchbot events app. I had the app code but not the app. As soon as I installed that, all is working now. Thank you for your help, you really lifted a weight of the shoulder of this new hubitat owner.

1 Like

Awesome! Welcome to Hubitat. Let me know if you have any other questions.

I am wondering if there is going to be a driver for the Switchbot Blind Tilt?

Is that device still in early access or beta status? They haven't updated the API documentation to include it, but I will add a driver once they do.

Oh, you are correct. I was a beta tester and just assumed it was out already. Thank you for creating the driver:-) When it does come out.

1 Like