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
333 stars 74 forks source link

Add support for browser launch timeout #96

Closed jsuchal closed 10 months ago

jsuchal commented 10 months ago

For slow hardware (e.g. home assistant running on old Raspberry Pi) the headless browser launch timeouts with error (see below).

This adds and ENV option to override the default 30s limit.

I was unable to test this on the raspberry, but I was able to replicate the behaviour on my machine by setting a very low limit (e.g. 30ms).

Not sure if I found all places where this config should be exposed, but building locally this works.

> hass-lovelace-kindle-screensaver@1.0.5 start
> node index.js

Starting browser...
/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:214
            reject(new Errors_js_1.TimeoutError(`Timed out after ${timeout} ms while trying to connect to the browser! Only Chrome at revision r${preferredRevision} is guaranteed to work.`));
                   ^

TimeoutError: Timed out after 30000 ms while trying to connect to the browser! Only Chrome at revision r901912 is guaranteed to work.
    at Timeout.onTimeout (/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:214:20)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)