I want to set as large of a scan_interval as possible and then only update the sensor right before it is needed in an automation by using homeassistant.update_entity. The reason is because the more times the sensor below is updated, the more quickly the cookie expires. (The cookie is needed by alexa_remote_control.sh which is called from alexa_wrapper.py).
I have one with 86400 (24 hours) which seems to work.
Although having said that, the reason I use 86400 is because I only want the sensor to update when I say so which means I donāt actually know if the 86400 works. But it doesnāt break it!
Yeah, Iām not sure how to test. I can set it to a large number and wait and see how many days it took to expire the cookie but I cannot use that to calculate what is the maximum scan_interval. Yesterday, I tried a value of 315360000 which is 10 years and I did not get an error on boot up, but Iām still not sure if that is a valid value for scan_interval. I feel like knowing what the maximum scan_interval can be, could be of value for everyone, but I think only a programmer that knows that code can tell us.
So I believe the units are in seconds. And much of the code from what I can understand (I am not a Python developer), uses a library called ātimedeltaā for initialization, and various units can be used for that, for the sensors and devices HA supports (minutes, seconds, days etc).
But I think for the interval listeners HA sets up, every n seconds (scan_interval), it just grabs the current utc time, and adds the interval to it. So 31536000 secs for the year.
Iāll get back to you in a year and let you know if it worked
Thereās still no magic number that makes it āmanual onlyā if thatās what youāre wondering. I think I had one set to a week (604800) at one point but then I realized it was trying to update the sensor every time HA restarted which kind of defeated the point.
If you donāt update and donāt often make changes to your HA which require a reboot you could try and see what happens if you go with massive numbers. But if you do either of those things not much point to going beyond a day or two.