There are several stand-alone projects that will adjust the clock on the LYWSD02
by Xiaomi. The device is recognised by HA but only as a set of sensors.
The clock drifts quite quickly and it would be good to sync the clock over Bluetooth via a proxy.
Example projects:
I have just Installed the ESPhome Solution for that, but you right having this from HA via BT Proxy in the house would be better
What is the ESPhome solution for this?
@rojexx the link is the post.
Had the same issue and quickly hacked together a HomeAssistant integration to do that - see GitHub - ashald/home-assistant-lywsd02: A customer component for HomeAssistant to configure LYWSD02. It adds a new service that can be invoked via any automation to set time on any given LYWSD02.
Thanks for this!
Is there a way to get this merged with the main code for the device?
I’ve see few HA integrations supporting it - did you mean a specific one?
Generally speaking, I doubt I will have time to contribute it to any other integrations is it’s good enough for me as it is, but you could reach out to those integration owners and point them to this thing and ask if they would be willing to take it in.
@ashald is your integration/service designed to be able to set a LYWSD02 that’s only visible to HA via bluetooth proxies? When I call the service with one of my clock’s MACs, I get “not found” in the logs:
2024-05-19 15:42:30.001 ERROR (MainThread) [custom_components.lywsd02] Could not find '17:29:XX:XX:6C:BE'.
Edit: I’ll add that I’m running HA core in docker, with no BT/BLE capabilities exposed to the container. My (minimal) Bluetooth functionality operates only through hardwired Shelly wifi devices that act as bluetooth proxies.
exactly the same problem here.
Could not find ‘mac_here’.
it worked for 1 device, before i updated to 2024.10.1
Hi All,
Perhaps a stupid question but I am facing the same issue with the time of this device.
I tried the solution provided but so far no luck.
therefor a quick check.
am I doing this right it the following automation?
alias: "Set time bathroom Clock "
description: ""
triggers:
- trigger: sun
event: sunrise
offset: 0
conditions: []
actions:
- action: lywsd02.set_time
data:
mac: "XX:XX:XX:XX:XX:XX"
mode: single
thanks in advance!
Thanks for this. It works to set the correct time.
BUT, I am getting an error when setting the clock_mode. Any ideas why?
Also, any chance temp calibration can be added to this integration? Is that even possible?
i could fix this problem by adding active: true in the esphome-yaml.
also running in docker only with bluetooth proxies
logger:
api:
bluetooth_proxy:
active: true
sensor:
- platform: xiaomi_lywsd02
mac_address: "17:75:BC:E1:74:99"
temperature:
name: "LYWSD02 Temperature"
humidity:
name: "LYWSD02 Humidity"
battery_level:
name: "LYWSD02 Battery Level"
update: I did finally get around this - it turns out the Shelly devices are not able to transmit this way- they can only receive BLE data, and then forward it via their other connections. I use a SMLIGHT PoE zigbee coordinator (it is awesome, I would recommend to anyone), and it has official firmware that gives full support of the underlying esp32’s BT radio (at the expense of the webui). I flashed to this firmware, and then set it up as a BT proxy in HA, and this service started working for me.