SolarOS

SolarOS 4.13.4 manual · api

Python time and scheduling API

API overview · Lua time and scheduling

Datetime values

Datetime dictionaries use this shape:

{
    "year": 2026,
    "month": 6,
    "day": 19,
    "hour": 12,
    "minute": 30,
    "second": 0,
    "weekday": 5,
    "clock_integrity": True,
}

Datetime setters and converters accept either such a dict or positional values:

solaros.time.set_datetime(2026, 6, 19, 12, 30, 0)
solaros.time.set_datetime({"year": 2026, "month": 6, "day": 19, "hour": 12, "minute": 30})

solaros.time

Time functions use the SolarOS RTC/time service.

Example:

import solaros

print("uptime", solaros.time.uptime())
print("local", solaros.time.datetime())

if solaros.wifi.status()["has_ip"]:
    print(solaros.time.ntp_sync())

solaros.rtc

Direct access to optional RTC alarm and countdown hardware:

Direct slots are leased to the Python runtime and released when it exits. A busy error means the scheduler or another client owns that hardware slot.

solaros.schedule

Named schedules remain available after the creating script exits:

The action is "alarm" or "run"; a run action requires an absolute shell script path. Combine SUN through SAT with bitwise OR for weekly schedules.

Quick reference

Use solaros.time, solaros.rtc, solaros.schedule for time and scheduling. See man python for runtime conventions and service availability.

Join us on: