I have a input_datetime in my configuration that is updated using an automation. I want to display it in Home Assistant as a datetime value but it should not be editable. How can I do this?
I currently have this:
type: entities
entities:
- entity: input_datetime.my_input
name: Input
- entity: sensor.my_datetime_sensor
name: Date time (in dutch)
I want input_datetime.my_input to be displayed as sensor.my_datetime_sensor.
states('input_datetime.my_input') returns 2020-07-06 15:40:00 which Safari, on iOS, will display as “Invalid date” because it’s not a valid ISO 8601 formatted string.
I’ve changed the value to UTC, replaced the space with a T, and added the Z to signify the UTC timezone. The UI will translate it back to your own timezone.
After poking around some more I realized why — there was no timezone in the source data. There’s just day-month-year and hours-minutes. Makes sense actually. So I added as_local.
This will show the input_datetime.my_input as a readonly date. Full documentation available at the Lovelace entities card documentation. Hope this somewhat helps!