Switch-Bot API integration

I have created a new add-on using the SwitchBotAPI and have released it.
Please refer to the following topic for more details.

Additionally, I will share what I discovered during development.
While not documented in the API specifications,
I have found commands to operate default buttons of automatically detected or list-selected virtual infrared remote devices.
The command type is “tag”.

  • Example payload for preset commands
    {"commandType":"command","command": "turnOn","parameter": "default"}
    {"commandType":"command","command":"setPosition","parameter":"0,ff,70"}

  • Example payload for custom commands:
    {"commandType":"customize","command": "MyButtonName","parameter": "default"}

  • Example payload for tag commands
    {"commandType":"tag","command": "1","parameter": "default"}

Based on a limited range of testing, it seems that the buttons are assigned sequentially from the top left of the screen, with smaller numbers assigned first.

1 Like

Does anyone have API version 1.0 working with a recent version of Home Assistant like 2023.8? I got a message when I upgraded saying:

The switchbot integration does not support YAML configuration

How can I configure it then via some automated method? Don’t the Home Assistant developers understand that if you integrate a 100 services that you can’t do that manually anymore?

I have over 53 switchbot devices.

Is anything known about how long API version 1.0 will still work? I configured it with the understanding that it would work “forever”. Is there an alternative to Switchbot temperature sensors that will continue to work?

Update: actually, I am thinking that perhaps the Home Assistant Switchbot integration is completely independent of these REST-calls. As such, I should just be able to not install the integration and the error would go away. It has been a long time ago that I set it up. Can someone acknowledge that please?

I wouldn’t mind porting my configuration to the 1.1 API if that has some real benefits. All I care about is the temperature value right now.

The Switch Bot native integration uses Bluetooth, not the API.

If you have rest sensors to get temperature from your switch bot meters and this solution is OK for you, there is no need for the native integration.
Personally I have switched to the native integration with a Bluetooth dongle and an ESP32 Bluetooth proxy, when this topic was created meters was not compatible with the native integration which used YAML.

I haven’t found a Bluetooth device that doesn’t scream in dmesg all day long how it doesn’t work. Which one are you using? I bought the “best” that Amazon had a year ago or so.

(I also tried the ESP32 Bluetooth proxy, but not all sensors are reachable.)

For the ESP32 bluetooth proxy if you use a Wifi ESp32 you might use two, in my case I have only one and this Bluetooth dongle.
It is listed as one which has best performance in the Bluetooth integration documentation.

I made a pull requests to add API support for plugs and remotes as switches.

3 Likes

Nice to see your PR has been merged, congrats @SeraphicRav!

1 Like

Thanks ! The first version is quite basic, it only allows to turn on/off plugs and remotes configured in hubs.,

Still wondering what I should implement next.

1 Like

How could I test this integration? The possibility of creating a media player for each device added to SwitchBot (in my case TV and amplifier) would already be sufficient for me. With broadlink I was able to do this with “SmartIR” and for me it’s great

I think it will be available in the next release in October.

For now, it only handles on/off for remotes.

I tried to integrate Switchbot and it tells me it can’t find anything connected to Bluetooth. I was trying to connect the hub with IR but I couldn’t. Even on off it would have been enough for me

Sorry, I meant the new integration Switchbot Cloud which should be released next October will support only on/off by infrared.

The current integration for Switchbot will be renamed Switchbot Bluetooth during that release.

1 Like

Thank you for the SwitchBot cloud integration. Am I right to say that this integration only supports remote and hub, and won’t be able to work with other devices like curtain bots yet?

The documentation here SwitchBot Cloud - Home Assistant seem to suggest everything will work, so it was a bit misleading. I was confused and thought there was a bug until I looked at the PR and realized it isn’t a full support yet.

1 Like

Yes for now it supports only supports plugs and remotes through hubs.
I am currently working on a better support for the remote feature. Will probably extend to the vacuum cleaner and camera (if the api is available).

For already supported Bluetooth devices, I am not planning yet for support but maybe another developper will add them.

1 Like

So, is there any IR blaster support coming? Or what do you mean by remotes?

This device is the remote:

Oh, I see, I understand the confusion now.

I meant IR appliances in the SwitchBot app which can be controlled by the different hubs.

1 Like

I will add more commands for the IR appliances as it is only on/off for now.

Thanks for the confirmation. Then the documentation should be updated to reflect that it is for the IR part.

The best would be if custom commands could be sent from the hubs, like the Broadlink integration allows it.

And as I remember from another post, it is capable to do that through the cloud API.

1 Like

Yeah. I am working on it.
From my understanding, there are 3 groups of commands:

  • Those recognized by both the app and by default by the api (working on them now)
  • Those recognized by the app and and probably custom command for the api, I am still looking for how to call them and make it easy to use
  • Those added to the app as custom button and custom command for the api. If possible, I need to find a way to get the list of custom commands or an easy way to add them in Home Assistant

Some hint on this, if you haven’t came across it yet:

And to call custom commands. You can add service like Broadlink has:

1 Like