# Switchbot

**URL:** <https://community.openhab.org/t/switchbot/73197>\
**Category:** Home Automation\
**Created:** [April 26, 2019, 6:54am UTC](https://community.openhab.org/t/switchbot/73197 "2019-04-26T06:54:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mortommy](https://community.openhab.org/user_avatar/community.openhab.org/mortommy/32/11959_2.png) [@mortommy](https://community.openhab.org/u/mortommy)\
**Post date:** [April 26, 2019, 6:54am UTC](https://community.openhab.org/t/switchbot/73197/1 "2019-04-26T06:54:40Z")

</div>

I’m interested in this [product](https://www.switch-bot.com/), they use an open Bluetooth API and I got this [link](https://github.com/OpenWonderLabs/python-host) from the team. Could be the starting of new binding?

---

<div class="post-metadata">

**Author:** ![BrutalBirdie](https://community.openhab.org/user_avatar/community.openhab.org/brutalbirdie/32/47907_2.png) [@BrutalBirdie](https://community.openhab.org/u/BrutalBirdie)\
**Post date:** [April 26, 2019, 7:59am UTC](https://community.openhab.org/t/switchbot/73197/2 "2019-04-26T07:59:24Z")

</div>

Ah! 100$ for a device with a little motor and a plastic handle which can communicate via Wifi and BLE.  
An [ESP32-WROOM-32](https://www.mouser.de/ProductDetail/Espressif-Systems/ESP32-WROOM-32?qs=sGAEpiMZZMu3sxpa5v1qrlicty8cYJkOwWGOmn8CP2I%3D) can do the same communication and it costs around 3,40€

My friend “hacked” his Coffee machine which looks like a Borg now, not beautiful but it works. No manual switch.  
Also the use cases displayed on their site, toggling a switch with a manual wifi switch?  
Why not install for example a [Sonoff Touch](https://de.aliexpress.com/item/New-Original-Sonoff-Touch-Luxury-Glass-Panel-Touch-LED-Light-Switch-Smat-Home-Remote-Control-Wifi/32755618103.html)?

The " Learn from your original remote control." sounds interesting, but even this feature already exists.

---

<div class="post-metadata">

**Author:** ![mortommy](https://community.openhab.org/user_avatar/community.openhab.org/mortommy/32/11959_2.png) [@mortommy](https://community.openhab.org/u/mortommy)\
**Post date:** [April 26, 2019, 8:10am UTC](https://community.openhab.org/t/switchbot/73197/3 "2019-04-26T08:10:30Z")

</div>

A single switch already manageable via BLE, with no need of an hub, costs $29.

---

<div class="post-metadata">

**Author:** ![BrutalBirdie](https://community.openhab.org/user_avatar/community.openhab.org/brutalbirdie/32/47907_2.png) [@BrutalBirdie](https://community.openhab.org/u/BrutalBirdie)\
**Post date:** [April 26, 2019, 8:12am UTC](https://community.openhab.org/t/switchbot/73197/4 "2019-04-26T08:12:52Z")

</div>

> [@mortommy](#):
>
> A single switch already manageable via BLE, with no need of an hub, costs $29.

Maybe you can enlighten me with a use case of yours 😕  
When is it useful to attach an extra switch, to a switch?

---

<div class="post-metadata">

**Author:** ![mortommy](https://community.openhab.org/user_avatar/community.openhab.org/mortommy/32/11959_2.png) [@mortommy](https://community.openhab.org/u/mortommy)\
**Post date:** [April 26, 2019, 8:29am UTC](https://community.openhab.org/t/switchbot/73197/5 "2019-04-26T08:29:56Z")

</div>

Maybe I was misunderstood, I’m not advertising the product, I think, since it’s a smart device with API, could be nice to have an integration in openHAB.

---

<div class="post-metadata">

**Author:** ![BrutalBirdie](https://community.openhab.org/user_avatar/community.openhab.org/brutalbirdie/32/47907_2.png) [@BrutalBirdie](https://community.openhab.org/u/BrutalBirdie)\
**Post date:** [April 26, 2019, 8:35am UTC](https://community.openhab.org/t/switchbot/73197/6 "2019-04-26T08:35:53Z")

</div>

> [@mortommy](#):
>
> Maybe I was misunderstood, I’m not advertising the product,

I did not think that 🙂 I am just interested when this can be useful.  
Maybe if you have a Device with a switch which can not be opened?

---

<div class="post-metadata">

**Author:** ![mortommy](https://community.openhab.org/user_avatar/community.openhab.org/mortommy/32/11959_2.png) [@mortommy](https://community.openhab.org/u/mortommy)\
**Post date:** [April 26, 2019, 8:42am UTC](https://community.openhab.org/t/switchbot/73197/7 "2019-04-26T08:42:47Z")

</div>

That can be a use case, or to activate/deactivate device with push button (fans, rice cookers, coffee machines, wall panel controls, etc.) have a look at [these](https://images-na.ssl-images-amazon.com/images/I/81a0-fUPTnL._SL1500_.jpg) examples.

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [April 26, 2019, 9:39am UTC](https://community.openhab.org/t/switchbot/73197/8 "2019-04-26T09:39:19Z")

</div>

Not everyone is competent to open up and interfere with electrical devices, and a few of them even realize that.

See also

> [@Interesting little gadgets](https://community.openhab.org/t/interesting-little-gadgets/53884/2):
>
> Ahaha! Wonderful. I know they’re trying to be all professional, but the button-pressing version REALLY needs a rubber finger option.

---

<div class="post-metadata">

**Author:** ![BrutalBirdie](https://community.openhab.org/user_avatar/community.openhab.org/brutalbirdie/32/47907_2.png) [@BrutalBirdie](https://community.openhab.org/u/BrutalBirdie)\
**Post date:** [April 26, 2019, 9:46am UTC](https://community.openhab.org/t/switchbot/73197/9 "2019-04-26T09:46:21Z")

</div>

I like the rubber thumb idea 😁

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [April 26, 2019, 5:58pm UTC](https://community.openhab.org/t/switchbot/73197/10 "2019-04-26T17:58:35Z")

</div>

> [@rossko57](#):
>
> and a few of them even realize that.

This made my day! 🤣

> [@BrutalBirdie](#):
>
> Maybe you can enlighten me with a use case of yours 😕

I can give you one. I have a very expensive Bose BT speaker. It sounds great and I’m not willing to spend the money it would cost to replace it with something that sounds as good.

However, it has one flaw from an automation perspective. It will turn itself off if there is no sound played through it for 20 minutes and requires one to manually press the button to turn it back on. Some users have hacked together something to play an inaudible sound through the speaker periodically to keep it on but Bose warns that the battery may overheat and cause a fire. 😠 I was given this speaker as a gift before I was into home automation so had no idea to look for this seemingly simple feature.

I’m not going to open up the case and solder a relay to the on/off button. The looks and portability of the speaker are important. Having a little servo to physically push the button in a nice little package like this would be awesome! The communication is in my experience the easy part of the problem. It’s the power, motor, and creating a nice case that is the biggest challenge and this device gives them all to me for $30 (you don’t need the hub with their python script).

Anyway, because this is written in Python it will be of limited use in setting up an OH binding. It also seems to only work on Linux which would cut out Windows and Mac OH users from being able to use such a binding.

But their provided Python script could easily be used with the Exec binding or call directly from a JSR223 Jython Rule.

---

<div class="post-metadata">

**Author:** ![PabloVieira](https://community.openhab.org/user_avatar/community.openhab.org/pablovieira/32/40340_2.png) [@PabloVieira](https://community.openhab.org/u/PabloVieira)\
**Post date:** [July 22, 2019, 6:28pm UTC](https://community.openhab.org/t/switchbot/73197/11 "2019-07-22T18:28:59Z")

</div>

I just bought one of these at Prime Day for 17,50 €. See picture attached for my use case. I’m renting my flat and that Daikin air conditioner is a nightmare to program. Its thermostat doesn’t work either. Now I just turn the AC on and off from my phone and program it very easily with the Switchbot app. Of course, I’m hoping to integrate it on my OpenHAB installation and remove the proprietary app.

 ![IMG_20190722_202306](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/8/a/8a88d1b4fd3bc28491bda7ed94402dde7e04cac7.jpeg)

---

<div class="post-metadata">

**Author:** ![ChrisSFoot](https://community.openhab.org/user_avatar/community.openhab.org/chrissfoot/32/32081_2.png) [@ChrisSFoot](https://community.openhab.org/u/ChrisSFoot)\
**Post date:** [October 23, 2019, 7:45am UTC](https://community.openhab.org/t/switchbot/73197/12 "2019-10-23T07:45:18Z")

</div>

I’ve just backed the kickstarter for the new switchbot curtain opener. When it arrives I’ll get started on the binding assuming nobody else is already working on it.

---

<div class="post-metadata">

**Author:** ![rpwong](https://community.openhab.org/user_avatar/community.openhab.org/rpwong/32/36036_2.png) [@rpwong](https://community.openhab.org/u/rpwong)\
**Post date:** [January 14, 2020, 10:43pm UTC](https://community.openhab.org/t/switchbot/73197/13 "2020-01-14T22:43:01Z")

</div>

I just came across their [Kickstarter campaign](https://www.kickstarter.com/projects/switchbot/switchbot-curtain-make-your-curtains-smart-in-seconds), and the Switchbot Curtain seems like a thoughtfully designed device, from the way it grips the curtain rod/rail to the optional solar panel. Hopefully it works out well for you!

---

<div class="post-metadata">

**Author:** ![thor72](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/ea5d25/32.png) [@thor72](https://community.openhab.org/u/thor72)\
**Post date:** [January 17, 2020, 8:45pm UTC](https://community.openhab.org/t/switchbot/73197/14 "2020-01-17T20:45:38Z")

</div>

Hello everyone,  
I found this thread when looking for “SwitchBot and OpenHAB”. As I did not find an “out-of-the-box” solution I started tinkering/ playing around with it and got it to work from OH.  
I run OH 2.5.1-2 (Release Build) on a RPi 3 (integrated BT, no dongle) with Raspbian “stretch”

I would like to share what I did to make it work (wasn’t straight forward as I also learned some new concepts on the way).  
First I connected the SwitchBot via BT to my (Android-) phone using the original SwitchBot app (no hub) and got the BT Mac address which I need later.  
Then I installed “python-host” from OpenWonderLabs on Github following their instructions  
and moved the “switchbot.py-file” to the location of my choice. The idea was to run the Python script from OH

To do this I installed the Exec-Binding through PaperUI  
and also the RegEx Transformation (which I have not used any further yet)  
The configuration I did through files:

Thing

```auto
Thing exec:command:<Thing name> [command="python <path to switchbot.py> <SwitchBot MAC> <command for SwitchBot>", interval=0, autorun=false]

```

(the available commands for the SwichBot are “Press”, “Turn On”, Turn Off", “Down” or “Up” (I found this looking through the switchbot.py file))

Item

```auto
Switch <SwitchBot_trigger> // item used for triggering the action and used in the "rule"
Switch <SwitchBot_Run> {channel="exec:command:<Thing name>:run", autoupdate="false"}

```

Sitemap

```auto
	Frame label="<Frame label>" {
		Switch item=<SwitchBot_trigger> label="<Trigger label>" icon="wallswitch"
	}

```

Rule

```auto
rule "<rule name for SwitchBot>"
when
   Item <SwitchBot_trigger> changed
then
    <SwitchBot_Run>.sendCommand(ON)
end

```

Sometimes I need to “trigger” it twice before it does something so I might need to change some timers to allow for the BT connection to be established

Status feedback would be nice but at this time I have no idea if or how this might be possible  
I just came across a BT to MQTT by “zewelor” on github but did not do any further tests

Hope this helps anybody and if there is anybody who would like to comment or recommend any change/ different approach, this would be most welcome.

---

<div class="post-metadata">

**Author:** ![NilsAcht](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/5daacb/32.png) [@NilsAcht](https://community.openhab.org/u/NilsAcht)\
**Post date:** [June 17, 2020, 8:54am UTC](https://community.openhab.org/t/switchbot/73197/15 "2020-06-17T08:54:13Z")

</div>

@thor72 Very nice. Do you know if this will work with WiFi MAC and the Bridge?

---

<div class="post-metadata">

**Author:** ![pstephan](https://community.openhab.org/user_avatar/community.openhab.org/pstephan/32/38103_2.png) [@pstephan](https://community.openhab.org/u/pstephan)\
**Post date:** [October 31, 2020, 9:10pm UTC](https://community.openhab.org/t/switchbot/73197/16 "2020-10-31T21:10:27Z")

</div>

Hello,  
Is anyone working on the binding for this SwitchBot? the “SwitchBot Curtain” seems very interesting…  
Thanks  
Patrick

cc: @ChrisSFoot

---

<div class="post-metadata">

**Author:** ![bcirulis](https://community.openhab.org/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@bcirulis](https://community.openhab.org/u/bcirulis)\
**Post date:** [November 5, 2020, 1:03am UTC](https://community.openhab.org/t/switchbot/73197/17 "2020-11-05T01:03:31Z")

</div>

Hi all, I just received my SwitchBot Curtain (plus hub), and would also be keen to integrate into my OpenHAB installation. I don’t have the skills to build a binding, but am happy to help test.

---

<div class="post-metadata">

**Author:** ![bx67212](https://community.openhab.org/letter_avatar_proxy/v4/letter/b/d9b06d/32.png) [@bx67212](https://community.openhab.org/u/bx67212)\
**Post date:** [November 6, 2020, 7:14am UTC](https://community.openhab.org/t/switchbot/73197/18 "2020-11-06T07:14:29Z")

</div>

SwitchBot Curtain looks great! They release homebridge plugin: [https://github.com/SwitchBot/homebridge-switchbot-ble#readme](https://github.com/SwitchBot/homebridge-switchbot-ble#readme) Im ready to test if someone have the skills for this 💪🏻

---

<div class="post-metadata">

**Author:** ![NoTechi](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/76d3ee/32.png) [@NoTechi](https://community.openhab.org/u/NoTechi)\
**Post date:** [February 11, 2021, 6:08pm UTC](https://community.openhab.org/t/switchbot/73197/19 "2021-02-11T18:08:18Z")

</div>

+1 being interested in a switchbot binding 🙂

---

<div class="post-metadata">

**Author:** ![dietah](https://community.openhab.org/user_avatar/community.openhab.org/dietah/32/68961_2.png) [@dietah](https://community.openhab.org/u/dietah)\
**Post date:** [February 22, 2021, 4:20pm UTC](https://community.openhab.org/t/switchbot/73197/20 "2021-02-22T16:20:17Z")

</div>

Hi Guys,

I was also thinking of automating my coffeemaker with a switchbot as it is still under warranty and didn’t want to open the device. Before buying the actual switchbot I did some research and also stumbled upon this thread.

For multiple reasons I decided to make an abstraction for switchbot as I already had a MQTT broker running. I created a Docker container that translates an incoming mqtt command from openhab (or even google) and scans for the requested switchbot via a bluetooth stick and sends the command, based on the lib that switchbot made available.

If anyone is interested you can find the code here: [GitHub - dietah/mqtt-switchbot: Control a SwitchBot switch via mqtt messages](https://github.com/dietah/mqtt-switchbot)  
The available docker is compiled for amd64 as I had difficulties with the arm bluetooth stability.

The code only supports the regular switch, so no support for the curtain as I found buying it right now a bit too expensive. If there are any questions I’d be happy to answer them.

[Next page](https://community.openhab.org/t/switchbot/73197.md?page=2)
