i have the following template to use an input_datetime field to calculate the days that have passed since the last change of the input_datetime field in relation to the current date. It works so far, however, the value is only increased at 12:00 pm, but I would like to have it updated immediately at 00:00 when the new day begins. Do you have any idea how I could solve this?
I got this code from another forum, but nobody could help me here.
Home Assistant is also correctly configured as far as time zones etc. are concerned.
It’s actually updated every minute. It’s only updated at 12pm because you’re using ‘round(0)’ which means the number will flip at the half day mark. At 11:59am your value is 0.49 which rounds to 0, then at noon it switches to 0.5 which rounds up to 1. This happens every day at the half value. This is why you shouldn’t use round, but it won’t matter if you take @tom_l’s advice and use sensor.date.
After updating Home Assistant to version 0.115, he told me that I should replace endity_id to unique_id.
I did that, but now the sensor.date no longer works because it no longer counts automatically. Do I have to change anything else? Hope you can help me again @tom_l@petro