The SwitchBot Bot: Create your own Streamlight

The Switchbot Bot: Create your own Streamlight

SwitchBot were kind enough to send me a pack of SwitchBot Bots and their SwitchBot hub mini for me to have a play with and to see if I could do something cool with them. I’ve included some links to various products in the blog. Please note these are affiliate links, which if you use will help the blog a little, but won’t cost you any more in the process.

These feel solid and really well made, they were well packaged and came with replacement sticky pads for a push/pull configuration allowing you to repurpose or move one if you want. From the pictures below you can see how they compare to an AA battery for a size comparison.

 

Switchbot Pack
SwitchBot Pack
Switchbot Unboxed
SwitchBot Unboxed
Switchbot Size Comparison with an AA battery
SwitchBot Bot Size Comparison with an AA battery

 

I downloaded the app from the Google Playstore.

Switchbot App on the Playstore
SwitchBot App on the Playstore

I didn’t put any information in. I didn’t set up any account, I literally just installed the app. The switchbot had a small plastic tab that you needed to pull out to engage the battery. I did it, and within SECONDS the SwitchBot Bot was found and ready for action.

 

LET ME REPEAT THAT: OPEN APP, PULL TAB. DONE.

 

This should serve as a lesson to anyone else in this industry. No one needed my email, my username, shoe size, credit card, age, address, country or breakfast preference. I needed to see this again, still not quite believing what was happening. I took a second one out of the box and placing it on the side, I removed the tab. By the time I picked the phone back up, it was already set up and ready to go. Fantastic effort SwitchBot! They came with an instruction booklet, but ‘ain’t nobody got time for that. I skimmed through the app menus and within a minute had a good handle on what did what.

By default they’re configured for a pressing motion, i.e. a quick press / toggle. It’s simple enough to switch these to a switching motion (Password, mode). This would be suitable for a light switch, i.e. on (and staying out) then off and retracting slightly. So far so good. The app worked very well, easy to use, no drama. Let’s get it into Home-Assistant.

Integration into Home-Assistant

I won’t bore you with all the nitty gritty, the integration can be found here. The instructions for this though are somewhat short. For those not so confident or experienced in yaml, you could come unstuck. I mean what happens if you want to use more than one? How do you configure that? Do you need quotes when naming etc? Here’s my code below. This should clear up any questions you might have. I did try to use quotes around the name originally (i.e. name: “black”), but it didn’t take correctly. Entry without quotes worked perfectly.

– platform: switchbot
mac: XX:XX:XX:XX:XX:XX
name: white

– platform: switchbot
mac: YY:YY:YY:YY:YY:YY
name: black

There might be smarter ways to add these, but this worked for me. I added this to my switches.yaml as I’ve broken out the switches from the main configuration.yaml. A quick restart and we were in business.

Once imported into lovelace, they show up like a normal switch. FYI, if you’ve configured your SwitchBot Bot in switch mode (on/off) then the icons in lovelace behave as you’d expect. In press mode (i.e. momentary action) then either on or off icon will toggle the SwitchBot. These are now controllable locally. I tested this by putting my phone in airplane mode (no bluetooth) and toggled them in Home-Assistant via my desktop. They worked as before. What a refreshing change. Still no information had been handed across to anyone, and no account was needed to be linked.

My Home-Assistant (supervised) setup is running on an Intel Nuc 6th Generation Celeron with bluetooth built in. Now these SwitchBots communicate over bluetooth. If you are running Home-Assistant Supervised via proxmox etc, it might be a little harder to get bluetooth working out of the box. I’ve seen people recommend using a raspberry pi zero (wireless) and running various programs like switchbot to mqtt etc to get around this. This is great if your switch bots are too far away from your installation, but if they’re close and you’re having issues with bluetooth. I’d personally just buy a bluetooth dongle and just pass that straight through to Home-Assistant.

Getting these into Home-Assitant was the easy bit. The difficult part was deciding where to use them. Thankfully, I had several use cases that I wanted to explore.

Example 1) Stream Lights

I bought the following Yongnuo Video light from Amazon a few years ago for when I’m streaming on twitch.

Yongnuo YN300 III
Yongnuo YN300 III

https://amzn.to/2YGXcQv

It’s been performing like a champion, but it’s only controllable via bluetooth. Unfortunately, there was no way to automate this. I’d been in contact several times with the developers at Yongnuo who confirmed this to be true. There’s an ios app apparently, but it didn’t look great, besides am on android. There’s a small bluetooth remote control but no way of bringing it into HA. That is, until now! On the back of this YN300 III is a big juicy toggle button, and a flat area next to it, large enough for a SwitchBot to sit comfortably. The thing is the SwitchBot arm is incredibly strong for it’s size. You will need to seat this properly for it to work. I forcefully held the SwitchBot down initially to prove it could work and to play with the correct spacing. Once I was satisfied with the positioning, I got some alcohol and gently wiped the area next to the button. I stuck the SwitchBot down and placed a couple of heavy items on the back of it for 15 minutes to give time for the adhesive to start to set. This was probably overkill, but I wasn’t in a rush. Eventually, temptation got the better of me, and I toggled the button in Home-Assistant. The light turned on and off perfectly. The good thing about the YN300 III is it remembers it’s brightness/colour temperature settings so you can literally set it up once and you’re done.

