Closed andyb2000 closed 4 months ago
After writing this, I may have spotted the issue. Entering the container and looking at /data/options.json it does NOT show the changes I made (adding the _2 options). Checking the YAML config, it was there in the addons gui so it's stored somewhere, but potentially not being written to the container? I manually changed /data/options.json to match, restarted container but the changes were again lost and the _2 options disappeared so this could be the problem.
Bit more debugging, I suspect this is the issue, the env variables aren't being set by the /run.sh script:
I'm testing in my repo by modifying the /run.sh so hopefully will debug and push a fix to you soon, but I'm struggling to modify docker (not a docker expert!)
Hey @andyb2000, thanks for the request. I'm no Hassio addon expert as well but create a new branch with a new preview version 1.0.7 on this branch yesterday: https://github.com/sibbl/hass-lovelace-kindle-screensaver/tree/hass-addon-add-additional-env-vars
After removing your current repository from Hass Addon, you can add https://github.com/sibbl/hass-lovelace-kindle-screensaver#hass-addon-add-additional-env-vars
there to test it. It should install 1.0.7 with the changes.
There should be a new field ADDITIONAL_ENV_VARS
where you can enter additional entries like HA_SCREENSHOT_URL_2=foobar
line by line. Unfortunately I have not setup over here which I can use to test it right away. I'm also not 100% sure how this field shows up. I've reused code from the Grafana addon which shows a textarea to enter multiple lines. I'd expect it to look similar here.
Maybe this helps already?
That's great, thank you for looking @sibbl So far, looking good, used the input box to allow me to add the additional environmental variables and flipping into edit yaml mode looks promising:
HA_BASE_URL: http://192.168.X.X:8123
HA_SCREENSHOT_URL: /lovelace/wallboard1
HA_ACCESS_TOKEN: >-
REDACT
LANGUAGE: en
CRON_JOB: "*/5 * * * *"
RENDERING_TIMEOUT: "60000"
RENDERING_DELAY: "0"
RENDERING_SCREEN_HEIGHT: 680
RENDERING_SCREEN_WIDTH: 450
BROWSER_LAUNCH_TIMEOUT: 60000
ROTATION: "0"
SCALING: "1"
GRAYSCALE_DEPTH: "8"
COLOR_MODE: TrueColor
PREFERS_COLOR_SCHEME: light
HA_BATTERY_WEBHOOK: ""
ADDITIONAL_ENV_VARS:
- "HA_SCREENSHOT_URL_2: /lovelace/wallboard2"
- "RENDERING_SCREEN_HEIGHT_2: 800"
- "RENDERING_SCREEN_WIDTH_2: 450"
But looks like something isn't happy now on the parser level:
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
[13:57:43] INFO: Loading config...
[13:57:50] INFO: Loading additional environment variables...
jq: error (at <stdin>:1): Cannot index string with string "name"
jq: error (at <stdin>:1): Cannot index string with string "value"
[13:57:52] INFO: Setting to
/run.sh: line 27: export: `=': not a valid identifier
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
The config field looks like this:
So I dropped off the additional vars config to check and it started up all OK. I'll have a dig into it, see if I can spot the issue.
Please use RENDERING_SCREEN_HEIGHT_2=800
instead of RENDERING_SCREEN_HEIGHT_2: 800
, so a =
instead of the :
No luck with that unfortunately.
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
[14:43:06] INFO: Loading config...
[14:43:13] INFO: Loading additional environment variables...
jq: error (at <stdin>:1): Cannot index string with string "name"
jq: error (at <stdin>:1): Cannot index string with string "value"
[14:43:14] INFO: Setting to
/run.sh: line 27: export: `=': not a valid identifier
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
In YAML that shows as:
ADDITIONAL_ENV_VARS:
- HA_SCREENSHOT_URL_2=/lovelace/wallboard2
- RENDERING_SCREEN_HEIGHT_2=800
- RENDERING_SCREEN_WIDTH_2=450
I'm sorry, I misunderstood how the Grafana addon works. Version 1.0.7 is just building again with some (untested) fix.
The format of the ADDITIONAL_ENV_VARS
value must be like
- name: "HA_SCREENSHOT_URL_2"
value: "/lovelace/wallboard2"
- name: "RENDERING_SCREEN_HEIGHT_2"
value: "800"
- name: "RENDERING_SCREEN_WIDTH_2"
value: "450"
Let me also try to set up a supervised HA locally and verify that this works as expected.
Works on my machine so far, and I've merged into the main branch. Hope this works for you now as well 👍 please don't forget to add the normal repository to your Home Assistant Add-On store again.
Thanks, trying that now but unsure if something else has caused a basic config not to work (before adding additional urls) as I'm constantly getting this:
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:41:07] INFO: Loading config...
[15:41:16] INFO: Loading additional environment variables...
[15:41:16] INFO: Using HA_BASE_URL: http://192.168.X.X:8123
[15:41:16] INFO: Starting server...
> hass-lovelace-kindle-screensaver@1.0.7 start
> node index.js
Starting browser...
Visiting 'http://192.168.X.X:8123' to login...
Adding authentication entry to browser's local storage...
Starting first render...
Rendering http://192.168.X.X:8123/lovelace/wallboard1 to image...
Failed to render TimeoutError: Navigation timeout of 60000 ms exceeded
at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111
Converting rendered screenshot of http://192.168.X.X:8123/lovelace/wallboard 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: unrecognized dither method `-background' @ error/convert.c/ConvertImageCommand/1422.
at ChildProcess.onExit (/app/node_modules/gm/lib/command.js:301:17)
at ChildProcess.emit (node:events:517:28)
at maybeClose (node:internal/child_process:1098:16)
at Socket.<anonymous> (node:internal/child_process:450:11)
at Socket.emit (node:events:517:28)
at Pipe.<anonymous> (node:net:350:12) {
code: 1,
signal: null
}
Node.js v18.19.1
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
Still no luck with the multiple vars entries, defo something HA and the add-on specific way of getting data in there:
I tried with : and with = then via YAML and it still didn't like the formatting unfortunately
I think maybe go back to the str entry method for those additional vars and correct them at the env setting level since that seems to be a logical way for the frontend?
The -background
error should be solved with 1.0.8. It was about some different config entry and had nothing to do with this one.
The format in your screenshot still doesn't look like the one necessary. HA does some validation, that's why it shows the error. Please see the YAML from this comment as a reference to what you need to paste into the text box you see in your screenshot:
https://github.com/sibbl/hass-lovelace-kindle-screensaver/issues/110#issuecomment-1959618600
I'd prefer to stick to this "name-value" syntax as other HA Add-Ons also use the same syntax. People might now it from there already. I've also tried to document it in the README.
By the introduction of ADDITIONAL_ENV_VARS
for the Home Assistant Add-On this should be working by now.
Hi, Unsure if this is my mistake in configuration/implementation or if there is a bug. Installation done via Add-ons, and adding the repo (https://github.com/sibbl/hass-lovelace-kindle-screensaver) to addon library. Configuration initially done using the configuration tab to get it working with just one url/image to grab. Works great. Config is:
I then wanted to add a second image, so I went into YAML config mode in the add-on and added:
However this doesn't appear to work, restarting the container via the add-on start/stop function. It then doesn't appear to grab the second url and gives an error cannot grab the second image. Here's the log output: