Setting timezone from IP address

I would like to set the device timezone and default to an “auto” mode, where location is based on IP address.
I assume this is what Balena cloud already does when it shows device location.

Can this information be achieved through any of the Balena APIs, so I can set the timezone automatically?

I could query a public API like https://www.bigdatacloud.com/time-zone-apis/timezone-by-ip-address-ap, but if the information already exists in some Balena API I would prefer that over adding new dependencies on 3rd party URLs.

Balena doesn’t currently support this feature of automatically updating time zone based on location. We would suggest keeping all of your deployed devices in the UTC timezone or a statically defined time zone. This keeps a device from automatically switching time zones during operation which could mess up the ordering of logs in general. Keeping all of your devices on the same time zone also allows you to guarantee the time in the logs between all devices is consistent and can be more easily managed. The Balena dashboard does automatically convert the device log times to your current timezone on the computer you are accessing the logs from to make it easier to parse instead of viewing everything in UTC.

Thanks for a very quick reply.
Keeping all devices in UTC is not an option for me. Our devices have a user interface where the user needs to to see various timestamps in local time.
I will keep the timezone configurable (as it is now) and consider implementing my own auto-detection of timezone.

1 Like