Alexa Voice Control

We’re not done there though. I don’t want to go into Home-Assistant or the SwitchBot app everytime i want to turn the light on or off. Let’s go for some voice control. I decided I would import the video light into Alexa. I did this via the Alexa bridge in Node-red. If you’re an Amazon user, take a look here for the full tutorial on how to do it. I created a switch called “beastmode” (don’t ask me why as my Call of Duty skills are closer to that of a llama!).

I went back to node-red and hooked it up to a call service node to toggle the streamlight on or off. Once done in Node-red, I went into the alexa app to “add device.” Within a few short moments, we were set.

Alexa Voice Control of a Switchbot
Alexa Voice Control of a Switchbot

We also have Google Assistant in the house, so not wanting to cheat on her, I added the video light to Google Assistant also. A full tutorial on how to create an entity via a Google bridge can be found here. This literally took a minute to do.

Adding Google Assistant Voice Control to the Switchbot
Adding Google Assistant Voice Control to the SwitchBot Bot

At this point, I had both voice assistants set up, but sometimes it’s not always convenient to shout across the house mid stream to Alexa or Google to turn on beastmode!

I needed another way to control it. Enter the streamdeck!

Streamdeck control

If you didn’t know, I’ve been able to control entities in Home-Assistant and Node-red via my Elgato streamdeck for ages. I wrote a full post on it here. I wanted to basically emulate an Elgato Streamlight, without paying a small fortune for one. As I already had the deck, I decided to program up a web socket call on the streamdeck itself and feed that into Node-red. See below for the node configuration. You’ll need the custom component for Elgato but see my previous tutorial for the details. The websocket command was as follows:

ws://192.168.2.42:1880/endpoint/streamlight

Adding a websocket call to control the switchbot
Adding a websocket call to control the SwitchBot

I already had some stuff set up on the streamdeck so it was just a simple case of copying and pasting the nodes. You need to remember to change the endpoint of the websocket and make sure it matches the field on the streamdeck. I deployed the flow and we’re done!

Configuring the Websocket Command in the Streamdeck
Configuring the Websocket Command in the Streamdeck

Summary

I now have a streamlight that I can control via Home-Assistant, Node-red, the SwitchBot app, Google Assistant, Alexa, and my Elgato Streamdeck. Thanks to Tailscale, I have full access to all of this even when I’m out of the house with no need for port forwards or third party servers (Tailscale Setup).

Full Switchbot Control
Full SwitchBot Bot Control

Now you could even go a step further. If you’re really big into your gaming, you could potentially have your pc switched on and ready to go with the help of Iotlink. For example, one of your friends comes online via Steam during a time where you are available to play games. You get a notification in telegram and automatically your PC display goes on, the streamlight can be turned on and you can automatically have restream, steam, OBS all load up automatically. This can also occur if you touch the NFC tag on your desk with your phone. Below is what it would look like in Node-red.

Getting Ready to Stream
Getting Ready to Stream

I’ve already covered the basics on how to construct this flow with the following posts:

  1. Automating your windows machine with Iotlink
  2. Working with NFC Tags
  3. Gaming notifications when your friends are online

I do appreciate this is totally nerdy, but hey, it works!

Example 2) Boiler Control

I really wanted to test the SwitchBot on a diesel boiler that we have here. We live in the mountains and as such we’re prone to power cuts from time to time. Often after a power cut, we need to restart the boiler pump. Now this heating system is ancient. We’re renting, so not in a position to rewire or replace. It’s often a hassle needing to go to the pump house to check if there’s an issue or if the pump needs restarting. Thankfully, due to Reolink and now Switchbot, we can monitor everything from the convenience of indoors. Once power resumes after a power cut, I can check the wireless Reolink camera which monitors the boiler (more info on that here). If there’s an error on the boiler, it means the pump needs resetting. I forcefully held the SwitchBot over it and successfully managed to restart the boiler. There is one issue though. The plate where the SwitchBot needs to sit, isn’t perfectly flat. Therefore, before I can permanently attach it, I will need to fabricate either a bracket or use some kind of shim to help bridge the uneven gap. In this instance I was pressing down on a small mosaic tile to bridge the gap. At least here in the video you can see it working in principle.

Example 3) Subwoofer Control

