Giter VIP home page Giter VIP logo

hass-lovelace-kindle-screensaver's Introduction

Home Assistant Lovelace Kindle Screensaver

ci

This tool can be used to display a Lovelace view of your Home Assistant instance on a jailbroken Kindle device. It regularly takes a screenshot which can be polled and used as a screensaver image of the online screensaver plugin.

If you're looking for a way to render your own HTML, see my other project hass-kindle-screensaver which renders a React page and can be adapted to your specific needs.

Sample image

Sample image

Features

This tool regularly takes a screenshot of a specific page of your home assistant setup. It converts it into the PNG/JPEG grayscale format which Kindles can display.

Using my own Kindle 4 setup guide or the online screensaver extension for any jailbroken Kindle, this image can be regularly polled from your device so you can use it as a weather station, a display for next public transport departures etc.

Usage

You may simple set up the sibbl/hass-lovelace-kindle-screensaver docker container. The container exposes a single port (5000 by default).

Another way is to use Hassio Addons where you have to add this repository or click here. Then Reload and you should see options to the Lovelace Kindle Screensaver Addon

I recommend simply using the docker-compose.yml file inside this repository, configure everything in there and run docker-compose up -d within the file's directory. This will pull the docker image, create the container with all environment variables from the file and run it in detached mode (using -d, so it continues running even when you exit your shell/bash/ssh connection). Additionally, you can then later use docker-compose pull && docker-compose up -d to update the image in case you want to update it.

You can then access the image by doing a simple GET request to e.g. http://localhost:5000/ to receive the most recent image (might take up to 60s after the first run).

Home Assistant related stuff:

Env Var Sample value Required Array?* Description
HA_BASE_URL https://your-hass-instance.com:8123 yes no Base URL of your home assistant instance
HA_SCREENSHOT_URL /lovelace/screensaver?kiosk yes yes Relative URL to take screenshot of (btw, the ?kiosk parameter hides the nav bar using the kiosk mode project)
HA_ACCESS_TOKEN eyJ0... yes no Long-lived access token from Home Assistant, see official docs
HA_BATTERY_WEBHOOK set_kindle_battery_level no yes Webhook definied in HA which receives batteryLevel (number between 0-100) and isCharging (boolean) as JSON
LANGUAGE en no no Language to set in browser and home assistant
PREFERS_COLOR_SCHEME light no no Enable browser dark mode, use light or dark.
CRON_JOB * * * * * no no How often to take screenshot
RENDERING_TIMEOUT 10000 no no Timeout of render process, helpful if your HASS instance might be down
RENDERING_DELAY 0 no yes how long to wait between navigating to the page and taking the screenshot, in milliseconds
RENDERING_SCREEN_HEIGHT 800 no yes Height of your kindle screen resolution
RENDERING_SCREEN_WIDTH 600 no yes Width of your kindle screen resolution
BROWSER_LAUNCH_TIMEOUT 30000 no no Timeout for browser launch, helpful if your HASS instance is slow
ROTATION 0 no yes Rotation of image in degrees, e.g. use 90 or 270 to render in landscape
SCALING 1 no yes Scaling factor, e.g. 1.5 to zoom in or 0.75 to zoom out
GRAYSCALE_DEPTH 8 no yes Grayscale bit depth your kindle supports
COLOR_MODE GrayScale no yes ColorMode to use, ex: GrayScale, or TrueColor.
IMAGE_FORMAT png no no Format for the generated images. Acceptable values are png or jpeg.
DITHER false no yes Apply a dither to the images.
REMOVE_GAMMA true no no Remove gamma correction from image. Computer images are normally gamma corrected since monitors expect gamma corrected data, however some E-Ink displays expect images not to have gamma correction.

* Array means that you can set HA_SCREENSHOT_URL_2, HA_SCREENSHOT_URL_3, ... HA_SCREENSHOT_URL_n to render multiple pages within the same instance. If you use HA_SCREENSHOT_URL_2, you can also set ROTATION_2=180. If there is no ROTATION_n set, then ROTATION will be used as a fallback. You can access these additional images by making GET Requests http://localhost:5000/2, http://localhost:5000/3 etc.

To make us of the array feature in the Home Assistant Add-On, you may use ADDITIONAL_ENV_VARS. It expects a format like this to set any additional environment variable:

- name: "HA_SCREENSHOT_URL_2"
  value: "/lovelace/second-page"
- name: "ROTATION_2"
  value: "180"
- name: "HA_SCREENSHOT_URL_3"
  value: "/lovelace/third-page"

To avoid problems, please ensure that the name only contains upper case letters, numbers and underscores. The value field must be a string, so it's better to always put your value (especially numbers) into a "string" .

How to set up the webhook

The webhook setting is to let HA keep track of the battery level of the Kindle, so it can warn you about charging it. You need to do the following:

  1. See below for a patch needed to make the Kindle Online Screensaver plugin send the battery level to this application.
  2. Create two new helper entities in Home Assistant:
    1. a new input_number entity, e.g. input_number.kindle_battery_level
    2. a new input_boolean entity, e.g. input_boolean.kindle_battery_charging
  3. Add an automation to set the values of these entities using a webhook: import blueprint
  4. Define this application's environment variable HA_BATTERY_WEBHOOK to the name of the webhook defined in the previous step. For multiple devices, HA_BATTERY_WEBHOOK_2, ... HA_BATTERY_WEBHOOK_n is supported as well.

