Skip to content

Add capability for datetimeutils to check BST dates from API #70

@sjefferson99

Description

@sjefferson99

Date time utils checks for BST using a static list as Micropython doesn't have a full datetime library.
This may cause failures once the list is exhausted.

Add capability for datetimeutils to query "http://worldtimeapi.org/api/timezone/Europe/London" and cache the dates returned from response:

{
"utc_offset": "+01:00",
"timezone": "Europe/London",
"day_of_week": 0,
"day_of_year": 222,
"datetime": "2025-08-10T12:27:00.431802+01:00",
"utc_datetime": "2025-08-10T11:27:00.431802+00:00",
"unixtime": 1754825220,
"raw_offset": 0,
"week_number": 32,
"dst": true,
"abbreviation": "BST",
"dst_offset": 3600,
"dst_from": "2025-03-30T01:00:00+00:00",
"dst_until": "2025-10-26T01:00:00+00:00",
"client_ip": "145.40.187.65"
}

Build in robust retry logic, the API can be overloaded.

Have the query cache the result in a local file for the year and execute this query if the BST method cannot find a valid year in the static list or file cache.

HID module should run a BST check on start-up to ensure a valid time can be returned when needed (prevents alarms sounding unnecessarily etc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions