Switchbot – for the times you can’t just plug something in!

Switchbot BOT attached to a tiny Chuwi Mini-PC

I’ve wanted a Switchbot for AGES and hey, ZBANX just sent me a couple of Switchbot Bots to play with. Nice.

In case it’s not obvious, the Bot is a little battery-powered box with a tiny lever to physically turn things on and off from an APP. The device will work in pushbutton or one-way modes as required.

Spouse won’t let you interfere with the wiring? Is automating your light (or other appliance) hard or is it just inconvenient to wire it electronically?

I’ve got a better one for you: I’ve a tiny computer – CHUWI which is WONDERFUL but for one fatal flaw which the company who make the Chuwi have no intention of fixing…. it simply will not turn on automatically after a power failure… and that’s when I first took an interest in Switchbot.

If the computer is here in Spain and I’m in the UK, I’m stuffed. You’d think there would be a million (not amateur-night-out) products to get around this by physically pushing the power button – but no.

To cut a long story short, I’m back in Spain and JUST as I was leaving the UK my PC there died – won’t turn on – it’s either a new PSU or the BIN. As the UK is no longer part of the Euro-party, shipping stuff back and forth is no-where near as easy as it used to be, but this tiny PC would be easy to take in someone’s bag – but without the ability to ensure it stays on over there regardless – useless. Enter the BOT.

I’m so excited I can try this while writing to you guys… first things first – the packaging tells you a lot about the Switchbot Bot so here goes… as a bonus, Switchbot Bot is compatible with all of your speech-gadgets – Alexa, Google and more. Before I forget – here’s the ZBanx link for the BOT (no I’m not on commission etc)

I’ve never actually been near one of these devices until now. Sorry, I had to obscure the codes (right) to protect the innocent (i.e. me). But then I didn’t have to use any codes – I just grabbed the APP and the BOT started communicating with it.

I already have a feel for this and at this point in the blog entry, I’ve not yet taken the device out of the box but it is so well-explained on the box.

So the claim is nearly 2 years battery life – I’ll assume an annual battery with room for a short pandemic pause….

Ok, first question – what on earth is a CR2 battery? Doesn’t matter – they included one – I’ll worry about that in (let’s say) 500-600 days 🙂

As you see left and above, every panel of the box contains useful info, including spec… range up to 80 metres Bluetooth (I’ll believe that when I see it)… the bottom of the box contains the spec, range and more.

So this device runs on Bluetooth – I’d have preferred WiFi but I guess battery life would be an issue and using a BT dongle on my Raspberry Pi can’t be that big a deal? – I already have a BT dongle here in Spain (for a plant sensor) so adding one to the UK setup should not be an issue hopefully.. BUT read on…

The Switchbot APP on Google Play

Anyway, I took Switchbot Bot out, pulled out the tab protecting the battery, downloaded the APP and that’s IT, no signing my life away, no add devices or other stuff – it’s just there, my first Switchbot Bot… and pressing the icon makes it physically LIFT UP – WHEEE – that’s with the APP over BT of course. Using the APP is really simple.

I then tried my HCITOOL LESCAN on my RPi to see if I could spot the Switchbot and ultimately find a way control it remotely ovre WiFi, The device uses BLE…. I can see the device MAC after the button is pressed, meanwhile I’ve asked for a HUB MINI and I’m checking out ways to talk via some kind of gateway. Meanwhile, all is not lost as you can set a schedule, so the next step would be to have it reboot my mini-PC overnight…. at this point the PC is here in front of me (see video below) so it’s easy to test…

Why did I take some photos (below) outside? Because it’s April and sunny – at last…

Switchbot BOT supplied by ZBANX

My Chuwi mini-computer

I removed the battery protection tab – (battery included), downloaded the Switchbot APP from the Playstore and the Bot is working… adhesive tabs are supplied – and now to my little PC problem.. firstly on the left, the Chuwi mini-PC. Note the round on-off button has a light – you CANNOT turn this machine on without pressing that button. The Chuwi is reliable – sadly my power is not 100% reliable and well, with Windows updates, anything could happen.