Modify the following lines in the Kindle Online Screensaver extension's bin/update.sh (absolute path on device should be /mnt/us/extensions/onlinescreensaver/bin/update.sh):

...
if [ 1 -eq $CONNECTED ]; then
-     if wget -q $IMAGE_URI -O $TMPFILE; then
+     batteryLevel=`/usr/bin/powerd_test -s | awk -F: '/Battery Level/ {print substr($2, 0, length($2)-1) - 0}'`
+     isCharging=`/usr/bin/powerd_test -s | awk -F: '/Charging/ {print substr($2,2,length($2))}'`
+     if wget -q "$IMAGE_URI?batteryLevel=$batteryLevel&isCharging=$isCharging" -O $TMPFILE; then
        mv $TMPFILE $SCREENSAVERFILE
        logger "Screen saver image updated"
...

Modify the following lines in the HASS Lovelace Kindle 4 extension's script.sh (absolute path on device should be /mnt/us/extensions/homeassistant/script.sh):

...
- DOWNLOADRESULT=$(wget -q "$IMAGE_URI" -O $TMPFILE)
+ DOWNLOADRESULT=$(wget -q "$IMAGE_URI?batteryLevel=$CHECKBATTERY&isCharging=$IS_CHARGING" -O $TMPFILE)
...

Advanced configuration

Some advanced variables for local usage which shouldn't be necessary when using Docker:

  • OUTPUT_PATH=./output (destination of rendered image, without extension. OUTPUT_2, OUTPUT_3, ... is also supported)
  • PORT=5000 (port of server, which returns the last image)
  • USE_IMAGE_MAGICK=false (use ImageMagick instead of GraphicsMagick)
  • UNSAFE_IGNORE_CERTIFICATE_ERRORS=true (ignore certificate errors of e.g. self-signed certificates at your own risk)

hass-lovelace-kindle-screensaver's People

Contributors

bictorv avatar cosote avatar davide125 avatar deenter avatar j3n50m4t avatar jaenis avatar jbraceg avatar jsuchal avatar lanrat avatar lorenzorogai avatar nbarrientos avatar paulchevalier avatar rjlee avatar sibbl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hass-lovelace-kindle-screensaver's Issues

Problem getting docker container to work

I have Docker and Portainer installed on my Synology. I am trying to run the hass-lovelace-kindle-screensaver congener using the Web editor in Portainer. When I select the standard ports 5000:5000 I get the following errors:

