openhab-android icon indicating copy to clipboard operation
openhab-android copied to clipboard

Add configurable Offset to all DateTime items

Open dilyanpalauzov opened this issue 2 years ago • 7 comments

An openHAB-instance runs in one time zone and all DateTime items show the data local to that timezone. To be precise in my case I use as item definition DateTime rd_last_change "Last change in [%1$tH:%1$tM:%1$tS h]".

OpenHAB-Android is executed physically in another time zone. I have to perform the calculations between the timezone of where the openHAB-instance is and where openHAB-Android run, in my head.

Please add an option in openHAB-Android to convert the DateTime items’ values from the timezone, where openHAB runs, to the timezone where openHAB-Android is executed.

dilyanpalauzov avatar Jun 24 '23 12:06 dilyanpalauzov

Probably something to be thought more globally and not only with a solution on each UI app.

lolodomo avatar Jul 12 '23 11:07 lolodomo

Maybe a new parameter called timezone which accepts timezones (e.g. UTC+2) and the keywords client (timezone of the client) and server (timezone of the server). The current behavior should be the default behavior.

UTC+2 works for Germany in summer, but in winter it's UTC+1. Maybe accept only the two keywords client/server at all?

mueller-ma avatar Jul 16 '23 14:07 mueller-ma

Would you really want this to be mixed in one sitemap? I'd imagine a single option (use device time zone/use server time zone) should normally be sufficient.

maniac103 avatar Jul 16 '23 15:07 maniac103

I agree with @maniac103. It would be odd to have more than one DT on a sitemap with different TZs.

But, if you guys do go with @mueller-ma's approach, be sure to consider how users will encounter timezones in the rest of OH. In particular, with working with ZonedDateTimes in rules they get the time zone name instead of the UTC offset. Where feasible it's helpful to be consistent. It may not be feasible or even relevant here but I just wanted to bring this up as a consideration.

rkoshak avatar Jul 17 '23 14:07 rkoshak

The sitemaps shall not be changed. The server knows its timezone. The client also knows its timezone, or can be set by an option. What is missing is to convert from the timezone of the server to the timezone of the client for DateTime items.

dilyanpalauzov avatar Jul 17 '23 18:07 dilyanpalauzov

What I'd like about the Sitemap expansion is that the setting is "hidden" from a regular app user. But adding a setting in the app seems fine to me as well.

mueller-ma avatar Jul 17 '23 18:07 mueller-ma

I do not understand how is the mentioned Sitemap expansion supposed to work.

dilyanpalauzov avatar Jul 18 '23 18:07 dilyanpalauzov