Closed paulo-graca closed 1 year ago
As you noticed, the timezone is currently set by the browser itself. I could try to implement an additional option to set an optional timezone. A PR would also be welcome.
I also noticed recently that only my fire tablet running fullykiosk is out of time. Other devices like my phone or pc don't have this problem.
The tablet is set with the -4h (New York timezone) in the android parameters, but the showed time is as if I am on the Greenwich timezone (4h later in my case).
I found the same issue as julien. It only occurs on my fire tablet.
@clavius11 @julienlarivee @paulo-graca Could you please provide me your yaml-configuration so that I can see which options you have set.
Here is mine
type: custom:digital-clock
dateFormat:
weekday: long
day: 2-digit
month: long
timeFormat:
hour: 2-digit
minute: 2-digit
card_mod:
style: |
.type-custom-digital-clock {
font-size: 10px !important;
font-weight: normal !important;
}
I'm using all the default settings.
type: custom:digital-clock
Can confirm, This issue just started happening with a fire tablet.
type: custom:digital-clock
firstLineFormat:
hour: 2-digit
minute: 2-digit
secondLineFormat:
weekday: long
day: 2-digit
month: long
Edit: This I think is a home assistant problem/fire tab. If you look at the home assistant user settings in the web UI, it also shows the incorrect time.
Same here. A timezone setting will help me as well... I have my phone which show me the corrct time and the tablet which show me 2 hours less... And all good with the tablet, everything is set correctly, only Home Assistant is showing me this wrong date.
Any idea how to change the timezone only for this Clock Card?
Thanks in advance
Seems that the HA time is showing correct, only the time from this card is wrong, maybe because it is not using the time from HA, I don't know. Could be perfect if the card will use a sensor as time and date. I have a sensor.time and a sensor.date, which can be used for this purpose. And it will help in many other ways, if I want to have 3-4 clocks with different times, by using custom sensors...
I added the possiblity to set the time zone inside the config. But I think this issue should be solved without setting the time zone. The locale and time zone settings will be now read from your settings of home assistant. If this issue still exists please comment, reopen this issue or create a new one.
"The locale and time zone settings will be now read from your settings of home assistant" - This will be great because I tried alot of things and nothing work
I updated the card, but when I added the "timeZone: Europe/Romania" I get Invalid DateTime.
This is my config:
type: custom:digital-clock locale: ro timeZone: Europe/Romania dateFormat: DD timeFormat: HH:mm
@pickonedev Europe/Romania is no valid time zone. You have to use Europe/Bucharest
Oh, damn... my bad, true!
It is working perfectly! Thank you so much for your quick support!
The timezone parameter is working. The time is changing according to the set timezone (I tried a couple). On my pc and phone it works flawlessly as always.
Still, the time on my firetablet is not the right one event with the parameter. I've reload the page and even reboot the tablet to make sure I got the latest lovelace. The parameter is a great feature, but I'm not sure it's the right way to fix this problem. Maybe it's a home assistant thing as you said.
I noticed something. Not sure it can help. The time in the upper right of the android taskbar was 9:20 (good one), but the time with the addon was 13:20.
Anyway, Thanks for the parameter
Well... I tested better now, even on my Huawei tablets and I still get the "Invalid DateTime", I think is something from the tablets as well, on my phone it is working, on the computer as well, but on some tablets, nope...
I just needed to achieve this without using the card... with a custom date/time template sensor...
@julienlarivee which browser do you use on your firetablet? Unfortunatelly I can't confirm the issue on my devices.
For better debugging, can you please set the config parameter timeFormat
to HH:mm ZZ z
and tell me the output. This will print the hour and minutes and also the time offset and time zone. Also I like to know your correct offset and time zone.
type: custom:digital-clock
timeFormat: "HH:mm ZZ z"
@wassy92x the browser I use on the tablet is fully kiosk.
I am actually away, but when I get back I'll do the tests. I can also try chrome on the tablet to see if there are any differences.
I just saw that there is a new home assistant update. 2021.10.07. It looks like it fixes something related to dates. Maybe it's going to fix it. Will try updating to 2021.10.07 too.
@julienlarivee During this morning I had another idea why this issue could happen. Could you please check that the time zone and time offset is correctly set in the system settings on your device.
So please check this settings and if your time zone and time offset is corretly set on your device, but this issue is still not solved, please provide me the information from comment: https://github.com/wassy92x/lovelace-digital-clock/issues/7#issuecomment-956493097 P.S. I don't think that the update of home assistant will solve this issue, because the time is taken from your device.
If you could make the card use the HA time, it will 100% work. I made my own clock and seems to work even on my "problematic" huawei tablets.
@pickonedev Yes this would be a workaround, but I don't like this solution, because you need an additional time-sensor in your home assistant instance. In my opinion this card should be as simple to setup as possible.
Yes, I understand... you want the card to be easy to use by the users and use it "stright from the box" without additional settings, but it could be useful in more ways, even using more cards with different time. Or you can leave it like this and add something optional, in order to use it with additional sensor as well
The latest updates to this card and HA 2021.10.07 don't fix my issue with my 2019 (8th gen) 8" Fire tablet only displaying time in UTC. My 2020 (10th gen) 8" Fire tablet has always worked fine, as have all my other devices. The time on my problem tablet is fine, the timezone is correctly auto set. It doesn't matter if I manually set the time zone either. I've tried several versions of Fully for fire, including the latest. No matter what I do the time is wrong for my user on this device under HA which is manifesting an issue with this card.
When I set timeFormat: "HH:mm ZZ z" The timezone shown is correct but the time is still in UTC with a +00:00 offset. I can set the timeZone to anything else and it will show the correct timezone but the time will still be in UTC with the +00:00 offset. timeZone does work on all my devices that don't have this issue.
I am going to look at updating the Fire OS install on this device from 7.3.1.7 to the latest 7.3.2.1 to see if that makes any difference.
Replying to the request to send:
type: custom:digital-clock timeFormat: "HH:mm ZZ z"
On my problem fire tablet I get (which is UTC time):
18:47 +00:00 America/Detroit Tue, Nov 02
When it should be like the rest which are correct:
14:47 -04:00 America/Detroit Tue, Nov 02
On the problem Fire tablet if I set the timeZone to something else in Europe etc the time and offset doesn't change but the timezone displayed does change. My other devices changing the timezone does change the time as expected. These are using Fully Kiosk browser (1.44.1-fire). The only difference between the two Fire tablets I have is the hardware and a slight difference in OS version.
Both the timezone and system locale are set correctly on the tablet. I've noticed within the HA user control panel the time format selections show time in 24 hours instead of 12 (ignoring system locale) and the time in UTC.
I experience the exact same issue:
Regards!
@wassy92x Ok so I'm back home. Here are the results of my tests.
Fire tablet: 7 inch 9th gen (2019) Fire tablet OS: LineageOS 14.1 Fire tablet date/time: automatic Fire tablet time zone: GMT-04:00 heure avancée de l'Est (New York) Brower: Fully kiosk browser & app lockdown 1.44.2-play
Home assistant time zone: America/New_York Home assistant core: 2021.10.7 Home assistant supervisor: 2021.10.8 Home Assistant OS: 6.6 Digital Clock: 1.2.1
Fire tablet with fully kiost: 17:59 +00:00 America/New_York merc. 03 nov. Fire tablet with chrome: 13:59 -04:00 America/New_York merc. 03 nov. PC with chrome: 13:59 -04:00 America/New_York merc. 03 nov.
I think the problem may be comming from fully kiosk. I've searched but didn't see any places to set the time zone in fully kiost.
Unfortunately I don't understand why it is not working for you on some tablets. It's a bit weird, because you say that your time zone is correctly set on the tablet. I also have a fire-tablet with fully kiosk browser, but there it is working as on every device of me.
Could anybody who has the issue please use the following configuration:
type: custom:digital-clock
timeFormat: X
this will print the time as unix timestamp (seconds since 1. Januar 1970, 00:00 UTC) Please compare this number with the real unix timestamp. You can use this website: https://wassy.de/sonstiges/unix.php
Both numbers must be more or less the same (except for a few seconds)
Maybe a workaround would be by setting the offset directly (but you should know that you have to change the setting manually when your time is changing because of daylight saving)
type: custom:digital-clock
timeZone: UTC+1
The digital clock is not the only place that displays the wrong time.
The HA Energy dashboard also displays the wrong time on my Fire HD tablet. On the Energy Usage graph, time is displayed along the X axis of the graph and should start at 0:00, but on my Fire HD, the energy usage graph starts ay 7:00 (I'm in Los Angeles).
I tried the unix time test and it's almost identical on the tablet with fully kiosk, the pc with chrome and the provided website.
Just passed by the tablet and the time is correct now. Only thing is I am not sure what fixed it. I did update to 2021.11.2 this morning, but there is nothing like this in the fix notes. Hope it stays like this.
Confirming that 2021.11.2 fixed this issue for me as well.
I like to ask if it is still an issue for somebody. Otherwise I will close this issue.
What should be the timezone for India/Pune ?
It seams the addon is using the browser Timezone. I'm not sure why, but for 2 different devices I have different timezones. I started noticing this recently. Perhaps related with countries summer time changes, not sure. Besides locale, could this addon also support timezone?