Deployment error
failed to deploy a stack: Creating network "lovelace-display_default" with the default driver Pulling app (sibbl/hass-lovelace-kindle-screensaver:latest)... Creating lovelace-display_app_1 ... Host is already in use by another container �[1A�[2K Creating lovelace-display_app_1 ... �[31merror�[0m �[1B ERROR: for lovelace-display_app_1 Cannot start service app: driver failed programming external connectivity on endpoint lovelace-display_app_1 (d354b6a6fd3c42e43a1058da6bcb901307d587948ed149f0204f7a29251c6a79): Error starting userland proxy: listen tcp 0.0.0.0:5000: bind: address already in use ERROR: for app Cannot start service app: driver failed programming external connectivity on endpoint lovelace-display_app_1 (d354b6a6fd3c42e43a1058da6bcb901307d587948ed149f0204f7a29251c6a79): Error starting userland proxy: listen tcp 0.0.0.0:5000: bind: address already in use Encountered errors while bringing up the project. : exit status 1

I have 2 other containers running - Portainer and Omada controller, but it seems to me that they do not use port 5000. When I change the ports for example to 8222:8222 I get the following other errors:

Deployment error
failed to deploy a stack: Creating network "lovelace-display2_default" with the default driver Creating lovelace-display2_app_1 ... �[1A�[2K Creating lovelace-display2_app_1 ... �[31merror�[0m �[1B ERROR: for lovelace-display2_app_1 Cannot start service app: Bind mount failed: '/data/compose/26/output' does not exists ERROR: for app Cannot start service app: Bind mount failed: '/data/compose/26/output' does not exists Encountered errors while bringing up the project. : exit status 1

I am a beginner in the topic of containers and I can not solve this problem, can anyone advise?

Help to debug needed

Hello,

thanks for this work. I was able to jailbrake my kindle which was a long way. No I am strugglong with what I thought will be a walk in the park. I get the following error message.

Can someone point me into the right direction for trouble shooting ...

> [email protected] start /app
> node index.js

Starting browser...
Adding authentication entry to browser's local storage...
(node:285) UnhandledPromiseRejectionWarning: Error: net::ERR_SSL_PROTOCOL_ERROR at https://10.0.10.8:8123
    at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:115:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:90:21)
    at async Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:417:16)
    at async Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:784:16)
    at async /app/index.js:31:3
(node:285) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:285) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Trouble with local and language settings

This was a great and fun project. But I have trouble setting locale and language, as shown here in the calender card with both the time beeing with AM/PM and the dates/days in english. Any tips in getting these to be in Norwegian Bokmål?

bilde

HA_BATTERY_WEBHOOK missing from add-on configuration

I've got this up and running on my HAOS install using the add-on functionality recently added. I've tried to configure the webhook functionality to update the Kindle battery charge status, but I believe I need to set the HA_BATTERY_WEBHOOK variable in order for it to function. This doesn't appear to be exposed as a configuration variable in the add-on configuration panel, which means I don't believe it's possible to use the webhook & blueprint functionality to capture the battery status when using the addon ?

Kindle won't display Image

Hello again,

the Docker-Container works now.. But the Kindle won't display the Image. The LOG-File, seems good, but in the Docker log, there is now message that the Picture is downloaded..

Screen is just blank and nothing to see..

Here is the Kindle-Log:

Fri Apr 22 12:01:28 GMT+01:59 2022: START NEW LOOP
Fri Apr 22 12:01:28 GMT+01:59 2022: Set CPU scaling governer to powersave
Fri Apr 22 12:01:28 GMT+01:59 2022: Set prevent screen saver to true
Fri Apr 22 12:01:28 GMT+01:59 2022: Battery: isCharging=0 percentage=43% current=-24 mA
Fri Apr 22 12:01:28 GMT+01:59 2022: Remaining battery 43
Fri Apr 22 12:01:28 GMT+01:59 2022: Enabling and checking wifi
Fri Apr 22 12:01:29 GMT+01:59 2022: Connected to wifi
Fri Apr 22 12:01:29 GMT+01:59 2022: Found default gateway 192.168.178.1
Fri Apr 22 12:01:29 GMT+01:59 2022: Ping worked successfully
Fri Apr 22 12:01:29 GMT+01:59 2022: Download result
Fri Apr 22 12:01:29 GMT+01:59 2022: Screen saver image file updated
Fri Apr 22 12:01:30 GMT+01:59 2022: Removed temporary files
Fri Apr 22 12:02:00 GMT+01:59 2022: SUCCESS, will update again on 1650621720

Compatibility with ARM architecture

Hi guys, first of all let me say that you are doing a wonderful job with this :) Just what I wanted for sometime now.

I have tried to install it on my home assistant machine, which is an Odroid N2 (AMR v8, running Ubuntu 20.04), and I get an error.
I have tried both directly using docker pull, as well as using docker-config up.
I believe the error is due to platform architecture mismatch.
Here is the log:

Starting hass-lovelace-kindle-screensaver_app_1 ... done
Attaching to hass-lovelace-kindle-screensaver_app_1
app_1 | standard_init_linux.go:219: exec user process caused: exec format error
hass-lovelace-kindle-screensaver_app_1 exited with code 1

Any ideas are greatly appreciated.
Thanks

Adjust font size in e-ink theme.

I just got this working on my PW2 - Thanks !

It's quite small to read the text on it though. I'm using mushroom title card to display various bits of text. Would it be possible to have a font size adjustment in the theme itself ? I'm not familiar enough with CSS.

Slideshow for non-jailbroken version

Hi,

Is it possible to add an endpoint with some little Javascript code that cycles through the various screenshots at a regular interval?

In this way the URL can be opened inside the default Kindle browser and it should work fine

Thank you

Unable to connect to Home Assistant.

image

I always get this error.

my config:

Image sibbl/hass-lovelace-kindle-screensaver:latest CMD npm start ENTRYPOINT docker-entrypoint.sh ENV
COLOR_MODE GrayScale
CRON_JOB * * * * *
GRAYSCALE_DEPTH 16
HA_ACCESS_TOKEN ZMytoken
HA_BASE_URL http://homeassistant.local:8123/
HA_SCREENSHOT_URL lovelace/1
LANGUAGE de
NODE_VERSION 16.13.0
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
RENDERING_DELAY 10000
RENDERING_SCREEN_HEIGHT 800
RENDERING_SCREEN_WIDTH 600
RENDERING_TIMEOUT 40000
ROTATION 0
SCALING 1
UNSAFE_IGNORE_CERTIFICATE_ERRORS true
USE_IMAGE_MAGICK true
YARN_VERSION 1.22.15

Emoji Support?

Currently have an calendar with an emojoi in the title

image

but it gets displayed like so...

image

Any ideas?

Make selector for element to wait for until rendering the page configurable

Hello,
First of all thanks! your project is giving my nook a second life ^^.

My bug is related to your
await page.waitForSelector("home-assistant", { timeout: Math.max(config.renderingTimeout - navigateTimespan, 1000) });
Code, as I am personally not using lovelace but I am currently more of a Tileboard user... so this check is blocking.
Easy fix but just thought I would share it.

Possible to ger colored image?

I like your project. I'ts working amazing on my NAS docker. Is it possible to get colored image instead of grayscale?

HassOS: read only filesystem

I tried installing this container on a HassOS based System using a raspberry pi.
Although i define a directory as readable and writable i get an error message that the directory for the docker container can't be created. I used the Portainer Hassio Addon to intall the container.

Does anyone have an advice?

Disable cache?

After some time (a few weeks) I no longer get the current picture. Instead, the image is taken from the cache and not updated.

[4/28/2023, 9:24:02 AM] recieved request from ::ffff:192.168.178.139 for /1.png
[4/28/2023, 9:24:02 AM] Image 1 was accessed
[4/28/2023, 9:24:02 AM] returning cached version of /dashboard-test/0?kiosk
[4/28/2023, 9:39:20 AM] recieved request from ::ffff:192.168.178.139 for /1.png
[4/28/2023, 9:39:20 AM] Image 1 was accessed
[4/28/2023, 9:39:20 AM] returning cached version of /dashboard-test/0?kiosk
[4/28/2023, 9:54:38 AM] recieved request from ::ffff:192.168.178.139 for /1.png
[4/28/2023, 9:54:38 AM] Image 1 was accessed
[4/28/2023, 9:54:38 AM] returning cached version of /dashboard-test/0?kiosk

What can I do? If I stopp and purge everything, it works again for a few weeks.

Add x-time-rendered header

Hello!

Thank you for making such an awesome tool, I was able to get it up and running in docker in minutes!

It would be awesome to add a header to the response that says when the image was rendered.

I'd like to add some simple monitoring to be alerted if the service crashes and stops refreshing the image.

Kiosk Mode in HA not working -> use Imagemagick to crop?

Hi there,

since version 23.04? the useful kiosk mode by maykar (https://github.com/maykar/kiosk-mode) isn't working properly. So at least (in my case) the header (panel) of the dashboard is still visible and is using space, that is little on an kindle e.g..
My idea: Could imagemagick crop the image first (side panel and header) before scaling it? This could be activated via a env. var. in the .yml for example.
Or any other ideas for having a full view of the dashboard?
Thank you for your work and greetings.

Can't get battery status using your own kindle 4 setup guide

I've managed to setup everything via your setup guide (not using the online screensaver extention) except for the battery status. From the description in the guide it reads like the battery status is ONLY available via the online screensaver extension (via an edited file), is this correct or should I be able to get the battery status via either method.

Step-by-step tutorial how to use this?

Hi!
First of all thank you for creating this cool project!
I'm gonna say that I'm a total noob with docker and Command-line interface and would like to ask some step-by-step guidance how to set this up.

Docker is installed on raspberry pi and I was able to pull the container by docker pull sibbl/hass-lovelace-kindle-screensaver
but when I try to run it with docker run sibbl/hass-lovelace-kindle-screensaver it displays this message:

pi@raspberrypi:~ $ docker run sibbl/hass-lovelace-kindle-screensaver

[email protected] start
node index.js

Please check your configuration
npm notice
npm notice New minor version of npm available! 8.1.0 -> 8.5.5
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.5.5
npm notice Run npm install -g [email protected] to update!
npm notice

I guess it says I need to add HA information somewhere, but how is this done?

Crash during execution

Recently installed RP4 with nothing else running on it.

root@rpi4-20230102:~# docker-compose -v   
docker-compose version 1.25.0, build unknown
root@rpi4-20230102:~# docker -v
Docker version 20.10.5+dfsg1, build 55c4c88
root@rpi4-20230102:~# uname -a
Linux rpi4-20230102 5.10.0-20-arm64 #1 SMP Debian 5.10.158-2 (2022-12-13) aarch64 GNU/Linux
root@rpi4-20230102:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

I've seen this crash a few times now :

app_1  | Failed to render TimeoutError: Navigation timeout of 30000 ms exceeded
app_1  |     at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111
app_1  | Converting rendered screenshot of http://192.168.0.99:8123/dashboard-kindle/kindle?kiosk to grayscale png...
app_1  | /app/node_modules/gm/lib/command.js:301
app_1  |           err = new Error('Command failed: ' + stderr);
app_1  |                 ^
app_1  | 
app_1  | Error: Command failed: convert: unable to open image '/output/cover.png.temp': No such file or directory @ error/blob.c/OpenBlob/3570.
app_1  | convert: no decode delegate for this image format `TEMP' @ error/constitute.c/ReadImage/741.
app_1  | convert: no images defined `/output/cover.png' @ error/convert.c/ConvertImageCommand/3342.
app_1  | 
app_1  |     at ChildProcess.onExit (/app/node_modules/gm/lib/command.js:301:17)
app_1  |     at ChildProcess.emit (node:events:513:28)
app_1  |     at maybeClose (node:internal/child_process:1100:16)
app_1  |     at Socket.<anonymous> (node:internal/child_process:458:11)
app_1  |     at Socket.emit (node:events:513:28)
app_1  |     at Pipe.<anonymous> (node:net:301:12) {
app_1  |   code: 1,
app_1  |   signal: null
app_1  | }
hass-lovelace-kindle-screensaver_app_1 exited with code 1

I should note that I had to change 3.8 to 3.7 in my docker compose file, otherwise I get this :

root@rpi4-20230102:~/hass-lovelace-kindle-screensaver# docker-compose up       
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

LMK what else you might need. Thanks.

Docker container time

I have a stange case where I have a Home assistant dashboard with a calender on it. The time of the apointments are all offset by an hour when rendered by the docker container.

I suspect it is because of daylight saving or something. It I consle into the docker container and use the "date" command I see this is also an hour out and set to UTC time. I am in the uk and we are currently on BST British summer time.

Is there a way I can set the docker container to use BST not UTC?

Screenshot of kindle (NOTE I write into some event titles the times as well)
192 168 86

Screen shot of output of home assistant
Screenshot 2022-07-22 113339

Having trouble getting container started (docker compose)

I edited the compose yaml and ran the command

docker compose up -d
[+] Running 10/10
⠿ app Pulled 35.3s
⠿ 083a2a44b72d Pull complete 1.4s
⠿ 28d22366df91 Pull complete 9.7s
⠿ 1c06832cd72a Pull complete 10.3s
⠿ c20d24f1d426 Pull complete 10.6s
⠿ 188dd0e0b943 Pull complete 10.8s
⠿ 38282be6cefd Pull complete 30.9s
⠿ dc0858d0e9e1 Pull complete 31.2s
⠿ e902242f485d Pull complete 33.4s
⠿ cdb32c37ee88 Pull complete 33.6s
[+] Running 2/2
⠿ Network hass-lovelace-kindle-screensaver_default Created 0.5s
⠿ Container hass-lovelace-kindle-screensaver-app-1 Started 1.7s

But port 5000 not reachable and no output in output dir. Checking to see if container is running and it appears not to be

pi@homeassistant:~/src/hass-lovelace-kindle-screensaver $ docker compose ls
NAME STATUS CONFIG FILES

I am admittedly terrible with docker and understanding whats happening. Im assuming its something Im doing wrong. Are there logs I can check? There are no errors generated. Any help would be greatly appreciated

Rotation messes up rendering viewport

In index.js, you swap width and height if rotating, but then use the original widht/height in the addStyleTag call. If you use size.width in place of pageConfig.renderingScreenSize.width around line 160 (and similar for .height) it works better.

Build a Hass.io addon

For devices with enough RAM and a good CPU, a Hass.io addon would make sense.

The code only requires Node.js and GraphicsMagick or ImageMagick to be installed. However, the Node.js server uses Puppeteer which again uses a Chromium binary.

As I'm using a Raspberry Pi for my Hass.io setup, having an addon doesn't make sense as it would slow down the whole system.
Maybe someone with a more powerful system might be able to help and lower the entry level.

hass-addon does not render png

Hey,

first of all big thanks for converting your project to a hass-addon!

The Plugin tells me that the render-timout is exceeded and stops. Can anyone point me in the right direction? The URL is correct and does work when i open it in a normal browser.

`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
[15:40:39] INFO: Starting npm server...
[15:40:45] INFO: Using base_url: http://192.168.178.12:8123

[email protected] start
node index.js
Starting browser...
Visiting 'http://192.168.178.12:8123' to login...
Adding authentication entry to browser's local storage...
Starting first render...
Starting rendering cronjob...
Server is running at 5000
Rendering http://192.168.178.12:8123/lovelace-eink/home?kiosk to image...
Failed to render TimeoutError: Navigation timeout of 50000 ms exceeded
at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111
Converting rendered screenshot of http://192.168.178.12:8123/lovelace-eink/home?kiosk to grayscale png...
/app/node_modules/gm/lib/command.js:301
err = new Error('Command failed: ' + stderr);
^
Error: Command failed: convert: unable to open image 'output/cover.png.temp': No such file or directory @ error/blob.c/OpenBlob/3569.
convert: no decode delegate for this image format TEMP' @ error/constitute.c/ReadImage/746. convert: no images defined output/cover.png' @ error/convert.c/ConvertImageCommand/3342.
at ChildProcess.onExit (/app/node_modules/gm/lib/command.js:301:17)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Socket. (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Pipe. (node:net:322:12) {
code: 1,
signal: null
}
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`

Unable to render PNG : `convert: unable to open image '/output/cover.png.temp': No such file or directory`

Hi,
I've tried to install and use the docker container on a RPi3 with Portainer.
Once the container is online, I cannot see any picture neither on the webpage, nor on the output directory.

Here is the error I get in logs :

[email protected] start
node index.js
Starting browser...
Visiting 'http://192.168.12.9:8123' to login...
Adding authentication entry to browser's local storage...
Starting first render...
Starting rendering cronjob...
Server is running at 5000
Rendering http://192.168.12.9:8123/lovelace/inkplate?kiosk to image...
Failed to render TimeoutError: waiting for selector home-assistant failed: timeout 27066ms exceeded
at new WaitTask (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:517:34)
at DOMWorld.waitForSelectorInPage (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:428:26)
at Object.internalHandler.waitFor (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/QueryHandler.js:31:77)
at DOMWorld.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:321:29)
at Frame.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:924:51)
at Page.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2359:33)
at renderUrlToImageAsync (/app/index.js:260:16)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async renderAndConvertAsync (/app/index.js:173:5)
Converting rendered screenshot of http://192.168.12.9:8123/lovelace/inkplate?kiosk to grayscale png...
/app/node_modules/gm/lib/command.js:301
err = new Error('Command failed: ' + stderr);
^
Error: Command failed: convert: unable to open image '/output/cover.png.temp': No such file or directory @ error/blob.c/OpenBlob/3570.
convert: no decode delegate for this image format TEMP' @ error/constitute.c/ReadImage/741. convert: no images defined /output/cover.png' @ error/convert.c/ConvertImageCommand/3342.
at ChildProcess.onExit (/app/node_modules/gm/lib/command.js:301:17)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1100:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
code: 1,
signal: null
}

I have tried with multiple websites (including the Google homepage) and it seems I get here every time...
Please accept my apologies if I miss something in reporting this issue.
Antoine

Authentication logging

Is there a way to better catch/show this in the logs?

Originally posted by @davyike in #28 (comment)

Currently, the logs show no authentication errors, so it can be hard to find if there is indeed an authentication error.

Crash waiting for selector

I get this error every start of the container after a few tries to render. It wont render an image, possibly because of different declared selectors?
My home-assistant is the latest stable and running in a separate container.
I played a bit with the render-timout but eventuelly the error comes up every time.

Failed to render TimeoutError: waiting for selector `home-assistant` failed: timeout 22712ms exceeded
    at new WaitTask (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:517:34)
    at DOMWorld.waitForSelectorInPage (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:428:26)
    at Object.internalHandler.waitFor (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/QueryHandler.js:31:77)
    at DOMWorld.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:321:29)
    at Frame.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:924:51)
    at Page.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2359:33)
    at renderUrlToImageAsync (/app/index.js:260:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async renderAndConvertAsync (/app/index.js:173:5)

Image not captured as displayed

The image isn't captured as displayed in HA, and is captured in grayscale even though I specified "TrueColor".

Config

  app:
    image: sibbl/hass-lovelace-kindle-screensaver:latest
    environment:
      - HA_BASE_URL=http://192.168.200.211:8123
      - HA_SCREENSHOT_URL=/lovelace-system/screenshot?kiosk
      - HA_ACCESS_TOKEN=my_ha_access_token
      - CRON_JOB=* * * * *
      - RENDERING_TIMEOUT=30000
      - RENDERING_SCREEN_HEIGHT=160
      - RENDERING_SCREEN_WIDTH=128
      - OUTPUT_PATH=/output/cover.png
      - SCALING=1
      - COLOR_MODE=TrueColor
    ports:
      - 5000:5000
    volumes:
      - ./output/:/output

HA Screenshot
image

Captured Image
image

Crash when connection is refused

If the server to fetch the lovelace screen from isn't up, the hass-lovelace-kindle-screensaver docker process crashes, which is inconvenient. This happens for me when the host system (which runs both Home Assistant and h-l-k-s) reboots.

It would be better if it waits a minute and tries again, and repeats until successful.

(node:26) UnhandledPromiseRejectionWarning: Error: net::ERR_CONNECTION_REFUSED at http://XXXX:8123
    at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:115:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:90:21)
    at async Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:417:16)
    at async Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:784:16)
    at async /app/index.js:36:3
