Template warning

hi I got this warning how to fix it ?

* Template warning: 'timestamp_custom' got invalid input 'None' when rendering template '# <center>{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%I:%M %p') }} ## <center>{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A, %B %-m, %Y') }}' but no default was specified. Currently 'timestamp_custom' will return 'None', however this template will fail to render in Home Assistant core 2022.1

Capture

1 Like

hi @tom_l
thanks for your reply
I read this post before ,
Unfortunately, I couldn’t understand it
if you can help me with my case

{{ as_timestamp(states('sensor.date_time_iso'),default=None) | timestamp_custom('%I:%M %p',default=None) }}

thank you @luma

Happy to help! I’d encourage you to check out the link provided above, it’s quite a bit to digest but it really helped me understand better how template functions work and how to use them.

yeh check out but it’s too complicated for me now
I do my best for it
thanks

# <center>{{ as_timestamp(states('sensor.date_time_iso') , default=None) | timestamp_custom('%I:%M %p' , default=None) }}
 ## <center> {{ as_timestamp(states('sensor.date_time_iso') , default=None) | timestamp_custom('%d %A, %B %-m, %Y', default=None ) }}

* Template warning: 'as_timestamp' got invalid input 'unknown' when rendering template '# <center>{{ as_timestamp(states('sensor.date_time_iso.last_changed')) | timestamp_custom('%I:%M %p') }} ## <center>{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A, %B %-m, %Y') }}' but no default was specified. Currently 'as_timestamp' will return 'None', however this template will fail to render in Home Assistant core 2022.1

Not work @luma

as_timestamp(states('sensor.date_time_iso' , default=None))