sibbl / hass-lovelace-kindle-screensaver

This tool generates a png from a Home Assistant Lovelace view, which can be displayed on a Kindle device which has the Online Screensaver plugin installed.
MIT License
311 stars 71 forks source link

Let browser stay open in the background the whole time to allow faster snapshot rendering intervals #56

Open ksheyman opened 1 year ago

ksheyman commented 1 year ago

Hey this is a really cool tool. I am trying to use it to basically create a dummy camera in a Frigate instance, and display a lovelace page in my Birdseye alongside the security cameras. The only problem is that in frigate ffmpeg times out after 20 seconds, and this only updates the image at most once per minute. Is there any way I could increase that?

sibbl commented 1 year ago

Hi, that's some very ... let's call it interesting ... use case.

I've actually had something like this in mind before but it will require some rework. Right now it's quite intentional not to render that often as this will reduce the life-time of eink screens, which it was intentionally develop for. Due to that, the browser is always unloaded and on each render, a new browser page is started, it navigates to the page and then at some point the rendering can happen. This just takes some time and saves some resources - especially on slower devices like Raspberry Pis.

However, it might make sense to have a config option to leave the browser page running the whole time. It will need more RAM and probably also some CPU (the Home Assistant websocket stays connected and all updates are processed all the time) but will allow taking a snapshot at any required frequency as no further loading or navigation is necessary.

I'd put that on my list and see when I can work on that. Any PR would be appreciated as well, adding the "keepBrowserOpen" config option and skipping browser page closing/reopening/navigation when this config option is set to true.

ksheyman commented 1 year ago

Lol nobody respects my noble quest to go backwards in terms of lovelace/frigate!

Sounds like this should be possible! Thanks for the reply and explanation. If only I knew about coding beyond YAML I would help out...