SwitchBot BLE adapter for ioBroker
npm install iobroker.switchbot-ble!Logo
!Number of Installations

This adapter allows you to control your SwitchBot "Bot" and to monitor SwitchBot "Meter", "Contact" and "Motion" via Bluetooth (BLE).
If you are looking for Hub Plus/Mini support, this adapter is what you will need.
* SwitchBot "Bot"
* SwitchBot "Meter"
* SwitchBot "Contact"
* SwitchBot "Motion"
The models listed are those that I have in use myself.
#### Other models
* SwitchBot "Curtain"
* SwitchBot "Meter Plus"
These models are known to work, but I don't have them in use myself.
To use this adapter, you will need to already have ioBroker installed.
This adapter may only run on Linux-based operating systems,
as the underlying library node-switchbot
currently only supports Linux-based operating systems such as Raspbian and Ubuntu.
Before installing the adapter, you need to install some Linux libraries related to Bluetooth.
These are as follows if the operating system is Ubuntu/Debian/Raspbian:
``bash`
$ sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
You also have to run the following command:
`bashwhich node
$ sudo setcap cap_net_raw+eip $(eval readlink -f )`
This grants the node binary cap_net_raw privileges, so it can start/stop BLE advertising.
__Note:__ The above command requires setcap to be installed.
It can be installed the following way (e.g. Raspbian and Ubuntu):
`bash`
$ sudo apt-get install libcap2-bin
See the documentation of @abandonware/noble for other details.
It is recommended to use version 14.x or 16.x of Node.js.
The minimum required version is 12.x, but support for this version may will be dropped soon.
`bash`
$ cd /opt/iobroker/
$ npm install iobroker.switchbot-ble
#### SwitchBot "Bot"
If you use the "Bot" in "Switch Mode"
the value of the state "control.inverseOnOff" should be the same as "Inverse the on/off direction" in the app.
This cannot be synchronized automatically.
If the adapter no longer works, e.g. after a restart or system update, please try the following:
`bashwhich node
$ cd /opt/iobroker/node_modules/iobroker.switchbot-ble/
$ sudo rm -r node_modules/
$ npm install
$ sudo setcap cap_net_raw+eip $(eval readlink -f )``
#### Notes
* The battery levels are only approximate values
Copyright (c) 2022 Sascha Hölzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.