(node:26) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

compose file format version 2

Hey there,

i am using home assistant and Portainer. When I wanted to install the Container via the compose file, I get an error because Portainer only allows compose file formats till version 2.

Would it be possible to have also a file for file format version 2?

Big thanks for you work!

Login failure

Hi,

thanks for your great job. I have some issues at logging in after the installation. Maybe I made a copy paste mistake with the token? Or is it some other issue?

Here is the log:

node index.js
Starting browser...
Visiting 'https://192.168.0.231:8123' to login...
/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:155
? new Error(${response.errorText} at ${url})
^
Error: net::ERR_CERT_COMMON_NAME_INVALID at https://192.168.0.231:8123
at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:155:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:130:21)
at async Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:500:16)
at async Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1167:16)
at async /app/index.js:40:3

Converting fails most of the time for no apparent reason

98% of the time the convert command fails on my Pi 4 and I can't figure out why. This is a run where it worked once and then immediately failed again. I'm not sure if I even need the conversion since I just want a full color screenshot of my dashboard

> [email protected] start
> node index.js

Starting browser...
Visiting 'http://127.0.0.1:8123' to login...
Adding authentication entry to browser's local storage...
Starting first render...
Starting rendering cronjob...
Server is running at 5000
Rendering http://127.0.0.1:8123/lovelace/wall-display-test?kiosk to image...
Converting rendered screenshot of http://127.0.0.1:8123/lovelace/wall-display-test?kiosk to grayscale png...
Finished http://127.0.0.1:8123/lovelace/wall-display-test?kiosk
2022-05-19T15:16:48.727Z: Image 1 was accessed
Invalid request: /favicon.ico for page NaN
2022-05-19T15:16:54.726Z: Image 1 was accessed
Rendering http://127.0.0.1:8123/lovelace/wall-display-test?kiosk to image...
Failed to render TimeoutError: Navigation timeout of 30000 ms exceeded
    at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111
