This is a custom component for Home Assistant that allows the control of the Yeelight bedside Lamp via bluetooth. (Contrary to the wifi version, those lamps only have bluetooth control).
Originally based on the work by Teemu Rytilahti python-yeelightbt, it has been completely re-written to improve stability and only focuses on the integration with HA.
This custom component can be installed in two different ways: manually
or using HACS
- Download the
hass-yeelight_bt.zip
file from the latest release. - Unpack the release and copy the
custom_components/yeelight_bt
directory into thecustom_components
directory of your Home Assistant installation. - install bluepy in the HA virtual environment
- Add the
yeelight_bt
lights as described in next section.
This repo is now in hacs, so just search for it, install and enjoy automatic updates.
This component use the bluepy
python library to access bluetooth. In order to scan for new devices, it needs to have the correct permissions:
-
For Home-assistant core installed in Virtualenv:
sudo setcap cap_net_admin,cap_net_raw+eip /PATH-TO-HA-VENV/PATH-TO-BLUEPY-LIB/bluepy-helper
-
For Home-assistant core in docker:
The docker-compose (or equivalent docker command) should have:
cap_add: - NET_ADMIN - NET_RAW network_mode: host
-
for HASSIO:
Not too sure yet... It may have the correct permissions already ??
The devices can be configured either through the integration menu
or the configuration.yaml
file.
In Configuration/Integrations click on the + button, select Yeelight bluetooth
and configure the name and mac address on the form.
The light is automatically added and a device is created.
-
For each lamp, create a light with the
yeelight_bt
platform and configure thename
andmac
address.Example:
light: - platform: yeelight_bt name: Bedside lamp mac: 'f8:24:41:xx:xx:xx' - platform: yeelight_bt name: Other lamp mac: 'f8:24:41:xx:xx:xx'
-
Restart Home Assistant.
- If the light has been paired with a previous device prior, best to reset it following this youtube video
- The custom component will automatically request a pairing with the lamp if it needs to. When the pairing request is sent, the light will pulse. You then need to push the little button at the top of the lamp.
Once paired you can control the lamp through HA
- Re-implement bluetooth backend for stability and optimal responsivness for yeelight
- Add component to HACS for easy install
- Allow configuration through the integration UI
- Enable discovery of lamps in UI? (Not sure if possible)
- Look into setting up effect and flow (low priority)
- Allow pairing process with new device
- Support for candela light? (I do not have a device, so might need help from someone with one...)
- Scale temperature range so that it matches HA UI
In order to getmore information on what is going on, the debugging flag can be enabled by placing in the configuration.yaml
of Home assistant:
logger:
default: error
logs:
custom_components.yeelight_bt: debug
NOTE: this will generate A LOT of debugging messages in the logs, so it is not recommended to use for a long time