Closed rjfendricks closed 8 months ago
I had been thinking about adding a refresh timer in. Thats great, thanks.
One comment, what do you think of calling it refreshTimer instead? I think it might make more sense to the end user.
Im concerned about the lockup, I personally had issues where I was getting DNS limitations from my pi-hole that would stop MM from getting DNS lookup for HA. But I moved off of it to adguard and that went away and I have not had them since.
Thanks
Seems reasonable to me! I agree that refreshTimer is a more accurate name for the configuration.
Also, @wonderslug, I'm curious if you think the configuration in the config.js
file should be set using milliseconds or seconds. I chose milliseconds because it's what setInterval
expects, but I could be convinced that seconds may be a better unit given the timeframe that homeassistant operates at.
I would say seconds would be better. I can see somethings needing refresh every 10 to 15 seconds (entity_picture like you said) but its not intended to be video streaming so the 1 second lowest would probably be fine. Lower then that would be a lot of pinging on the HA API.
Agreed, in fact for my use case I refresh my picture every 15 seconds as any faster looks bad with the image reloading. Plus, it's easier to parse out 15 seconds as opposed to 15000 milliseconds. I just pushed up a commit to have the configuration expect seconds instead of milliseconds.
This PR adds a Section configuration option to re-render the displayTemplate every N milliseconds, regardless of whether an entity has changed states or not.
I have one legitimate use case and one hacky use case for this.
The legitimate use case is for the occasion when you want to get a resource from the Home Assistant server that changes over time but does not have an event tied to it. A good example of this is the
entity_picture
state attribute of acamera
entity that represents a security camera. This picture is almost constantly updating, but thecamera
state does not change with it.The hacky use case is to bypass issue #21. The timer can act as a fail safe in the case that the module stops updating properly. I don't really like this as a solution, but it's better than nothing.