Converting rendered screenshot of http://127.0.0.1:8123/lovelace/wall-display-test?kiosk to grayscale png...
/app/node_modules/gm/lib/command.js:301
          err = new Error('Command failed: ' + stderr);
                ^

Error: Command failed: convert: unable to open image '/output/cover.png.temp': No such file or directory @ error/blob.c/OpenBlob/3496.
convert: no decode delegate for this image format `TEMP' @ error/constitute.c/ReadImage/562.
convert: no images defined `/output/cover.png' @ error/convert.c/ConvertImageCommand/3273.

    at ChildProcess.onExit (/app/node_modules/gm/lib/command.js:301:17)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
  code: 1,
  signal: null
}

my envvars are

c
CRON_JOB=* * * * *
HA_ACCESS_TOKEN=[redacted]
HA_BASE_URL=http://127.0.0.1:8123
HA_SCREENSHOT_URL=/lovelace/wall-display-test?kiosk
LANGUAGE=de
NODE_VERSION=16.13.0
OUTPUT_PATH=/output/cover.png
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
RENDERING_SCREEN_HEIGHT=448
RENDERING_SCREEN_WIDTH=600
RENDERING_TIMEOUT=30000
ROTATION=0
SCALING=0.75
USE_IMAGE_MAGICK=true
YARN_VERSION=1.22.15
COLOR_MODE=TrueColor
RENDERING_DELAY=2000

