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

Browser is not starting #84

Closed Pattern91 closed 9 months ago

Pattern91 commented 10 months ago

Hey, since a few weeks i got an error saying that in can't start the browser. I just reinstalled the addon but got the same error. Previously it was working just fine. Here is the log:

`> 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) Node.js v18.16.0 s6-rc: info: service legacy-services: stopping s6-rc: info: service legacy-services successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped`

all is running on a RPi 3B+, latest HaOS

nb341153 commented 9 months ago

Came here to check for my issue and found that my problem seems identical with @Pattern91 problem:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[06:48:23] INFO: Starting npm server...
[06:48:32] INFO: Using base_url: http://xxxxxxxxxxx
> 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)
Node.js v18.16.0
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Running on a rpi3-64 with: Home Assistant 2023.9.3 Supervisor 2023.09.2 Operating System 10.5 Frontend 20230911.0 - latest

nb341153 commented 9 months ago

@Pattern91 are you still stuck at this point or were you able to resolve it in the meantime?

Pattern91 commented 9 months ago

Almost. I didn’t change anything instead of updating HomeAssistant when the problem started. I then tried disabling not used Addons within HomeAssistant to clear up RAM. This seemed to help although I don’t know why a few 100 MB of RAM are needed…

nb341153 commented 9 months ago

Thanks for the feedback. Was also successfull with disabling another add-on (in my case Grafana) and now it is running 👍

sibbl commented 9 months ago

Unfortunately the addon is very hungry when it comes to resources. I still decided to allow installing it on any device and find out yourself if it's running stably or not.

Keep in mind that there's a browser instance running in the background and this addon just takes screenshots from the site, when it has rendered. This takes some CPU and RAM when it takes the screenshots and idles for the rest of the time. In average the resource usage might not look that bad, but on the peek time when navigating to the page and taking a screenshot, the browser takes what it needs... and fails if it doesn't find the resources for that.

There's not much I can do about it as long as we want to take screenshots of the page. The only alternative would be to use other projects which only fetch data and render these in a SVG graphic or so, which doesn't need a full browser instance. Lovelace however currently requires a full featured browser.