Here below, we see the Bot and Chuwi working together using the standard Switchbot APP which picked up the BLE Bot automatically:

More when I get the HUB. Of course if someone had a device setup like this, for example in the loft, it would be possible to press that button using Bluetooth via the APP – but my requirements are a little moer awkward – like 2 different countries…

I’ve tried getting the bot talking to my Raspberry Pi 4:

sudo hcitool lescan

That command above picks up the device MAC number after pressing the button…. but the python code out there won’t run for me… example (with changed MAC address of course):

# Activate switchbot by python with bluepy on Raspberry Pi
# https://github.com/IanHarvey/bluepy
# 
# Switchbot's API is taken from this
# https://github.com/OpenWonderLabs/python-host

import binascii
from bluepy.btle import Peripheral

# find your switchbot address by
# pi@raspberry:~ $ sudo hcitool lescan
# replace "ff:..:ff"
p = Peripheral("ff:ff:ff:ff:ff:ff", "random")
hand_service = p.getServiceByUUID("cba20d00-224d-11e6-9fb8-0002a5d5c51b")
hand = hand_service.getCharacteristics("cba20002-224d-11e6-9fb8-0002a5d5c51b")[0]
hand.write(binascii.a2b_hex("570100"))
p.disconnect()
sudo python ./switchbot_bluepi.py
Traceback (most recent call last):
  File "./switchbot_bluepi.py", line 8, in <module>
    from bluepy.btle import Peripheral
ImportError: No module named bluepy.btle

I guess somehow I’m missing a blupy library or module… I also tried python3 rather than python… different error, same result. Ok, I give up – I’ve tried various Node-Red BLE nodes – “not authorized (not started) etc. I cannot get anywhere on remote access…

MORE ideas anyone? There has to be a reliable way to get bluepi.btle installed and running on a standard up to date Rpi4….

Meanwhile, I can see this one is going to go on and on for a while (see comments already) – I should take the opportunity to mention – importantly – the adhesive seems fine (unlike some Chinese LED strips I’ve had over the years who’s adhesive can fail in hours) and the BOT is stuck solidly to my Chuwi computer.

Update April 21. 2022