Add option to reset zoom?

When using the kiosk javascript (?kiosk at the end of a URL) in HomeAssistant, many browsers including node-js will be default render a bar at the top where the header would normally be. You can see this in my work-in-progress here.

energy3

This sacrifices around 10% of the image. The only way I've found to fix this in any browser is to zoom (in or out, it doesn't matter) and then reset to default. The bar goes away and the image fills the entire frame. This is entirely reproducible by loading kiosk.js (maykar/kiosk-mode) and accessing a URL with ?kiosk appended.

Is there any way to build an option to do this?

Online Screensaver Extension not compatible

Hi,

I wanted to use the online screensaver extension but this says it needs a URL ending with an image extension like .png (see conf.sh).
As this repo only provides the image without the file ending, I can't get it to work (at least that's my guess)

Is there any way to use the filename ?

Thanks

Failed to render TimeoutError: waiting for selector `home-assistant` failed: timeout 8986ms exceeded

Hoping you can help me here. I've set up the docker container:

docker create --name="ha-kindle-screensaver" -p 5050:5000 -e HA_BASE_URL="https://<MYURL>" -e HA_SCREENSHOT_URL="/lovelace/climate?kiosk" -e HA_ACCESS_TOKEN="<ACCESSTOKEN>" --restart=always sibbl/hass-lovelace-kindle-screensaver

