-
-
Notifications
You must be signed in to change notification settings - Fork 28.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template entity with device_class timestamp displays as 'Unknown' following 2021.12 update #61673
Comments
Same problem with all my timestamp sensors, only from 2021.12.0 |
@martusi61 @robertwigley You need your template to output a datetime object or a timestamp integer. Strings no longer work. |
There should be an error or warning in your logs mentioning this. |
Please check your logs, not the entity in the frontend. Thanks. |
Sorry. It's true: |
@martusi61 you have sensitive data in that post, remove it. Fix your template with
However you probably want to remove the timestamp device_class because it won't have an accurate time. What are you trying to display? The last cert refresh value? |
The only related entry I can see is this, which was not showing before the update to 2021.12:
Is this something to do with the change to |
no. If that's a timestamp device, it needs a TZ.
|
Resolves the issue. Thank you! There was no mention of this in the breaking changes, not that I could see anyway. |
It is mentioned, but you probably didn't see/understand it. It's this Breaking change here: Timestamp/Date device class value changes Returning an iso formatted date(time) string in these cases is now deprecated and will write a deprecation warning in the logs. This fallback/backward compatibility will be removed in Home Assistant 2022.2. |
Can this be closed then? |
Thanks for the link. Maybe I am being blind, but I still can't find/see it in the Release Notes. |
I have found it. It's under "Updates for custom integration developers". No wonder I never saw it. This should be in the main breaking changes. Yes, this can be closed. Thanks for your assistance. |
I needed the difference in days between a timestamp and today's date, however your suggestion brought up the sensor, but as "unknow", I followed your advice and it worked by removing the "device_class: timestamp", in fact the template returns a number of days not another timestamp. Thanks for everything, now is OK. |
Just remove the timestamp as a device class then. No need for it if you want the number of days. |
Exac |
i have a uptime sensor setup like this
but i get following error |
It looks to be the same as the error I was getting. Try adding |
I get following error |
The problem
Following the update to 2021.12 template entities with a
device_class
oftimestamp
show asunknown
. I have a ton of these for convertinginput_datetime
helpers into read-only sensors for display in Lovelace and they all now display asUnknown
:What version of Home Assistant Core has the issue?
2021.12
What was the last working version of Home Assistant Core?
2021.11.5
What type of installation are you running?
Home Assistant OS
Integration causing the issue
No response
Link to integration documentation on our website
No response
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
Potentially related: https://community.home-assistant.io/t/sunset-sunrise-sensor-stopped-working-while-template-does/366287
The text was updated successfully, but these errors were encountered: