Time Template and missing Timezone

I’ve spent better part of the afternoon googling and trying things but nothing seems to resolve my issue.

The below is working as I need, but I had to add the 300 mins (5hrs) to the calculation. I didn’t have to do this last week (The SD Card in my Pi Died last night, now running on Synology NAS in docker).

Looks like the WORK start time is coming in without a timezone, and HA seems to assume it’s GMT.

I would like to find a way for it to assume that all non timezone dates are LOCAL to the HA timezone (don’t want to have to change other stuff).

How would I go about setting the default time zone? (My HA is already set to America/New_York)

I have the following template in Developer Tools:



This outputs the following:

2020-12-30 16:00:00
2020-12-30 15:55:00.008560-05:00

What does this return?

{{ as_timestamp(as_local(state_attr('calendar.work', 'start_time'))) }}

AttributeError: ‘str’ object has no attribute ‘tzinfo’

Finally figured this out, when I added the TZ environment variable, I set the value to US. I pulled it from the wrong column in the table of time zones. WHOOPS!

Would you be so kind to explain your solution. I seem to have a simular problem. When i get the last_changed attribute from the homeassistant logbook in the states table with a sql sensor (Maria DB on Synology NAS) the returned timestamp has no attribute ‘tzinfo when try to convert the UTC-timestamp with as_local()

When setting up HA on Synology Docker, I put in the wrong value here:


Instead of US it should have been: America/New_York
When I had to redo my set up I realized I set the wrong value, and corrected it. Well at that point the time was running 5hrs ahead and that’s when I realized how I screwed up in the first set up.

1 Like