awake_stats =========== .. py:module:: awake_stats .. autoapi-nested-parse:: How long the board is awake between two status reports. Accumulated in the RTC state before every deep sleep and published with the status (see `hamqtt`), to tell whether the wakes or the sleep current dominate the battery drain. Attributes ---------- .. autoapisummary:: awake_stats.BOOT_OVERHEAD_MS Functions --------- .. autoapisummary:: awake_stats.fresh awake_stats.add_wake awake_stats.summary Module Contents --------------- .. py:data:: BOOT_OVERHEAD_MS :value: 300 .. py:function:: fresh(now_s) Start a new counting period at `now_s` (seconds). .. py:function:: add_wake(stats, awake_ms, now_s) `stats` (or a fresh count) plus one wake of `awake_ms`. .. py:function:: summary(stats, now_s) Summarise a counting period for reporting. :param stats: The counted wakes (see `add_wake`), or None. :param now_s: The current time in seconds. :returns: A dict with "awake_share" (%), "wakes_per_hour" and "awake_per_wake" (s), or None if there is no usable period.