luc-ass / homebridge-evohome

Homebridge plugin for Honeywell Evohome
29 stars 16 forks source link

Time wrong again after BST clock change #100

Closed PuzzledUser closed 1 year ago

PuzzledUser commented 2 years ago

Further to https://github.com/luc-ass/homebridge-evohome/issues/59 I see time is an hour out:

Linux homebridge 5.4.79+ #1373 Mon Nov 23 13:18:15 GMT 2020 armv6l
*** Homebridge Raspbian v1.0.17 - Raspberry Pi Zero W Rev 1.1 ***

[05/11/2021, 09:16:11] Loaded plugin: homebridge-evohome@0.8.4
[05/11/2021, 09:16:35] Homebridge v1.3.5 (Homebridge xxxx) is running on port xxxxx.
[05/11/2021, 09:17:30] [Evohome] The current time is 10:17:30

Servertime and Timezone seems correct:

pi@homebridge:~ $ timedatectl
               Local time: Fri 2021-11-05 09:32:56 GMT
           Universal time: Fri 2021-11-05 09:32:56 UTC
                 RTC time: n/a
                Time zone: Europe/London (GMT, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
pi@homebridge:~ $ 

Maybe I'm missing something, but I thought you had this one sussed... PS I've helped you out before but am locked out of that account now as I can't get the git verification code.

PuzzledUser commented 2 years ago

I believe I have a fix for the temp change being erroneously applied to the change after next:

[24/12/2021, 05:50:03] [Evohome] The current time is 06:50:03
[24/12/2021, 05:50:03] [Evohome] Schedule points for today (Friday)
[24/12/2021, 05:50:03] [Evohome] - 06:50:00
[24/12/2021, 05:50:03] [Evohome] - 07:10:00 -> next change
[24/12/2021, 05:50:03] [Evohome] - 08:10:00

Line 704: I overwrote the erroneous assignment using default region rather than DE region. (I'm in UK)

          var currenttime = correctDate.toLocaleTimeString("de-DE", {
            timeZone: "Europe/Berlin",
            hour12: false,
          });
          var currenttime = correctDate.toLocaleTimeString();   // try default conversion to fix time issues
luc-ass commented 1 year ago

Hey there. Just a quick follow up on your issue: Did you manually change the region to UK? Can you post an example of what you changed?

PuzzledUser commented 1 year ago

Hey, that would be one solution. But as you see above, passing no parameter means that the system defaults to the local region; magic.

i.e. I kept your code, but immediately overwrote the currenttime variable with a simpler version.

luc-ass commented 1 year ago

Got it. I can't remember what made me do this in the first place. I have a suspicion that 24-hour format was needed. Can't really test it though, as I never use am/pm. How long have you been running this code?

PuzzledUser commented 1 year ago

Heehee. All good here since: Dec 24 2021

luc-ass commented 1 year ago

148c9426eb0a89911759fb3a7cca869e19e27e83

var currenttime = correctDate.toLocaleTimeString([], {
  hour12: false,
});

This way hours12: false can be kept. I'll merge the branch back into master in a few days after testing it out. Thank you again for working on this!

PuzzledUser commented 1 year ago

148c942

var currenttime = correctDate.toLocaleTimeString([], {
  hour12: false,
});

This way hours12: false can be kept. I'll merge the branch back into master in a few days after testing it out. Thank you again for working on this!

Makes sense, best of both worlds.

luc-ass commented 1 year ago

released as of v0.9.1