Closed Anian-igor closed 9 months ago
If you are using Home Assistant OS then ensure you have a timezone setup within the Home Assistant settings: found under Settings --> System --> General.
Yes. Timezone installed at start but I still have an issue.
Please post any logs associated with PETKIT. I'm not sure if I'll be able to help much, but if you have any backups I'd recommend reverting back to before you started to tinker with manually trying to set up a timezone on the operating system.
2023-09-12 17:37:24.720 ERROR (MainThread) [custom_components.petkit] A timezone could not be found. If you are running Home Assistant as a standalone Docker container, you must define the TZ environmental variable.
I started with installation and trying to add something manually on a test instance.
2023-09-12 17:37:24.720 ERROR (MainThread) [custom_components.petkit] A timezone could not be found. If you are running Home Assistant as a standalone Docker container, you must define the TZ environmental variable.
I started with installation and trying to add something manually on a test instance.
How did you install Home assistant on Proxmox? Was the Home Assistant OS image used to create a VM or was another operating system installed with Home Assistant on top of it as a supervised method or docker method or even pyenv? The timezone error doesn't happen with Home Assistant OS installs.
Home assistant OS VM on proxmox. Not docker or supervised method
In that case, this is the first I've heard of it happening. I don't have a solution on hand. If this is a test environment, I'd recreate the VM and start from scratch.
This is a production environment. I don't want to recreate. I think I need to forget about Petkit service at least for some time.
If you can get into the command line of the OS (not the Home Assistant CLI) and execute the command cat /etc/timezone
, a valid timezone should be in that file.
The Home Assistant CLI has ha
in the terminal - if you see this then you are not in the OS's terminal:
Example of output from Home Assistant OS's terminal output for the command above:
What happens when you run ls -l /etc/localtime
Also, run the command ha info
and let me know the output of that (there should be a timezone listed).
Another useful command is to run docker container inspect homeassistant
. Under the Config
section a TZ
environment variable should be defined, if the home assistant OS's home assistant container has a timezone environment variable defined.
In addition, your /etc/timezone file is showing a timezone of Europe/Kiev
....For Home Assistant OS users the timezone of the OS itself should be Etc/UTC
. The timezone that you set within the Home Assistant UI is set within the Home Assistant docker container that is running in the Home Assistant OS and not for the OS itself - given that your output of cat /etc/timezone
is not returning Etc/UTC
, this needs to be changed (I'm assuming whatever you did previously caused this change to happen).
ha info
docker container inspect homeassistant
"Env": [ "SUPERVISOR=172.30.32.2", "HASSIO=172.30.32.2", "TZ=Europe/Kyiv",
cat /etc/timezone - absent after reboot
cat /etc/timezone absent after a reboot? That should not be the case. The cat /etc/timezone command is looking at the OS's timezone configuration which should always be there.
It's to complicated to me to resolve an issue.
Hi, I think I tracked down the problem. It looks like the tzlocal
library doesn't recognize the Europe/Kyiv
timezone, only Europe/Kiev
. I don't see the latter as an option in Home Assistant. In order to fix that, the tzlocal library maintainer will need to push out an update to include your timezone. I've created a bug report on that project and hopefully it will be fixed.
In the meantime, if you can switch your Home Assistant to another timezone that is identical to Europe/Kyiv
and valid with the tzlocal library, that should get you going.
@Anian-igor
I see that both Europe/Kyiv
and Europe/Riga
observe the same time offset and Daylight savings time schedule. If you want to use this integration without waiting on the maintainer to fix the tzlocal library, you can change your timezone to Riga
via the Home Assistant GUI and that should get the integration running.
@Anian-igor I see that both
Europe/Kyiv
andEurope/Riga
observe the same time offset and Daylight savings time schedule. If you want to use this integration without waiting on the maintainer to fix the tzlocal library, you can change your timezone toRiga
via the Home Assistant GUI and that should get the integration running.
I tried Europe\Riga and reboot home assistant host but without luck.
2023-09-22 19:03:25.830 ERROR (MainThread) [custom_components.petkit] A timezone could not be found. If you are running Home Assistant as a standalone Docker container, you must define the TZ environmental variable.
In your configuration.yaml
file add tzlocal: debug
to the logger
. Save the file and then restart Home Assistant. Open the full Home Assistant log and there should be logging done by tzlocal in there. Share that here.
It's a strange. I changed timezone in configuration but docker inspect still show Kyiv timezone.
Also in logs
2023-09-22 19:25:55.149 DEBUG (MainThread) [tzlocal] Found a TZ environment: Europe/Kyiv 2023-09-22 19:25:55.149 DEBUG (MainThread) [tzlocal] TZ does not contain a time zone name
Did you press update on the bottom of the page after changing the timezone in the HA GUI?
Yeap. I also stopped HAOS and start after that
You wouldn't happen to have time_zone set in your configuration.yaml file? If so, then setting it in the GUI won't work.
I tried to setup via configuration.yaml but this still didn't help
Did you remove time_zone from configuration.yaml, save the file, and restart Home Assistant before attempting to set the time zone via the GUI?
Yes. Remove from configuration. Reboot and shutdown host to be sure. Still didn't help. Europe/Kyiv via inspector.
I'd raise an issue on the Home Assistant Core repo, since this seems to be a bug of its own. Perhaps they will be able to help get to the bottom of your time zone not changing when set via the GUI.
@Anian-igor
I am currently putting together a Timezone option for the configuration flow where you'll be able to select Europe/Kyiv
as the timezone instead of relying on the tzlocal library to fetch the timezone from Home Assistant (which fails since tzlocal doesn't have Europe/Kyiv in its list of timezones). This way you won't have to change your timezone in Home Assistant and we don't have to wait on the tzlocal library maintaner to update his code.
Once the new version of this integration is released, update to it and you should see the option to select a timezone during setup.
Ready to start testing ASAP. Thanks a lot
@Anian-igor Upgrade to version 0.1.10
and select Europe/Kyiv
as your timezone during the integration setup.
Hello. I've trying to setup PetKit but got well known issue regarding timezone TZ variable I've setup HassOS on virtual machine on Proxmox and don't have any TZ variable on it. Just a regula Home assistant operation system. How I can fix an issue? I already tried to create manual file with timezone (like on a pure debian) and TZ variable but without luck.