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

Home Assistant Addon - Second Image Not Working #83

Closed jollybully closed 4 months ago

jollybully commented 10 months ago

Hey, thanks for this great project!

I've just migrated to the home assistant addon after successfully using the standalone docker container for the last year or so.

I'm currently unable to capture a second screenshot using HA_SCREENSHOT_URL_2. My addon configuration is below, any ideas, am I missing something obvious here? Thanks!

HA_BASE_URL: <<REMOVED>>:8123
HA_SCREENSHOT_URL: /lovelace/kindle?kiosk
HA_ACCESS_TOKEN: >-
<<REMOVED>>
LANGUAGE: en
CRON_JOB: "* * * * *"
RENDERING_TIMEOUT: "60000"
RENDERING_DELAY: 2000
RENDERING_SCREEN_HEIGHT: "800"
RENDERING_SCREEN_WIDTH: "600"
ROTATION: "0"
SCALING: "1"
GRAYSCALE_DEPTH: "8"
COLOR_MODE: GrayScale
HA_BATTERY_WEBHOOK: ""
HA_SCREENSHOT_URL_2: /lovelace/kindle-2?kiosk
sibbl commented 10 months ago

Hey, do you have any more details about what exactly is not working?

You should be able to access the 2nd image by appending /2 to the URL of the container.

A log output would be helpful to understand if the 2nd image is generated or not, and whether you access it properly. Both things are logged.

jollybully commented 10 months ago

Hey Sibbl,

Certainly, addon logs below, it doesn't look like the second image is ever getting generated:

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
[12:48:19] INFO: Starting npm server...
[12:48:20] INFO: Using base_url: http://hass2.local:8123
> hass-lovelace-kindle-screensaver@1.0.5 start
> node index.js
Starting browser...
Visiting 'http://hass2.local:8123' to login...
Adding authentication entry to browser's local storage...
Starting first render...
Starting rendering cronjob...
Server is running at 5000
Rendering http://hass2.local:8123/lovelace/kindle?kiosk to image...
Converting rendered screenshot of http://hass2.local:8123/lovelace/kindle?kiosk to grayscale png...
Finished http://hass2.local:8123/lovelace/kindle?kiosk

When hitting the the second image url i'm getting an invalid request response and the logs reflect this also:

Invalid request: /2 for page 2
Invalid request: /favicon.ico for page NaN

Am I right in thinking that all I should need to do is manually add the _HA_SCREENSHOT_URL2 key and value to the yaml configuration for the addon?

Thanks!

jollybully commented 8 months ago

Hi I've also found this error in the supervisor logs:

23-10-19 10:49:58 WARNING (MainThread) [supervisor.addons.options] Option 'HA_SCREENSHOT_URL_2' does not exist in the schema for Lovelace Kindle Screensaver (a877bbfb_kindle-screensaver)

Does that help?

sibbl commented 8 months ago

That definitely helps, thanks! It seems like the HA Addon config wasn't prepared for this. I didn't create it as I use HA and the kindle screensaver differently.

In the HA addon, one has to define each single property and can't make it as flexible as the Docker container allows the config to be. The easiest fix might be to add a the numbers up to 5 or so and make them optional... I'll take a look whether there's a more straight forward option.

zarqeon commented 8 months ago

Hi, is there any update on this? I would ever be happy with a temporary solution of adding like 5 of them to the config for now, but I don't really know how that should be done on a local level :(

sibbl commented 4 months ago

By the introduction of ADDITIONAL_ENV_VARS for the Home Assistant Add-On this should be working by now.