I have restful sensor that gets a new date (state change) every 14 days.
The restful sensor has a force_update: true and a polling interval of half a day
Then I have a second sensor that calculates the number of days from now() until the restful sensor date.
My problem is that since the restful sensor updates but does not get a state change (well, every 14 days it does) my countdown sensor never gets updated. It just shows the number of days that was calculated at the last time Hass was restarted.
Is there any ways I van get the countdown to work? It needs to count down once or twice a day
Can you share your config? As far as I know template sensors should update in line with the entity_id it’s taking the value from. Unless you use a different method>
Should I see the updates on the graphic state bar of the rest sensor, or does it need a state change to show a “break point”? I wonder if my rest sensor is not updating… Currently I have polling set to 7200 secs (2 hours)
I am not in front og my computer, will post config later. Thanks!
Silly question : does the sensor return a value that changes? If it returns a date which doesn’t change, its state will not change and therefore the template sensor will not update.
@leinich Problem with that is when it changes months, it will report an incorrect countdown if you are subtracting days (for example due date is January 1st and today is December 19) 1 - 19 = -18.
What I’d do is convert the restful sensor into a UTC datestamp (in seconds) and then subtract now (in seconds) and then convert into days ( / 24 / 60 / 60)
Calculating and showing number of days directly in the rest sensor iself solved this. I then get a new countdown value for each rest sensor poll interval