This app is used to control SwitchBot devices.
It supports both BLE and the hub methods for Curtains, Bots and the temperature / Humidity modules.
If you are interested in purchasing SwitchBot products and would like to support me then use the following link to their store as I will get 10% commission on your purchase.
When adding BLE devices, it is strongly recommended that you keep Homey and the device as close together as possible. If the distance is too large then Homey may cache partial data about the device that makes it unrecognisable. Once that data is cached it can be hard to remove and might require a restart of Homey to clear it.
The limitations of the app:
-
Hub: The SwitchBot hub API only allows 10000 accesses per day. That means the refresh of the current state to get changes is slow, and the more devices you have the slower the refresh as each device requires one access. It does however control the devices well.
-
BLE: The maximum polling rate allowed on Homeyâs BLE is 30 seconds, so updates can be slow. However, unlike the Hub, it doesnât matter how many devices there are as all the information is gathered in one request.
-
BLE: Range is quite small, due to the Low Energy nature, and Homeyâs range is lower than other devices like your phone or the SwitchBot hub. So, it might be difficult to find a location that can reach the devices.
SwitchBot have now added support for some notifications via a webhook. This means that certain features on some devices are now much faster to activate on Homey. These include Motion detection on the Motion sensor, Contact operation on the Contact sensor (includes entering or leaving), all the colour bulb features and both values on the Temperature and Humidity sensors.
The webhook is supported in version 1.1.0 onwards.
Using the Hub
For versions before 1.0.0
To get the token required to access the SwitchBot API, go to SwitchBot phone app and select Profile â> Preferences then tap 10 times on âApp Versionâ. A new Developer Options option will appear in the list. Tap on that and the token will be displayed.
Copy this token (it is quite long so use the Copy command on your device if you can)
Next, open the Configure App screen of the Homey SwitchBot app and paste the code in to the API TOKEN field.
For version 1.0.0. onwards
Use the normal procedure to add a device to Homey. During the process, you maybe redirected to a SwitchBot page to enter your username and password. Once you have done that and submitted the form, you can close the page. Providing the details are correct you will then be able to select the devices that have been added to your SwitchBot account.
Bot Switch Mode (Toggle / Press)
Versions 0.2.4 and later have been updated to work with the Push Button mode of the Bot. For the BLE version, this is automatic as the required information is provided in the data packet. For the Hub version, the information is not made available via the API, so there is a setting in the Advanced Settings page to enable it.
Note: The actual setting for the device has to be set via the SwitchBot phone app as there is nothing documented in the protocols to be able to change it from the Homey app.
Alternative BLE connection
I have created an app that runs on a ESP32, Arduino compatible board. I have made the app available on Github:
The boards are pretty cheap on Amazon, but the installation is medium complexity, so may not be for everyone.
Once the board is programmed, it is plug and play with the Homey SwitchBot app V0.2.4 and later. You just add BLE devices to Homey in the normal way.
The advantages of using an ESP32 board are:
- Very fast feed back of device state changes via a notification method. I can see the curtain position slider animate through several positions as the curtains open and close. Also, real-time feedback of contact sensor and motion sensor state changes.
- Connects to Homey via WiFi, so can be positioned to reach SwitchBot devices that are too far from Homeys built in BLE.
- Uses a local connection so can be used even if you internet connection is not working.
There are instruction in the Github repository to assist programming the board.
Version History
0.1.1
- Initial release
0.1.2
- Added BLE Temperature and Humidity
0.2.0
- Added HUB Temperature and Humidity, HUB Bot and BLE Bot
0.2.1
- Added Invert Position and Motion Mode to advanced settings for curtains
0.2.2
- Fixed Invert Position for HUB connected curtains
0.2.3
- Added Air Conditioner Remote
0.2.4
- Fixed operation of the Switch Bot to honour the single press mode when selected in the SwitchBot app. BLE can detect the mode setting but for the hub you have to adjust the Advanced setting.
0.2.5
- Fix for the Homey BLE caching issue.
Note, this fix is only for devices that are in the app and will not help fix the issue of detection when adding devices, if Homey has cached bad data for the new device that makes it impossible to recognise it.
0.2.6
- Added On/Off capability to curtains so they can be fully opened/closed by tapping on the tile
0.2.7
- Added a check for a SwitchBot device with no service data in the discovery, so the entry in the BLE cache can be cleared ready for the next discovery.
0.2.8
- Fix Bot state check when using Homeyâs BLE.
- Adding my BLE hub no longer disables Homeyâs BLE checking so both are now used.
- Added error handler around JSON parsing to cope with bad data.
0.2.9
- Attempt to add devices based on the localName id there is no service data.
0.2.10
- Changed logging to multi-level to make it easier to spot general issues.
- Cleaned up the retries loops.
0.2.11
- Ensure log level is initialised at start up.
0.3.0
- Optimised for Homey V6 firmware, but still compatible with V5.
0.3.1
- Optimised for activating multiple devices simultaneously.
- Added Position value to information.
- Added buttons to send the logs from the configuration page.
0.3.2
- Added Position value to hub curtain information.
- Fixed issue during pair curtains.
0.3.3
- Added support for Scenes.
- Added support for the DVD and Speaker remote devices.
0.3.4
- Added âRun Sceneâ action flow card so scenes can be run without needing to add them as a device.
0.3.5
- Fix remote parameters and command switched.
0.3.6
- Fixed TV, DVD and set top box that I broke in 0.3.5 because they didnât need reversing.
0.3.9
- Added support for the SwitchBot Humidifier
0.3.10
- Added support for passwords on bots
- Fixes for Humidifier
0.3.11
- Added flow action card to select a specific channel number.
0.3.12
- Separated On and Off to individual buttons for the AC device.
- Decoded error messages reported in device view to prevent [object Object] being reported.
0.3.13
- Fix On / Off flow actions for AC remote.
0.3.14
- Added BLE Presence sensor
- Added BLE Contact Sensor.
When used with Homey BLE, it can take up to 30 seconds for the state to change due to the limited refresh rate. With my ESP32 hub the state change is instant in Homey.
0.3.15
- Updated BLE Contact Sensor (added contact left open, button press and fixed Bright).
0.3.16
- Updated BLE Contact Sensor (added entry and exit).
0.3.17
- Reduce Hub polling interval to improve responsiveness. Added Smart Fan and Remote Fan.
0.3.18
- Added trigger flows for Fan remote.
0.3.19
- Fix Remote On and Off action cards.
0.3.20
- Fix AirCon On and Off action cards.
SwitchBot have published the BLE API for the Contact and Motion sensors so they should now be stable.
Now being published under the official SwitchBot account.
0.4.0
- Big code reorganise in preparation for Possible Homey / Homey Bridge usage.
- Added error handling around API calls that might have prevented polling timer from restarting.
- Added Presence Sensor (Hub).
- Added Contact Sensor (Hub).
0.4.1
- Add Color Bulb (Hub).
0.4.2
- Fixed âSet nebulization efficiencyâ flow card.
0.4.3
- Added support for custom IR remote controls.
1.0.0
- Added support for connecting with your SwitchBot username and password instead of getting an API key
1.0.1
- Added battery type information to devices.
1.0.2
- Fixed setTimeout error.
1.0.3
- Changed the default Curtain Motion mode to Performance.,
- Report errors to control window when command fails.
1.0.4
- Improved action card titles.
1.0.5
- Deprecated contact and motion sensor to allow the app to be published (these will be resurrected when a reliable notification method has been created).
1.0.6
- Revived contact and motion sensor.
- Added the Light remote.
1.0.7
- Added more diagnostics logging.
1.0.8
- Set remote air conditioner temperature limits to prevent invalid values being sent.
1.0.9
- Fix for curtain BLE data change with firmware version 3.9.
1.1.0
- Added webhook for faster response to:
Contact Sensor (HUB) - Door contact open / close,
Motion Sensor (HUB) - Presence detection,
Temperature & Humidity (HUB) - Temperature / Humidity change,
Colour Bulb - All features (I nearly forgot this one)
1.1.1
- Added Exited capability for the contact sensor the show true if the motion was detected before the contact was opened and false if motion was detected after the contact was opened. The capability is set to null when the contact is closed so the trigger can detect the new state even when it is the same as the old state.
1.1.2
- Added extra tags for supported AC remotes.
1.1.3
- The Bot class is now set to socket when the Bot is in Switch mode so it can be added to HomeKit.
1.1.4
- Small changes to images and hint wording for publishing approval
1.1.5
- Improved the error message shown for the device when a command fails.
1.1.6
- Fixed start scene flow card.
1.1.7
- Reset Left Open capability when contact open cleared.
1.1.8
- Added camera motion sensor.
1.1.9
- Fixed use of a function that is not available on older Homeys.
- Attempt to register webhook every 2 seconds if it fails due to Homey connection issues.
1.1.10
- Added support for Light Strips
1.1.11
- Fix for DIY Air conditioner (only supports on and off).
1.1.12
- Reverse On / Off commands for DIY Air conditioner.
1.1.13
- Increased the number of buttons to 36 for a custom remote.
- Added support for the SwitchBot Lock.
1.1.14
- Change log levelsâŚ
- Updated Contact webhook for new format.
1.1.15
- Updated to API v1.1 so door lock can now be controlled.
1.1.16
- Restores logging level at start up.
- Added more webhook logging.
1.1.17
- Added support for HUB 2 via Temperature & Humidity sensor.
1.1.18
- Fixed an app crashing issue.
1.1.19
- Unset warnings when device recovers.
1.1.20
- New icon for Blind Tilt device.
1.1.21
- Fix direction for Tilt device. Add flow cards for Tilt device.
1.1.22
- Work around bug in API for Tilt device and convert âsetPosition: down;0â to âcloseDownâ.
- Set dead zone in middle of slider to make it easier to select fully open.
1.1.23
- Added Tilt BLE device.
1.1.24
- Fix for Homey 2023 as it reports the long UUID instead of the short version.
1.1.25
- Added battery information to devices that report it.
1.1.26
- Added Projector remote control.
1.1.27
- Supports Blind / Tilt firmware v2. This removes the requirement of getting the position by sending a command as it is now supplied in the advertisement data.
1.1.28
- Fix for Get Device Log when no devices were found during the Add Device stage.
1.1.29
- Added Air Purifier Remote.
1.1.30
- Added luminance to Temperature and Humidity device when it is a Hub 2.
- Added webhook support for more devices and reduced polling.
1.1.31
- Added Alarm for door jammed. Changed Hub 2 luminance to Brightness as a percentage of it range.
1.1.32
- Fix for new T & H I/O data format.
1.1.33
- Fix for new T & H I/O temperature data format.
1.1.34
- Enhanced performance for ESP32 BLE hub.
1.1.35
- Update for new Bot BLE data format.
1.1.36
- Update for new Curtain 3 Hub data format.
1.1.37
- Added Light Level to Curtains BLE.
1.1.38
- Fix for Curtains 3 hub not being found due to missing device type in API response.
- Fix for BLE Curtain 3 not being found due to changed device id field.
1.1.39
- Polling added for Curtains 3 hub as they donât provide webhook data.
- Fix Light Level changed trigger.",
1.1.40
Added support for Plug Mini.
1.1.41
- Fixed image for Plug Mini.
1.1.42
- Added door open alarm (not included in the webhook data so polled only).
- Added general alarm for Lock when it is jammed.
- Fix error when processing Lock webhook data.
1.1.43
- Added Open/Pause/Close capability to curtains.
- Fix Plug Min (US) and Plug Mini (JP) detection
1.1.44
Added support for the Vacuum Cleaner.
1.1.45
- Added trigger with drop list for state plus a condition card with the state to the Vacuum Cleaner.
- Fixed the dock command for the vacuum cleaner.
1.1.46
- Fixed spelling error defined in the API document.
1.1.47
- Added Curtain3 to list of curtain devices.
1.1.48
- Added Curtain3 to list of curtain devices. Added Norwegian translations thanks to Philip Ăstli
1.1.49
- Added Flow action card to move curtains at performance or quiet speed (thanks to Dennie de Groot)
1.1.50
- Reduce Error information in the log. Added initial support for the Lock Pro. Changed the trigger card for vacuum to use âclearingâ instead of âcleaningâ.
1.1.51
- Added setting for curtain devices to change the class type to blind for better Google integration."
1.1.52
- Trigger On/Off Flow card in Bot Press Mode, Added support for the Robot Vacuum Cleaner S10.
1.1.53
- Added support for the Robot Vacuum Cleaner K10+.
1.1.54
- Added Flow action card to move curtains at performance or quiet speed for the HUB variant.
1.1.55
- Fix Lock door open/ closed detection for updated API format.
1.1.56
- Added support for the SwitchBot Water Leak detector
If you have any requests or find any issues please get in touch on here.