iobroker.switchbot-ble
v0.4.5
Published
SwitchBot BLE adapter for ioBroker
Downloads
13
Maintainers
Readme
SwitchBot (BLE) adapter for ioBroker
This adapter allows you to control your SwitchBot "Bot" and to monitor SwitchBot "Meter", "Contact" and "Motion" via Bluetooth (BLE).
Before you install
If you are looking for Hub Plus/Mini support, this adapter is what you will need.
Models
Supported models
- 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.
Prerequisites
To use this adapter, you will need to already have ioBroker installed.
Supported OS
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:
$ sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
You also have to run the following command:
$ sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
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):
$ sudo apt-get install libcap2-bin
See the documentation of @abandonware/noble for other details.
Node.js
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.
Installation
$ cd /opt/iobroker/
$ npm install iobroker.switchbot-ble
Usage
Remarks
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.
Troubleshooting
If the adapter no longer works, e.g. after a restart or system update, please try the following:
$ cd /opt/iobroker/node_modules/iobroker.switchbot-ble/
$ sudo rm -r node_modules/
$ npm install
$ sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
Notes
- The battery levels are only approximate values
Changelog
0.4.5
- Bumped node-switchbot to 1.6.1
0.4.4
- Bumped node-switchbot to 1.3.0
- Added support for Switchbot "Meter Plus"
0.4.3
- Added new states for lightLevel and doorState
0.4.2
- Added option to change the used Host Controller Interface (hciX)
0.4.1
- Bumped node-switchbot to 1.2.0
- Fix for Curtains on Firmware v3.3 and above
0.4.0
- Bumped node-switchbot to 1.1.3-beta.7
- Added support for Switchbot "Contact" and "Motion"
0.3.8
- Bumped follow-redirects to 1.14.7 (fix for CVE-2022-0155) and some other dependencies
0.3.7
- Some minor improvements
- Some refactoring
0.3.6
- (patrickbs96) Some improvements and fixes
0.3.5
- Improved handling of controls and tasks
0.3.4
- Several improvements to control the bots
- Added new options to adapter config
0.3.3
- Implemented max retries limit (15)
0.3.2
- Some improvements on handling errors and executing commands
0.3.1
- Add new option to adapter settings
0.3.0
- Removed "switchbot" dependency
- Bumped the required Node.js version to 12
- Bumped node-switchbot to 1.1.2
- Bumped some other dependencies
0.2.3
- Some minor changes
0.2.2
- Bumped node-switchbot to 1.0.6
0.2.1
- Bumped node-switchbot to 1.0.3
0.2.0
- Bumped node-switchbot to 1.0.0
0.0.1 - 0.1.0
- Support for SwitchBot Bot and Meter
- Initial support for SwitchBot Curtain
License
MIT License
Copyright (c) 2022 Sascha Hölzel [email protected]
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.