Notifications always show UTC

Hi everyone,

I am trying to setup a notification that send me a message when the peak solar production is being reached tomorrow. This information comes from this sensor.


and it returns 2024-05-01T12:00:00+00. I have tried to convert this with strftime but no success. My time zone is correctly set up in the general settings.

Does anyone have a clue how I can get this in any format I like within my correct time zone? I am UTC +2

"{{ states('sensor.power_highest_peak_time_tomorrow_2')|as_datetime|as_local }}"

Thanks for the quick reply, that indeed does the trick :slight_smile:
how would the code look like when I only want to have the hour and minutes displayed?

{{ (states('sensor.power_highest_peak_time_tomorrow_2')|as_datetime|as_local).strftime('%H:%M') }}
1 Like

I think I got the logic of this now.

Thanks very much!

1 Like

Sorry @tom_l, I need to bother you again.

I have tried to apply this formatting to a state_attr as follows:

{{ (state_attr('sensor.dwd_weather_warnings_105111000_vorwarnstufe', 'warning_1_start')|as_datetime|as_local).strftime('%d.%m.%y %H:%M Uhr')}}


ValueError: Template error: as_datetime got invalid input ‘2024-05-02 12:00:00+00:00’ when rendering template ‘{{ (state_attr(‘sensor.dwd_weather_warnings_105111000_vorwarnstufe’, ‘warning_1_start’)|as_datetime|as_local).strftime(’%d.%m.%y %H:%M Uhr’)}}’ but no default was specified

From other issues I think I need to provide a default value, however I don’t really understand where and how to do this. Could you help me out once again?