Another area where i’ve found a use for the SwitchBot is in controlling our subwoofer. I did a short video showing that it indeed works to control the buttons. I demonstrated it on the power button, but frankly speaking a normal smartplug or socket would work better here, but the button to the right of the power button controls the mode that the subwoofer is in. It can be in either music or movie mode (different crossovers). The SwitchBot would be perfect for controlling this, but again, it just needs a shim or a bracket to firmly fix it to the panel. I used sellotape in this instance, clearly ghetto, but it still worked! Thankfully, there are already people creating and 3D printing various plates and structures to hold the switchbot, so if you have a 3D printer, or you’re handy with the tools you’re golden. Check here for some more ideas. I’m sure there are plenty of other sites with various bracketry already created and ready to be printed. I use various apps for media playback on an Nvidia Shield. I could create flows for example which would turn the subwoofer to movie mode when sending a command to open an app like plex/amazon prime/netflix etc, or switch it to Music if I opened up something like poweramp for example.

 

Whenever I’ve seen videos and reviews on the SwitchBot, they’ve always tended to focus on turning on or off a light switch. Whilst I appreciate that these are good at that, I think with the presence of smart bulbs and sockets already out in the market place, I feel like this might not be the best use case for them. That said, if you’re renting or don’t have the ability to get the screwdrivers out, then they definitely work here, but I think the ability to automate older equipment is far more valuable. Here are some other ideas where I would definitely use a switchbot:

  1. Controlling older electrical equipment like an old amplifier, TV or hifi.
  2. Switching on a pc (not all have satisfactory WOL configurations).
  3. Contolling a high load circuit. For example turning on an extractor fan in a workshop. You might not want to put that much current through a smart socket or plug.
  4. Automating a door bell. Perhaps as soon as a motion detector was triggered, you’d want your door bell to be rung. Not everyone has smart/connected door bells.
  5. Automatic flushing of a button flush toilet. Those with children might appreciate a regulary scheduled flush in case their cherubs are forgetful on the throne.
  6. Controlling a coffee machine. Unfortunately for us, we have a two stage machine. We need to flip a big switch before we can press the button, so for us it wasn’t really an option but for others it would be, as well as boiling a kettle.
  7. You could use one on a spare car key with autostart. You could trigger the switchbot to press and hold a button down for X seconds to remote start it and allow the vehicle to warm up in the mornings.
  8. Turning on or off an immersion heater or sauna. These can be expensive if left on.

SwitchBot were kind enough to let me use some of their own images. I think this helps to illustrate my points above:

Using the switchbot
Using the SwitchBot
Using the switchbot
Using the SwitchBot
Using the switchbot
Using the SwitchBot

Caveat

I am extremely impressed by the torque on the little automated arm. It’s powerful. As can be seen in the boiler video, I really had to hold it down with some force. This force comes in very handy when it’s needed to pull the switch backwards (i.e. to switch off), but it can also be a bit of a bug bear. You really do need to secure these properly to ge the best out of them, anything other than a decent sized flat area is going to be problematic, requiring you to show some ingenuity. Too small of an area for the SwitchBot Bot to adhere and the force of the little arm is going to push it off the surface sooner or later. Any type of bevelled or rounded edge could prevent the SwitchBot Bot from anchoring itself securely enough. It would be nice to see some kind of system where you could add plastic shims or attach the base via a screw and then clip into that. I don’t have a 3D Printer, which means I need to now find a way to make a strap or bracket to add the SwitchBot Bot to the boiler pump. I’m thinking a large jubilee clamp, but I digress.

Summary

SwitchBot were also kind enough to supply their SwitchBot hub mini. In the interests of brevity, I’ll cover more about that in the second post. Just a quick point to note that if you have the SwitchBot hub mini, you can essentially switch bluetooth off your phone and can control the bots individually whilst out and about (i.e. not on your LAN). Obviously, this is going to involve using their servers, so for some people this will be an instant no. For others, who maybe don’t enjoy the whole home-assistant experience, or are less concerned about using someone else’s cloud, this could be just the ticket. Do check out the upcoming second post where I go through the SwitchBot hub mini and focus a little more on their ecosystem in general.

If you’re interested in finding out more about SwitchBot and the rest of their product range, you can find more information about them here.

https://www.switch-bot.com

 

 

If you have any good ideas on how to utilise them or any tips for securing the ones I already have to devices, them pop them in the comments below or come over to our facebook group to discuss further.

https://www.facebook.com/groups/386238285944105

If you’re considering a renovation and looking at the structured wiring side of things, or maybe you just want to support the blog, have a look below at my smarthome book, it’s available in all the usual places (including paperback)!

 

Considering a Renovation? Maybe this will save you money!
Considering a Renovation? Maybe this will save you money!

 

Leave a Reply