python-eq3bt icon indicating copy to clipboard operation
python-eq3bt copied to clipboard

Time zone awareness

Open moeffju opened this issue 6 years ago • 2 comments

I’m using eq3bt with home assistant. Home assistant has been using UTC time internally since 2015, and hassbian is also pre-configured for UTC. There is no way to pass a time zone in to eq3bt as far as I can tell, so the times are off by the TZ difference (in my case, UTC vs CEST = 2 hours). Home Assistant configures a time zone and handles time zones correctly internally, but as it cannot pass that data to eq3bt, the thermostats get the system time (which is in UTC). As a result, all programmed schedules are off.

All methods using datetime.now would need to be extended to take a time zone parameter, or time zone could be made global. The callers need to pass in a time zone. If none is given, system timezone could still be used, but a warning should probably be given to the user.

moeffju avatar Apr 08 '18 12:04 moeffju

I think the the constructor could accept an optional timezone, that way it is easier to handle than adjusting it separately per method. Having a warning is also a good idea, I'm open for PRs.

rytilahti avatar Apr 08 '18 22:04 rytilahti

I have the same problem - wrong time if i integrate thermostats into homeassistant (per bt-mqtt-gateway).

renarena avatar Nov 24 '21 22:11 renarena