frlequ / home-assistant-network-tariff

Home Assistant Custom Component for Slovenian Network Tariff (Omrežnina)
MIT License
28 stars 1 forks source link

Blocks shifted by 1h #17

Open nejco opened 3 days ago

nejco commented 3 days ago

It seems all block are shifted by 1 hour. Block 1 should start at 7:00 but it was changed at 8:00. Timezone in homeassistant is correct (Vienna, GMT+1). System time is also correct.

date
Tue Nov 12 11:55:50 AM CET 2024
Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> 
>>> def get_current_time():
...     # Get the current time
...     current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
...     return current_time
... 
>>> # Print the current time
>>> print("Current time:", get_current_time())
Current time: 2024-11-12 11:50:16
Screenshot 2024-11-12 at 11 54 09 Screenshot 2024-11-12 at 11 53 38
frlequ commented 3 days ago

Can you check time zone under profile

image

Also, can you share output from template: {{ now().strftime('%H:%M:%S') }}

nejco commented 3 days ago

This also shows the correct time

Screenshot 2024-11-12 at 19 20 32 Screenshot 2024-11-12 at 19 23 05
frlequ commented 3 days ago

The component gets its time from the HAOS server time zone. Your HAOS setup might be pulling the datetime function differently (not synchronized?), or the time zone setting under your HA profile could be corrupted. I can only replicate the issue if I change the time zone to display a different local time (+1).