I get the following in the logs:

> [email protected] start
> node index.js

Starting browser...
Visiting 'https://<MYURL>' to login...
Adding authentication entry to browser's local storage...
Starting first render...
Starting rendering cronjob...
Server is running at 5000
Rendering https://<MYURL>/lovelace/climate?kiosk to image...
Failed to render TimeoutError: waiting for selector `home-assistant` failed: timeout 8986ms exceeded
    at new WaitTask (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:517:34)
    at DOMWorld.waitForSelectorInPage (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:428:26)
    at Object.internalHandler.waitFor (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/QueryHandler.js:31:77)
    at DOMWorld.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:321:29)
    at Frame.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:924:51)
    at Page.waitForSelector (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2359:33)
    at renderUrlToImageAsync (/app/index.js:257:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async renderAndConvertAsync (/app/index.js:171:5)
Converting rendered screenshot of https://<MYURL>/lovelace/climate?kiosk to grayscale png...
/app/node_modules/gm/lib/command.js:301
          err = new Error('Command failed: ' + stderr);

Unsurprisingly, I get "Image not found" when hitting the server. Any tips? It looks like it's authenticating OK, right?

  • I can hit the URL myself and it renders as expected
  • The page loads in about 1 second when I load it myself

Connection is not possible..

Hello,

I tried to use your Docker-Container to build an own Kindle-Display.. But sadly I cannot start your Container:
Network is set to HOST, Token is freshly generated via HA-WebUi, its running in Portainer..
I attached the LOGs if you need any further information just let me know..
I checked the URL and if I open the same URL in my Browser I can open it without any issues.

LOGs
ProtocolError: Protocol error (Page.navigate): Cannot navigate to invalid URL
  at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:24
  at new Promise (<anonymous>)
  at CDPSession.send (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:222:16)
  at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:148:47)
  at FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:131:13)
  at Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:500:41)
  at Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1167:53)
  at /app/index.js:40:14
  at processTicksAndRejections (node:internal/process/task_queues:96:5) {
originalMessage: 'Cannot navigate to invalid URL'
}

> [email protected] start
> node index.js

Starting browser...
Visiting '192.168.XXX.XXX:8123' to login...
/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226
              error: new Errors_js_1.ProtocolError(),
                     ^

ProtocolError: Protocol error (Page.navigate): Cannot navigate to invalid URL
  at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:24
  at new Promise (<anonymous>)
  at CDPSession.send (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:222:16)
  at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:148:47)
  at FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:131:13)
  at Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:500:41)
  at Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1167:53)
  at /app/index.js:40:14
  at processTicksAndRejections (node:internal/process/task_queues:96:5) {
originalMessage: 'Cannot navigate to invalid URL'
}

> [email protected] start
> node index.js

Starting browser...
Visiting '192.168.XXX.XXX:8123' to login...
/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226
              error: new Errors_js_1.ProtocolError(),
                     ^

ProtocolError: Protocol error (Page.navigate): Cannot navigate to invalid URL
  at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:24
  at new Promise (<anonymous>)
  at CDPSession.send (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:222:16)
  at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:148:47)
  at FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:131:13)
  at Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:500:41)
  at Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1167:53)
  at /app/index.js:40:14
  at processTicksAndRejections (node:internal/process/task_queues:96:5) {
originalMessage: 'Cannot navigate to invalid URL'
}

> [email protected] start
> node index.js

Starting browser...
Visiting '192.168.XXX.XXX:8123' to login...
/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226
              error: new Errors_js_1.ProtocolError(),
                     ^

ProtocolError: Protocol error (Page.navigate): Cannot navigate to invalid URL
  at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:24
  at new Promise (<anonymous>)
  at CDPSession.send (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:222:16)
  at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:148:47)
  at FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:131:13)
  at Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:500:41)
  at Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1167:53)
  at /app/index.js:40:14
  at processTicksAndRejections (node:internal/process/task_queues:96:5) {
originalMessage: 'Cannot navigate to invalid URL'
}

