Giter VIP home page Giter VIP logo

home-assistant-lywsd02's Issues

TimeOut Error

Hi!
Thanks for this project which could finally solve my lagging e-ink clocks around the house.
Unfortunately, I don't seem to get it to work as it runs into timeout all the time. I'm using four BLE proxies, one of which very close to the clock in question.

Here's the log of the ESP32 connecting to the watch:

[12:55:58][I][bluetooth_proxy:282]: [0] [XX:XX:XX:XX:XX:XX] Connecting v3 without cache
[12:55:58][D][esp32_ble_tracker:215]: Pausing scan to make connection...
[12:55:58][I][esp32_ble_client:067]: [0] [XX:XX:XX:XX:XX:XX] 0x00 Attempting BLE connection
[12:56:07][D][esp32_ble_client:110]: [0] [XX:XX:XX:XX:XX:XX] ESP_GATTC_CONNECT_EVT
[12:56:07][D][esp32_ble_client:110]: [0] [XX:XX:XX:XX:XX:XX] ESP_GATTC_OPEN_EVT
[12:56:07][D][esp32_ble_tracker:266]: Starting scan...
[12:56:08][I][esp32_ble_client:084]: [0] [XX:XX:XX:XX:XX:XX] Disconnecting.
[12:56:08][D][esp-idf:000]: E (57775) BT_GATT: GATTC_ConfigureMTU GATT_BUSY conn_id = 3

[12:56:08][D][esp32_ble_client:110]: [0] [XX:XX:XX:XX:XX:XX] ESP_GATTC_SEARCH_CMPL_EVT
[12:56:08][I][esp32_ble_client:227]: [0] [XX:XX:XX:XX:XX:XX] Connected
[12:56:08][D][esp32_ble_client:110]: [0] [XX:XX:XX:XX:XX:XX] ESP_GATTC_CLOSE_EVT
[12:56:08][D][esp32_ble_client:172]: [0] [XX:XX:XX:XX:XX:XX] ESP_GATTC_DISCONNECT_EVT, reason 22

The time on the clock is not set and the HA log file shows a time out error:

File "/config/custom_components/lywsd02/init.py", line 78, in set_time
async with BleakClient(ble_device) as client:
File "/usr/local/lib/python3.12/site-packages/bleak/init.py", line 565, in aenter
await self.connect()
File "/usr/local/lib/python3.12/site-packages/habluetooth/wrappers.py", line 300, in connect
connected = await super().connect(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/bleak/init.py", line 605, in connect
return await self._backend.connect(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/bleak_esphome/backend/client.py", line 79, in _async_wrap_bluetooth_operation
raise asyncio.TimeoutError(str(err)) from err
TimeoutError: Timeout waiting for connect response while connecting to XX:XX:XX:XX:XX:XX after 10.0s, disconnect timed out: True, after 20.0s

Setting the clock via the webapp (https://saso5.github.io/LYWSD02-clock-sync/) works just fine.

Any help is greatly appreciated :).

More details to configure services.yaml

hello,
First of all, thanks for the hard work.
Can you give more detail on how to configure the service.yaml file.
timestamp:
description: Time to Set
example: 1702200346
How is time coded in example?

or can you make an example for the service.yaml to get the time that home assistant have in that moment?

best regards.

half-hour offset

Hello, thank you very much for this integration. It's very useful because I travel a lot by sea. I often change time zones, but not always according to the actual location; sometimes I do it earlier or later depending on how long we'll be at sea.

That's why I set the time zone on my phone, and I would like the watches to immediately synchronize with the time zone set on my phone. It works great, but the watches act up when we're in places like Sri Lanka, where it's GMT+05:30.

Unfortunately, your service doesn't accept tz_offset: 5.5.

Generally, my automation looks like this:

alias: Synchronize Xiaomi Clock
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.z_flip_5_sm_f731b_current_time_zone
condition: []
action:
  - service: lywsd02.set_time
    data:
      mac: 77:2E:4592:44:34
      tz_offset: >-
        {{ ((state_attr('sensor.z_flip_5_sm_f731b_current_time_zone',
        'utc_offset') | float / 3600) | int // 1000 -1) | string }}
mode: single

It works only with full hour offset, but even manual invocation doesn't work anymore:

service: lywsd02.set_time
data:
  mac: 77:2E:4592:44:34
  tz_offset: 5.5

Do you think you could somehow add the ability to handle tz_offset in the format X.X?

Thanks,
Waldek B.

LYWSD02MMC doesn't sync

Hello !

My LYWSD02MMC doesn't sync (maybe because it's a "MMC" ?).
HACS is installed and you repo too.
My automation :

trigger:
  - platform: time
    at: "04:00:00"
condition: []
action:
  - service: lywsd02.set_time
    metadata: {}
    data:
      mac: E7:2E:00:E2:71:01
mode: single

I have no error when it runs but nothings appends, the clock isn't synced (1 minute is still missing).
HA runs on rpi 3 and the pi clock is OK.
HAOS is up to date.

Multiple lywsd02

Just a question:
Is it possible to use more than one lywsd02 by adding multiple mac addresses?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.