SwitchBot
The SwitchBot integration allows you to control SwitchBot devices.
Prerequisites
In order to use this integration, it is required to have working Bluetooth set up on the device running Home Assistant. A SwitchBot Hub is not required for this integration.
If you have multiple devices of the same type, you need to get the BTLE MAC address of your device to tell your devices apart. You can find the address for your device using the following steps:
- Open the SwitchBot app.
- Open device settings.
- Click on “Device Info”.
- Write down the BTLE MAC address of your device.
Please note, device names configured in the SwitchBot app are not transferred into Home Assistant.
Configuration
Adding SwitchBot to your Home Assistant instance can be done via the user interface, by using this My button:
If the above My button doesn’t work, you can also perform the following steps manually:
-
Browse to your Home Assistant instance.
-
In the sidebar click on Settings.
-
From the configuration menu select: Devices & Services.
-
In the bottom right, click on the Add Integration button.
-
From the list, search and select “SwitchBot”.
-
Follow the instruction on screen to complete the set up.
Supported Devices
- Color Bulb (WoBulb)
- Bot (WoHand)
- Contact Sensor (WoContact)
- Curtain (WoCurtain)
- Humidifier (WoHumi)
- Light Strip (WoStrip)
- Meter/Meter Plus 70BB (WoSensorTH)
- Motion Sensor (WoPresence)
- Plug Mini (WoPlug), both the original (model W1901400) and HomeKit-enabled (model W1901401)
- Lock (WoLock)
SwitchBot Entity
There are three attributes available on the SwitchBot entity to give you more information about your device.
-
last_run_success
: Iftrue
if the last action sent to the SwitchBot succeeded. This attribute is useful for error trapping when Bluetooth connectivity is intermittent. Iffalse
, see home-assistant.log for specific error messages. -
Switch mode
: Specifies the mode of the SwitchBot. Iftrue
the the SwitchBot is in Pull/Retract mode for toggle switches otherwise the bot is in momentary switch mode.
SwitchBot Options
-
Retry count
: How many times to retry sending commands to your SwitchBot devices.
SwitchBot Lock
The integration currently only uses the primary lock state; in dual lock mode, not all things might work properly.
A SwitchBot lock can be set up in Home Assistant in two different ways. You can enter the key id and encryption key yourself, or Home Assistant can import them from your SwitchBot account.
SwitchBot account (recommended)
Using this option you can provide your SwitchBot account login credentials and Home Assistant will import the appropriate encryption key from your account.
Enter the lock encryption key manually
This option is for those that would rather obtain the encryption key themselves, and/or want to know exactly where and how are their account credentials used.
For instructions on how to obtain the locks encryption key, see README in PySwitchbot project.
Error codes and troubleshooting
The SwitchBot integration will automatically discover devices once the Bluetooth integration is enabled and functional.