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_clock functionality doesn't use home assistant time #97

Open
darkpainy opened this issue Apr 1, 2024 · 2 comments
Open

sync_clock functionality doesn't use home assistant time #97

darkpainy opened this issue Apr 1, 2024 · 2 comments

Comments

@darkpainy
Copy link

I have an issue where the sync clock function uses a system time of the velserv tcp server (which in my case is a docker container with the wrong time).
Using velbuslink software (this uses the same TCP server as connection) I can set the correct time from the software.
Could the integration somehow use the timestamp of home assistant in the sync message?

@cereal2nd
Copy link
Owner

if you use the sync_clock it will use the time.localtime() from the home-assistant server.
there is no interaction with the tcp server, we craft (in velbusaio) all packages in hex. so it will use th hass time.

Note: velbustcp (from velbus) also has a sync clock functionality, this one will use the time from the container/system where its running.

are you use it came from the hass sync_clock service?

@darkpainy
Copy link
Author

darkpainy commented Apr 2, 2024

Hey @cereal2nd

I call the sync_clock service from HA, I just collected the logs from the velbus integration.
Now, I see something is indeed wrong, but I couldn't explain it :)
at 22:33, i executed the sync through HA, while velbus debug logging was enabled:

2024-04-02 20:33:27.539 DEBUG (MainThread) [velbus-protocol] TX: RawMessage(priority=fb, address=00, rtr=False, command=216, data=b'd8 01 14 21')
2024-04-02 20:33:27.601 DEBUG (MainThread) [velbus-protocol] TX: RawMessage(priority=fb, address=00, rtr=False, command=183, data=b'b7 02 04 07 e8')
2024-04-02 20:33:27.662 DEBUG (MainThread) [velbus-protocol] TX: RawMessage(priority=fb, address=00, rtr=False, command=175, data=b'af 01')

I believe that is the SYNC clock command.
as you can see, in my Log the time is wrong, 20:33.

But when I check {{ now() }} in my HA, i see 22:33
2024-04-02 22:41:00.330474+02:00 (this is a couple minutes later ofc, just to show output of the "now()".
So my timezone in HA is correct...
Now apparently, logs and some other things take the linux host as timezone for logs etc, in my case a docker container.
I added
environment:
- TZ=Europe/Brussels
to my docker container... et voila... problem solved... :)

I don't know if you can use home assistant time in the sync instead of the time.localtime which is apparentaly the linux host time. Doesn't really matter as the "non-issue" is solveable, but using actual configurable HA time might be somewhat easier/nicer to have?

Anyway, sorry for the long post, the trouble and false issue rapport.

Cheers

cereal2nd added a commit that referenced this issue Apr 3, 2024
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

No branches or pull requests

2 participants