input_datetime attribute timestamp #523
Unanswered
Petro31
asked this question in
Entity Models
Replies: 1 comment 2 replies
-
I looked at implementing a full timestamp for "time-only" input_datetime in https://community.home-assistant.io/t/trigger-automation-15-minutes-before-date-time-stored-in-input-datetime/145279/40?u=koying , but as Taras correctly remarked, adding the date (of the day?) to make up a full datetime implies that That basically only leaves the filter option, as you mention in that thread.
Something like
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Time is a royal pain for most people in home assistant, however we've made plenty of ways to get around using complex calculations. One thing I've noticed when dealing with support is the timestamp attribute is pretty useless for input_datetime
state objects.
Is there a reason we decided this? It's painful to use in templates. For example if you want to use relative time, you need to convert it to a datetime object. But you have to add the date and the time zone. The time zone you get from timestamp_custom is not the correct format and cannot be used in strptime. So you have to insert a colon before the 4th character then concatenate the date and the time zone to get the proper datetime. This is just as difficult to use when managing them as timestamp integers.
The outcome to this in my opinion is 1 of 2 options:
This way, users can use these for easy date calculations. Or they can simply drop it into a device_class timestamp sensor if they want to display the relative time in the UI.
Beta Was this translation helpful? Give feedback.
All reactions