This Home Assistant custom component allows you to synchronize the time on one or more Xiaomi LYWSD02 Bluetooth clocks directly from Home Assistant.
- Sync the time on multiple Xiaomi LYWSD02 clocks with a single service call.
- Uses Bluetooth (via the
bleaklibrary) to communicate with devices. - Simple service for manual or automated time sync.
-
Copy the files
Place thexiaomi_clock_syncfolder in your Home Assistantcustom_componentsdirectory. -
Enable in configuration.yaml file add the following line to
configuration.yaml:xiaomi_clock_sync: -
Restart Home Assistant
After copying the files, restart Home Assistant to load the new component.
Note:
You do not need to install thebleaklibrary manually. Home Assistant will automatically install all required dependencies as specified inmanifest.json.
add the following line to configuration.yaml:
xiaomi_clock_sync:Sync the time on one or more Xiaomi LYWSD02 clocks.
| Field | Type | Required | Description |
|---|---|---|---|
| macs | list | Yes | List of MAC addresses of the clocks to sync |
Example:
service: xiaomi_clock_sync.sync_time
data:
macs:
- "A4:C1:38:XX:XX:XX"
- "3F:5B:7D:XX:XX:XX"You can call this service from Developer Tools, automations, or scripts.
- Ensure your Home Assistant host has a working Bluetooth adapter.
- The clocks must be powered on and within Bluetooth range.
- Based on h4/lywsd02
- Uses the bleak Bluetooth library
MIT License