This script allows you to connect SwitchBot devices to HomeAssistant without the need of a hub. I'm aware of the official SwitchBot integration, but in some cases the machine running HomeAssistant is too far away from the bot or doesn't support Bluetooth.
It's recommended to use an external USB Bluetooth adapter and not the integrated module in most Raspberry Pis to avoid connection issues or slow response time.
To install and run the script execute:
$ git clone https://github.com/1RandomDev/switchbot-bridge
$ npm install
$ cp config.sample.json config.json
$ node index.js
devices
- List of your devices
name
: Device name displayed in HomeAssistantaddress
: Bluetooth mac address (SwitchBot app -> Device settings -> 3 dots -> BLE MAC)
- List of your devices
mqtt
: MQTT broker which HA is connected to- ...
updateInterval
: The update interval for the device info (in hours)optimisticMode
: Weather the switch entities in HomeAssistant should be in optimistic mode. (There is no feedback from the SwitchBot, in normal mode the last known state will be used.)logLevel
: Application log level (available log levels)