> [email protected] start
> node index.js

Starting browser...
Visiting '192.168.xxx.xxx:8123' to login...
/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226
              error: new Errors_js_1.ProtocolError(),
                     ^

ProtocolError: Protocol error (Page.navigate): Cannot navigate to invalid URL
  at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:24
  at new Promise (<anonymous>)
  at CDPSession.send (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:222:16)
  at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:148:47)
  at FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:131:13)
  at Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:500:41)
  at Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1167:53)
  at /app/index.js:40:14
  at processTicksAndRejections (node:internal/process/task_queues:96:5) {
originalMessage: 'Cannot navigate to invalid URL'
}

Invalid request to /output/cover.png

Hey,
i just reinstalled your docker container on a raspberry pi 3 with portainer via docker-compose. When i start your plugin everything is fine but when i want to look up the rendered image i get this error message:

"Invalid request to /output/cover.png"

Do you have an idea?

Thank you for your help!

Cosmetic Add-On Bug: HA_BASE_URL in Asterisk/hidden

I have added this Repo as Home Assistant Addon and it was recognized without any problem.
It works without any problem but I stumbled upon a config value that is in asterisk (hidden) characters which in my opinion should not be:
grafik
Especially when the "hidden" value is shown in the logs as plain text.

Luckily the logs show if the path is right or not:
grafik

This makes it harder to type in the string, but not impossible.

Thanks alot for merging and making it extremely easier for non tech savvi ppl.

Strange zoom issue...

When left to automatically pull the latest image, the image is all zoomed in

image

If I then unlock and relock my kindle, the image looks fine

image

Any ideas?

Here is my docker compose

hass-lovelace-kindle-screensaver:
    image: sibbl/hass-lovelace-kindle-screensaver:latest
    restart: unless-stopped
    environment:
      - HA_BASE_URL=http://192.168.1.50:8123
      - HA_SCREENSHOT_URL=/lovelace-test/kindle?kiosk
      - HA_ACCESS_TOKEN=xxx
      - CRON_JOB=* * * * *
      - RENDERING_TIMEOUT=30000
      - RENDERING_DELAY=20000
      - RENDERING_SCREEN_HEIGHT=1448
      - RENDERING_SCREEN_WIDTH=1072
      - GRAYSCALE_DEPTH=8
      - COLOR_MODE=TrueColor
      - OUTPUT_PATH=/output/cover.png
      - LANGUAGE=en
      - ROTATION=0
      - SCALING=2
      - HA_BATTERY_WEBHOOK=set_kindle_battery_level
    ports:
      - 8888:5000
    volumes:
      - ./output/:/output

Ability to set timezone when launching puppeteer?

Hi there,

Thanks for pushing this out - finding it saved me a ton of fiddly work making something similar myself!

I have found one issue - when I launch the process in a Docker container, it seems that the timezone Chromium detects is UTC. This means that widgets that depend on date/time like the calendar display the wrong values.

It's possible to force the timezone Chromium uses by setting the TZ env var when launching puppeteer. Very happy to send a PR for this, as long as you agree that it's a sensible thing to do.

What are your thoughts?

Execution context was destroyed, most likely because of navifation.

Hello everybody,
I'm desperate - don't know what I'm doing wrong.
Running HASS on RPi3, hass-lovelace-kindle-screensaver worked well, until last week, when it starts falling. Now it refuses to create png file and quits on start.
I will be happy for any idea.
Thanks

[email protected] start
node index.js
Starting browser...
Visiting 'http://192.168.20.19:8123' to login...
Adding authentication entry to browser's local storage...
/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:265
throw new Error('Execution context was destroyed, most likely because of a navigation.');
^
Error: Execution context was destroyed, most likely because of a navigation.
at rewriteError (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:265:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ExecutionContext._evaluateInternal (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:219:60)
at async ExecutionContext.evaluate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async /app/index.js:51:3
npm notice
npm notice New major version of npm available! 8.19.3 -> 9.6.7
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.7
npm notice Run npm install -g [email protected] to update!
npm notice

Ignore self-signed certificates (enhancement)

Hello, as mentioned in #4 - there is no option to render pages from HA when a self-signed certificate exists. It would be nice to include an extra configuration option that would then trigger the addition of the argument "--ignore-certificate-errors" in the command for chromium.

I've tested by mounting /app on a local folder outside the container with a modified index.js that contains the extra argument and it works.

Time Settings -

Hi,

thank you for providing the docker container. One thing I observed was a time zone discrepancy with day-light saving time. My rendered screenshot was always 1 hour earlier than the actual system time.

I solved this by using the
TZ=Europe/City
environment variable in the docker-compose file. This correctly displayed the correct time.

Hope this solves somebody some troubles

HA 2021.11 gives logo + "Loading data"

Since I updated to Home Assistant 2021.11, I just get a Home Assistant logo and "Loading data" in the screensaver screenshot. Something must have changed, but what, and how can it be handled?

Screenshot (rotated 90):

foo

How to Change Port?

Hi,

just a short question: Is there an Port-Variable to change it if you want to run it multiple instances?

Best regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.