Comments (18)
@jbraceg thanks for the link. They say:
You can override the timezone in chromium by setting the TZ env var.
It's enough to set the TZ
env variable in docker, e.g. in docker-compose.yaml. This worked for me:
environment:
...
- TZ=Europe/Warsaw
Would be nice to add it to the README but it's not obvious where to put it with the current structure 🙂
from hass-lovelace-kindle-screensaver.
Another way is using "docker -v /etc/localtime:/etc/localtime:ro".
from hass-lovelace-kindle-screensaver.
I found and solved the issue!
I think the problem has to do with the alpine linux docker container's version of libc and chrome's. There is a slight version incompatibility that breaks chrome's ability to use the correct timezone.
Luckily this has been fixed already in the newer versions of the base container. Edit the Dockerfile
and set it to use node:17-alpine
as the base and rebuild the image. All dates and local setting should work now!
I'll be submitting a PR soon from my fork with this fix and some other features.
from hass-lovelace-kindle-screensaver.
@lanrat thanks for your reply including the new details! It's good to now that at least the timezone works now, if I understand you correct.
Regarding formatting of numbers and dates, I guess we have to wait until a newer chromium binary will be available.
Until then, I think it might be the best to set specific number + date/time formats within home assistant. For each user, this can be done in the profile by clicking the user profile icon in the lower left corner and by default it's set to "auto (use browser settings)". I know it's not perfect, but perhaps it also solves the issue meanwhile?
from hass-lovelace-kindle-screensaver.
I've tried setting the TZ
variable and using a /etc/localtime:/etc/localtime:ro
volume with no luck. In both cases I still get UTC timezones.
Have anyone found a way to get the screenshot to use the correct timezone?
from hass-lovelace-kindle-screensaver.
I also get UTC since a few weeks, and I'm struggling to see what causes the problem. "It used to work". :-(
from hass-lovelace-kindle-screensaver.
I spent some time playing with this and tweaking the container and code.
Installing the tzdata
package will have the alpine node container set its local timezone/date to whatever you pass in with the TZ
variable. but I'm not sure if this is needed for chrome. When doing this, node gets the correct timezone, and so does chrome.
I suspect that the issue might have something to do with a change on Home Assistant's end. The problem is definitively in Home Assistant's front end as I hard-coded all of the backend to use my timezone, but when rendering the front end it uses UTC.
I'm trying to figure out how Home Assistant determines what timezone to use for the front end. My guess is that its missing some HTTP header.
from hass-lovelace-kindle-screensaver.
@bictorv did you upgrade hass-lovelace-kindle-screensaver or Home Assistant when you started noticing the issue? If we can narrow down a change to either that introduced the issue I might be able to find a fix.
from hass-lovelace-kindle-screensaver.
Yes I did, and I thought I reported it here, but apparently not. Now I forget exactly which update it was, but will try to find out.
Do you mean installing tzdata
helps? More precisely which tzdata
package, installed where/how? (I'm new to docker and alpine and puppeteer and... feeling a bit old sometimes.)
from hass-lovelace-kindle-screensaver.
@bictorv do you remember about when you upgraded? or when you last remember it working? Was the upgrade that broke it Home Assistant or hass-lovelace-kindle-screensaver?
I installed tzdata by adding it to the Dockerfile and rebuilding, but it did not fix the issue for chrome, so its not a solution.
from hass-lovelace-kindle-screensaver.
It was an Home Assistant upgrade, I would guess 2021.10.x, or possibly 2021.9.x.
When you write chrome, do you mean/include chromium, which I believe is what my installation is using?
And adding tzdata
to Dockerfile in the RUN apk
line or or elsewhere?
from hass-lovelace-kindle-screensaver.
Well with 2021.11 I just get a screenshot of the Home Assistant logo with "Loading data" under it. Something changed, apparently.
from hass-lovelace-kindle-screensaver.
@lanrat I've just fixed another issue and also updated both Puppeteer and Alpine.
However, I was forced to use Alpine 3.11 instead of the latest version 3.14 as its the last version where a armv7 binary of chromium is available for (see here).
I'd be happy to know if this already fixes the issue or whether we might have to think about other solutions. Thanks in advance!
from hass-lovelace-kindle-screensaver.
Thanks for updating the base image.
When using the base image node:16-alpine3.11
the correct timezone is being used by chrome. But the date local formatting does not work. When using node:17-alpine
as the base, both the timezone and local formatting work. See the below examples from my weather card:
Image built from node:16-alpine3.11
:
Image built from node:17-alpine
:
As you can see, with alpine 3.11, the times use a 24 hour format (the default if unset by the local) but when using the latest version they are correctly shown with AM/PM.
I'm unsure of the underlying cause for this and if its possible to fix it without using node:17-alpine
.
from hass-lovelace-kindle-screensaver.
Correct, the timezone issue appears to be fixed.
I just did a test using node:16-alpine
and can confirm that both the timezone and local formatting work correctly. So its an issue with alpine3.11 and not the difference in node versions.
from hass-lovelace-kindle-screensaver.
The date is still formatted wrong when using node:16-alpine3.11
.
Using node:17-alpine
fixes the date formatting issue.
from hass-lovelace-kindle-screensaver.
How can I (most easily) get/setup/compile a version of node:17-alpine with chromium, given there is no armv7 binary of chromium at the link @sibbl gave above?
from hass-lovelace-kindle-screensaver.
Fyi, the alpine 3.17 build of chromium included an armv7 binary again. I've just updated the image to use this as a new base.
from hass-lovelace-kindle-screensaver.
Related Issues (20)
- Error and questions connecting with Hassio Addon HOT 3
- failed to start browser in docker HOT 8
- Feature Request: Multiple Dashboards/Instances HOT 1
- docker failed to start HOT 1
- HA OS 32bit not supported? HOT 9
- Timeout Errors HOT 2
- Feature Request: .monochrome and .crop would be awesome!
- Feature request: output to jpg file format HOT 8
- Multiple request array doesnt appear to accept configuration HOT 13
- Error: Command failed: convert: unrecognized dither method `-background' HOT 8
- Feature request - Stop container exiting after error HOT 2
- How to select which theme to take? HOT 2
- Feature Check - ARM Builds HOT 2
- Extension extremely unstable HOT 5
- Failed to render TimeoutError: Navigation timeout of 60000 ms exceeded HOT 6
- Brightness difference between HA addon and standalone docker
- Add healthcheck endpoint at /health
- Add Support for Bitmap-Output HOT 2
- Failed to get TZ variables in container HOT 1
- "Loading data" after first image generation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hass-lovelace-kindle-screensaver.