I have a watch complication that shows me several pieces of data and one of them is the date (because squeezing it in there saved me another complication slot), but I recently realized that it doesn’t account for changing time zones.
So the plan is to use the mobile iOS companion app’s reported time zone in the Time Zone
attribute of the geocoded_location
sensor to adjust the date reported by the template that fills that part of the complication. Currently the template I’m using for that complication slot looks like this:
{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%-m/%d') }}
Very simple and gives me what I need, and I found I can extract the timezone data with another template line like this:
{{ state_attr('sensor.mobile_device_geocoded_location', 'Time Zone') }}
But that reports the time zone in the tz database format as America/Los_Angeles
and as far as I can tell I will need to get that converted to a UTC offset value which I can then pipe into timestamp_custom
to get the date converted to the current time zone.
I’m definitely improving with jinja in recent projects but this one is escaping me, anyone able to point me in the right direction?