no, sorry for the confusion.
the error is raised whenever I use the import. The sandboxed Python wont let users import these.
My apologies Marius. While familiar with Python, I wasn’t sufficiently familiar with the environment in which Home Assistant runs Python scripts.
It does seem that the datetime
object you receive from state
can’t properly access its strftime()
member in this environment. Given this, the string format notation I suggested will not work.
It seems like @Burningstone’s suggestion is the way to go here.
Sorry for my absence here, but I am. Absent
Be back soon and report any progress.
Keep in mind that in 24 hour format this will make the hour field empty after midnight. I noticed on my eInk display yesterday after using code from elsewhere that used the lstrip("0").replace(" 0", " ")
.