@switchbot/homebridge-switchbot
@switchbot/homebridge-switchbot
The Homebridge SwitchBot plugin allows you to access your SwitchBot Device(s) from HomeKit with Homebridge.
Installation
- Search for "SwitchBot" on the plugin screen of Homebridge Config UI X
- Find:
@switchbot/homebridge-switchbot- See noble prerequisites for your OS. (This is used for BLE connection.)
- Click Install
Configuration
-
If using OpenAPI Connection
- Download SwitchBot App on App Store or Google Play Store
- Register a SwitchBot account and log in into your account
- Generate an Token within the App
- Click Bottom Profile Tab
- Click Preference
- Click App version 10 Times, this will enable Developer Options
- Click Developer Options
- Click Copy
tokento Clipboard
- Input your
tokeninto the config parameter - Generate an Secret within the App
- Click Bottom Profile Tab
- Click Preference
- Click App version 10 Times, this will enable Developer Options
- Click Developer Options
- Click Copy
secretto Clipboard
- Input your
secretinto the config parameter
-
If using BLE Connection
- Download SwitchBot App on App Store or Google Play Store
- Register a SwitchBot account and log in into your account
- Click on Device wanting to connect too plugin
- Click the Settings Gear
- Click Device Info
- Copy BLE Mac aka
deviceId
- Input your
deviceIdinto the Device Config
Troubleshooting
-
If using Linux / Raspberry Pi OS
-
bluetoothctlmust be installed on the device, otherwise it cannot communicate via Bluetooth. Enable it withsudo bluetoothctl power on. -
If errors occur, while enabling it, restart the process:
rfkill block bluetoothrfkill unblock bluetooth
-
Also make sure, that the computer can discover the SwitchBot device:
sudo bluetoothctlscan on
This lists all discovered Bluetooth devices. The BLE address of the SwitchBot device should be included in this list, otherwise your computer does not discover it.
-
-
If using MacOS
- Manually grant Bluetooth access in System Settings UI for
Security & Privacy -> Privacyto the node executable, eg/usr/local/bin/node
(This is what is intended in documentation for the noble bluetooth package prerequisites by "Add terminal app", however for HomeBridge it is nodethat needs the permission granted, notterminal. Without this step, then you will receive the following error when the swichbot plugin launches, which will cause Homebridge or the child bridge process to restart:
Error: Failed to initialize the Noble object: unauthorized
at Noble.<anonymous> (file:///usr/local/lib/node_modules/@switchbot/homebridge-switchbot/node_modules/node-switchbot/src/switchbot.ts:244:19)
at Object.onceWrapper (node:events:629:26)
at Noble.emit (node:events:514:28)
at Noble.onStateChange (/usr/local/lib/node_modules/@switchbot/homebridge-switchbot/node_modules/@stoprocent/noble/lib/noble.js:92:8)
at NobleMac.emit (node:events:514:28) - Manually grant Bluetooth access in System Settings UI for
Supported SwitchBot Devices
- SwitchBot Humidifier
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- Can Push Updates over OpenAPI
- Can Receive Updates over BLE and OpenAPI
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- SwitchBot Evaporative Humidifier (Auto-refill)
- SwitchBot Meter
- SwitchBot Meter Plus (US)
- SwitchBot Meter Plus (JP)
- SwitchBot Indoor/Outdoor Thermo-Hygrometer
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- If using Bluetooth Low Energy (BLE) only:
- Must supply
deviceId&deviceNameto Device Config - Check
Enable Bluetooth Low Energy (BLE) Connectionon Device Config
- Must supply
- SwitchBot Motion Sensor
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- If using Bluetooth Low Energy (BLE) only:
- Must supply
deviceId&deviceNameto Device Config - Check
Enable Bluetooth Low Energy (BLE) Connectionon Device Config
- Must supply
- SwitchBot Contact Sensor
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- If using Bluetooth Low Energy (BLE) only:
- Must supply
deviceId&deviceNameto Device Config - Check
Enable Bluetooth Low Energy (BLE) Connectionon Device Config
- Must supply
- SwitchBot Curtain
- SwitchBot Curtain 3
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- If using Bluetooth Low Energy (BLE) only:
- Must supply
deviceId&deviceNameto Device Config - Check
Enable Bluetooth Low Energy (BLE) Connectionon Device Config
- Must supply
- SwitchBot Blind Tilt
- Supports OpenAPI & partial Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- SwitchBot Bulb
- SwitchBot Ceiling Light
- SwitchBot Ceiling Light Pro
- SwitchBot Light Strip
- Supports OpenAPI & partial Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- SwitchBot Lock
- SwitchBot Lock Pro
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- US: SwitchBot Mini Robot Vacuum K10+
- US: SwitchBot Floor Cleaning Robot S10
- JP: SwitchBot Robot Vacuum Cleaner S1
- JP: SwitchBot Robot Vacuum Cleaner S1 Plus
- Supports OpenAPI Connection Only
- SwitchBot Plug
- SwitchBot Plug Mini (US)
- SwitchBot Plug Mini (JP)
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- SwitchBot Bot
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- If using OpenAPI:
- SwitchBot Hub Mini, SwitchBot Hub 2, or SwitchBot Hub 3 Required
- Enable Cloud Services for Device on SwitchBot App
- You must set your Bot's Device ID for either Press Mode or Switch Mode in Plugin Config (SwitchBot Device Settings > Bot Settings)
- Press Mode - Turns on then instantly turn it off
- Switch Mode - Turns on and keep it on until it is turned off
- This can get out of sync, since API doesn't give me a status
- To Correct you must go into the SwitchBot App and correct the status of either
OnorOff
- If using Bluetooth Low Energy (BLE) only:
- Must supply
deviceId&deviceNameto Device Config - Check
Enable Bluetooth Low Energy (BLE) Connectionon Device Config
- Must supply
- SwitchBot Hub 2
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- Enables Humidity, Temperature, and Light Sensor
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- SwitchBot Hub 3
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- Enables Humidity, Temperature, and Light Sensor
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
- SwitchBot Battery Circulator Fan
- Supports OpenAPI Connection Only
- SwitchBot Water Leak Detector
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
Supported IR Devices
(All IR Devices require SwitchBot Hub 2, SwitchBot Hub 3, or Hub Mini)
- TV
- Allows for On/Off and Volume Controls
- Optional Disable Sending Power Command
- Projector (Displayed as TV)
- Allows for On/Off and Volume Controls
- Set Top Box (Displayed as Set Top Box)
- Allows for On/Off and Volume Controls
- DVD (Displayed as Set Top Box)
- Allows for On/Off and Volume Controls
- Streamer (Displayed as Streaming Stick)
- Allows for On/Off and Volume Controls
- Speaker (Displayed as Speaker)
- Allows for On/Off and Volume Controls
- Fans
- Allows for On/Off Controls
- Optional Rotation Speed
- Optional Swing Mode
- Lights
- Allows for On/Off Controls
- Air Purifiers
- Allows for On/Off Controls
- Air Conditioners
- Allows for On/Off, Tempeture, and Mode Controls
- Optional Disable Auto Mode
- Cameras
- Allows for On/Off Controls
- Vacuum Cleaners
- Allows for On/Off Controls
- Water Heaters
- Allows for On/Off Controls
- Others
- Option to Display as differenet Device Type
- Supports Fan Device Type
- Allows for On/Off Controls
- Option to Display as differenet Device Type