I just received the Switchbot Hub Mini, Switchbot Remote and Switchbot Thermometer and Hydrometer Plus. My remaining fears of Switchbot Bot not working remotely just disappeared. I now thave the Hub working in the cloud (I’d have preferred VPN into the house but hey, it’s solved the problem of remotely turning my little Chuwi on and off from anywhere in the world. The hub is USB powered and easily hooks into the WiFi providing a bridge between WiFi, Bluetooth and IR. Good stuff.

Switchbot Hub, Thermometer and Remote

The thermometer and wall switch are just a bonus for now. I have both running, I’ve had the REMOTE controlling the BOT and also the HUB controlling the BOT – also noticed the temperature and humidity appear on the APP display.

Caviat – May 2022

I do need to add this at the end…. I’ve been using Switchbot on a tiny PC to control the on-off button – and got very excited at the thought of using it on our Hotpoint dishwasher which outright refuses to cooperate with a timer in a country which now charges considerably less for electricity after midnight Switchbot will save me, I thought. erm, NOPE – not nearly strong enough.

Facebooktwitterpinterestlinkedin

14 thoughts on “Switchbot – for the times you can’t just plug something in!

  1. Why not use an ESP connected to a cheap mini servo whose arm hits the switch. I have a remote de-humidifier which I discovered switches on/off when you remove and replace the water container. It has a magnet at the rear which activates the device. I attached a neodymium magnet to the servo swinging arm at it works really well.

    1. That’s an idea, John, perhaps a little more amateur-night-out-looking but if we’re going in that direction I could put a light sensor on to see if the blue light on the Chuwi is already on or not.. do the job properly… keep em coming… Tasmota on the ESP – a simple set of rules and I guess I could run it off the same USB 5v supply as the Chuwi… it’s never going to look as neat though…

      You know, I’m sure I just threw away one of those little servos I was saving for a rainy day… there’s another lesson – NEVER throw anything away. Yup, I threw it out. Still, there’s always AliExpress.

      Hang on – they’re currently quoting delivery in JUNE would you believe…

      1. Ok, found one on eBay Spain – delivery from one end of Spain to the other – 10 days. Now I have to start actually thinking – I’ve no intention of writing Arduino-like code – so how do I convince Tasmota to send the right stuff to move the servo back and forth… hmm.

        This is getting out of hand, I’m seeing 3v tiny solenoids – Wemos, one of those, Tasmota and “pulsetime” command (say half a second) and an ON command.. no idea if the solenouds are strong enough to press the button though. Yet another potential solution.. I’ll find one in Spain with luck – China deliveries several weeks.

        1. I use a Wemos connected to a mini servo (SG90)
          There is a servo library which requires just a few lines of code to move the servo. I use MQTT as comms medium. I am happy to share code with you if Tasmota does not work out for you.

          1. Well, I just ordered the servo – and Wemos – got them lying around – but it’s at least a week to 10 days for the servo to arrive… MQTT for comms – of course – what else.. I’m happy to share your code with me 🙂 I’m so glad I started this ball rolling…. ok, you’re on….

            1. I spent some time messing around with Tasmota, PWM and shutters etc but with no real success. So its back to my Arduino IDE code which just works. Just thinking that although it would require more current a little electromagnet might sort your reset. Anyway I can tidy up my code and pass it on to you.

              1. Hi yes I’m willing to try anything that doesn’t require hours and hours of learning. I programmed arduinos for a long time, years ago, before ESP8266 came out. I then chose not to use arduino environment to code ESP8266 and wrote my own C (not C#) code with the Espressif kit. Thats a long time ago, today I usually use Tasmota on ESP8266 and ESP32, have dabbled with ESPHOME (not Home Assist). I probably have hopelessly out of date Arduino IDE setup. But willing to try anything. I also looked at a solenoid solution, again AliExpress delivery dates right now are ridiculous and eBay Spain gets everything from China or UK (the latter, which for tax and Post purposes may now as well be the moon). I’ve ordered a servo 2 weeks delivery from China….

  2. I’ve not used bluepy but installing it should simply be a matter of:
    $ sudo apt-get install python-pip libglib2.0-dev
    $ sudo pip install bluepy

    1. Should be – but it isn’t. There are all sorts of questions over versioning etc, in the end I could not get any joy and I tried hard. But then, tomorrow is another day.

  3. I desperately want one of these that uses Zigbee (or Zwave… or even Wifi as long as someone reverse engineers the protocol). They are super useful, but BTLE makes these things really annoying to talk to at least with any of the stuff my home automation system runs.

    I ended up using this ESP32 project to drive the one I have controlling my dehumidifier, which lets an ESP32 act as a bridge to MQTT for these things. https://github.com/devWaves/SwitchBot-MQTT-BLE-ESP32

    1. Jason
      Don’t leave the country (I’m just about going out for dinner – I’ll harass you this weekend)…. I’ve just spent the entire afternoon wasting time getting no-where trying to get various Python scripts to work. Finally I used an ESP32 with Tasmota and BT enabled – it sees my Mi Flora but not the BOT – if you have the ESP32 talking to the bot – WE NEED TO TALK:-) 🙂 My experience with BT would fit into a VERY small container (other than earbuds of course 🙂

      1. Haha sure thing, but it pretty much just worked for me following the directions on the github repo. It’s just an Arduino sketch with a few config options to set. Only problem I had with it was that occasionally it misses a command, but I think that’s the Switchbot’s fault.

        There’s even an option in there to fake tracking the state of whatever object you’re controlling. The Switchbot has no idea it just presses a button, but the Arduino sketch can emulate it by assuming the state and keeping track. That’s what I used for my dehumidifier.

    2. I don;t know what it is people have against WiFi on ESP8266 qnd battery…. for a button like this – fixed IP, off most of the time inj deep sleep – suerly can’t be that hard to get half-decent battery life… Switchbot had they thought about it could have added microUSB power and WiFi complimentary to BT….

Leave a Reply

Your email address will not be published.

Leave the field below empty!