Enviro Weather correct local time for Melbourne Aust

How do I set the time used in the log for Melbourne Australia.
On Init it considers the RTC to be set and uses GMT for the log times.

You typically query the local-time from a time-service and set your RTC from it. There is worldtimeapi.org, but this is a very unreliable service. Adafruit runs a similar service (free, but needs an account). If you have a small server within your network, you can run your own timeapi-server.

You could just add an offset for the Mebourne time when it tries to set the RTC time. If you look in enviro/_init_.py around line 188 you can fin this function

# connect to wifi and attempt to fetch the current time from an ntp server
def sync_clock_from_ntp():
from phew import ntp
if not connect_to_wifi():
return False
timestamp = ntp.fetch()
if not timestamp:
return False
rtc.datetime(timestamp) # set the time on the rtc chip
return True

if you update the timestamp 8-tuple with the offset before it sets the RTC is should have the desired effect.

There might be a simplier way using utime to convert the NTP fetched time to seconds then add the sceonds offset for you time zone and then convert back to 8-tuple to set RTC. Hope this helps in some way!!

Yes, very complicated, calculating all this stuff manually. Think about things like dst…

NTP is for computers which have large libraries for converting UTC to local-time. For MCUs, just skip NTP and query local-time directly. Unless you are living in UK ;-)