Switchbot

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 :confused:
When is it useful to attach an extra switch, to a switch?

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.

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

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 examples.

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

See also

I like the rubber thumb idea :grin:

This made my day! :rofl:

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. :angry: 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.

1 Like

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.

1 Like

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.

3 Likes

I just came across their Kickstarter campaign, 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!

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

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

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

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

Rule

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.

4 Likes

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

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

cc: @ChrisSFoot

2 Likes

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.

SwitchBot Curtain looks great! They release homebridge plugin: https://github.com/SwitchBot/homebridge-switchbot-ble#readme Im ready to test if someone have the skills for this :muscle:t2:

+1 being interested in a switchbot binding :slight_smile:

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
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.

3 Likes

although it would be cheaper to just make an ESP32+servo , if you are looking for a cleaner wireless look switchbot is a good option

If you have switchbot buttons and if you have an ESP32 (they cost around $5 CAN) you can try out the code I wrote

It is similar to what @dietah did, but everything is done by the ESP32.
The ESP32 subscribes to MQTT topic, when a message is received it sends the BLE command to switchbot. Then will send an MQTT response

With this solution you don’t need to use the bluetooth on your smarthub and you can get full “bluetooth” switchbot home coverage. I only use one ESP32 and it covers my house, but if you have a big house, just place a couple ESP32s around the house

works with switchbot button/curtain/meter

3 Likes

my esp32 code now works with switchbot button, curtain and meter/temp sensor and “unlimited” devices

2 Likes