Integrating YLYK01YL Remote with Home Assistant Without a Xiaomi Gateway
In this guide, we’ll go through how to integrate the YLYK01YL remote directly with Home Assistant (HA) without needing a Xiaomi Gateway. The process uses a Python script and Bluetooth MAC address sniffing.
Featured image source: Yeelight
Prerequisites
- Python installed on your system.
- Passive BLE Monitor custom integration: BLE Monitor GitHub.
Steps:
1. Sniff the MAC Address
- Open a terminal and run:
bluetoothctl
- Enable Bluetooth and start scanning:
power on scan on
- Look for
yee-rc
in the output to get your remote’s MAC address.
2. Obtain the Beacon Key
- Put the remote into pairing mode by pressing the off and M buttons simultaneously until the indicator LED blinks slowly.
- Use Method 5 as outlined here, but opt for the previous version of the script, which uses bluepy.
- Run:
python get_beacon_key.py <mac_address> 339
- Replace
<mac_address>
with your remote’s MAC. 339
specifies the device model (YLYK01YL).
- Replace
- Save the output key for later.
3. Add Device to BLE Monitor
Add the following to your configuration.yaml
:
ble_monitor:
devices:
- mac: "<mac_address>"
name: "yeelight remote"
encryption_key: "<beacon>"
reset_timer: 1
4. Validate in Home Assistant
After restarting HA, navigate to:
- Settings > Devices & Services > Passive BLE Monitor
- Find your new
sensor.ble_remote_yeelight_remote
entity.
Automation
Use these states for automations:
- single press on, off, m, sun, +, and -
Example YAML for automations:
alias: Yeelight Remote Automation
trigger:
- platform: state
entity_id: sensor.ble_remote_yeelight_remote
to: single press on
id: single_press_on
# Repeat for other states
action:
# Define actions, e.g., turn lights on or adjust brightness
For help configuring automation, I used ChatGPT to streamline the process.