Browse Source

Merge pull request #462 from chehrlic/chris_vz

RPI: fix sleep calculation by using the correct (utc) time
pull/470/head
Lukas Pusch 2 years ago
committed by GitHub
parent
commit
4c8a6dab2f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      tools/rpi/hoymiles/__main__.py

2
tools/rpi/hoymiles/__main__.py

@ -62,7 +62,7 @@ class SunsetHandler:
tomorrow = now + timedelta(days=1) tomorrow = now + timedelta(days=1)
nextSunrise = self.suntimes.riseutc(tomorrow) nextSunrise = self.suntimes.riseutc(tomorrow)
self.nextSunset = self.suntimes.setutc(tomorrow) self.nextSunset = self.suntimes.setutc(tomorrow)
time_to_sleep = int((nextSunrise - datetime.now()).total_seconds()) time_to_sleep = int((nextSunrise - datetime.utcnow()).total_seconds())
logging.info (f'Waiting for sunrise at {nextSunrise} UTC ({time_to_sleep} seconds)') logging.info (f'Waiting for sunrise at {nextSunrise} UTC ({time_to_sleep} seconds)')
if time_to_sleep > 0: if time_to_sleep > 0:
time.sleep(time_to_sleep) time.sleep(time_to_sleep)

Loading…
Cancel
Save