Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to get TZ variables in container #123

Open
dperezq opened this issue Apr 25, 2024 · 4 comments
Open

Failed to get TZ variables in container #123

dperezq opened this issue Apr 25, 2024 · 4 comments

Comments

@dperezq
Copy link

dperezq commented Apr 25, 2024

Hi, I have started the container and the process is working fine, it is generating the screenshot and it is loading properly in the Kindle, but I have an issue with the timezone. It seems that the container is not getting the timezone variable correctly. This is a problem because the rendering process (I image because of the browser) is getting that time instead of my local time.

 kindle-weather:
    image: sibbl/hass-lovelace-kindle-screensaver:latest
    environment:
      .
      .
      .
      - TZ=Europe/Berlin
    ports:
      - 5005:5000
    volumes:
      - /etc/localtime:/etc/localtime:ro

Response of the date command inside the container, showing UTC and -2 hours (matches the result of the screenshot):

/app # date
Thu Apr 25 09:06:07 UTC 2024

I also attach the image of the current ha dashboard and the output screenshot. The local zona is also configured within the HA, indeed in the dashboard it is correctly displayed, so it is a problem with the container. You can see the differences in the lower card but the upper card seems to work properly. Does anyone have the same issue? This is the card horizon-card

image
image

I tried installing tzdata inside the container using apk add --update tzdata and now the time and timezone is ok, as can be seen in the command below, but the screenshot is still showing the wrong time:

/etc # date
Thu Apr 25 13:55:14 CEST 2024

Any ideas on how to solve this?

@fightforlife
Copy link

I have the same problem. Puppeteer has an option to emulate a timezone. Maybe this would help.
Maybe I have so time to dig into the code in the coming days.puppeteer/puppeteer#4949

@avhm
Copy link
Contributor

avhm commented Aug 7, 2024

Try setting the user timezone in Profile > User Settings > Time Zone to Use server time zone

This solved the issue of it reverting to UTC for me

Edit: this needs to be set for the user who you generated the access token for

@xanfia
Copy link

xanfia commented Aug 11, 2024

FYI, I had the same problem and just adding the environment parameter RENDERING_DELAY=1000 (1 second delay)
seems to solve the timezone issue. I didn't need to change any timezone parameter in the HA instance as @avhm pointed out.

@xanfia
Copy link

xanfia commented Aug 13, 2024

After a deeper research, I found that the RENDERING_DELAY is not the only parameter that is currently affecting the TZ shifting when rendering. I also added:

volumes:
      - "/etc/localtime:/etc/localtime:ro"

to my docker-compose.yml and most of my lovelace cards started to work properly. However, my Weather Chart Card is still showing times in UTC in rendered image. On the other hand the Lovelace Horizon Card works properly with this approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants