Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalized time synchronization support for more clocks #91

Merged
merged 3 commits into from
Jan 29, 2023

Conversation

koenvervloesem
Copy link
Member

Description:

This adds time synchronization support for devices implementing the Current Time Service (e.g. PineTime with InfiniTime firmware), PVVX firmware (LYWSD03MMC, MHO-C401, CGG1, CGDK2, these are untested), Qingping BT Clock Lite, ThermoPro TP358, ThermoPro TP393, and Xiaomi LYWSD02. This uses the bluetooth-clocks library, which can be updated independently to add support for new devices.

This also adds two new arguments to the TheengsGateway command:

  -ts TIME_SYNC [TIME_SYNC ...], --time_sync TIME_SYNC [TIME_SYNC ...]
                        Addresses of Bluetooth devices to synchronize the time
  -tf TIME_FORMAT, --time_format TIME_FORMAT
                        Use 12-hour (1) or 24-hour (0) time format for clocks (default: 0)

This changes the current implementation that automatically synchronizes all detected LYWSD02 devices, which may not be what you want if your gateway discovers devices from your neighbours. The new implementation requires you to explicitly specify the Bluetooth addresses of the devices you want to synchronize the time with.

After a Theengs Gateway version with this PR has been released, the Docker image, Home Assistant addon and snap should be extended to support these new arguments/configuration options.

Checklist:

  • The pull request is done against the latest development branch
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • I accept the DCO.

This uses the bluetooth-clocks library, which can be updated
independently to add support for new devices.
@1technophile
Copy link
Member

Thanks

@1technophile 1technophile merged commit f6e8ef0 into development Jan 29, 2023
@1technophile 1technophile deleted the generalize_time_sync branch January 29, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants