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

Sync time daily once ESPHome device has requested time once #803

Closed
wants to merge 1 commit into from

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Dec 22, 2023

TODO:

  • verify this actually works
  • tests

If the ESPHome device requests time once we know it has Home Assistant time enabled. Since the clock drifts over time, we will send time again daily to ensure it keeps in sync.

fixes esphome/issues#4424

If the ESPHome device requests time once we know it has Home Assistant
time enabled. Since the clock drifts over time, we will send time again
daily to ensure it keeps in sync.

fixes esphome/issues#4424
Copy link

codecov bot commented Dec 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e236554) 100.00% compared to head (1e71d3f) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #803   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines         2433      2448   +15     
=========================================
+ Hits          2433      2448   +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bdraco
Copy link
Member Author

bdraco commented Dec 22, 2023

It works

If I send it every 10s, the esp accepts the time


[21:38:38.271][D][time:045]: Synchronized time: 2023-12-21 21:38:38
2023-12-21 21:38:48.256 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Sending GetTimeResponse: epoch_seconds: 1703230728

2023-12-21 21:38:48.256 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Sending frame: [0005250d083d8565]
2023-12-21 21:38:48.271 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Got message of type SubscribeLogsResponse: level: LOG_LEVEL_DEBUG
message: "\033[0;36m[D][time:045]: Synchronized time: 2023-12-21 21:38:48\033[0m"

[21:38:48.271][D][time:045]: Synchronized time: 2023-12-21 21:38:48
2023-12-21 21:38:58.258 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Sending GetTimeResponse: epoch_seconds: 1703230738

2023-12-21 21:38:58.258 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Sending frame: [0005250d123d8565]
2023-12-21 21:38:58.269 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Got message of type SubscribeLogsResponse: level: LOG_LEVEL_DEBUG
message: "\033[0;36m[D][time:045]: Synchronized time: 2023-12-21 21:38:58\033[0m"

[21:38:58.269][D][time:045]: Synchronized time: 2023-12-21 21:38:58
2023-12-21 21:39:08.260 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Sending GetTimeResponse: epoch_seconds: 1703230748

2023-12-21 21:39:08.260 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Sending frame: [0005250d1c3d8565]
2023-12-21 21:39:08.273 DEBUG    master_tvcabinet_32 @ 192.168.106.89: Got message of type SubscribeLogsResponse: level: LOG_LEVEL_DEBUG
message: "\033[0;36m[D][time:045]: Synchronized time: 2023-12-21 21:39:08\033[0m"

[21:39:08.273][D][time:045]: Synchronized time: 2023-12-21 21:39:08

@bdraco
Copy link
Member Author

bdraco commented Dec 22, 2023

Looks like we should fix this in the ESPHome codebase instead

@bdraco bdraco closed this Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Home Assistant Time never polls after the initial request
1 participant