state ===== .. py:module:: state .. autoapi-nested-parse:: Dashboard state kept in RTC memory, which survives deep sleep. {"readings": {...}, "online": bool, "fetched": start of the last fetch (s), "header": header dict (see `header`)} Kept in RTC memory rather than flash, since it is written on every wake and needs no copy across power loss. `rtc` is machine.RTC() on the board, a fake in tests. Attributes ---------- .. autoapisummary:: state.MAX_SIZE Functions --------- .. autoapisummary:: state.save state.load Module Contents --------------- .. py:data:: MAX_SIZE :value: 2048 .. py:function:: save(rtc, state) Store `state` as JSON in RTC memory. :raises ValueError: If it does not fit into MAX_SIZE bytes. .. py:function:: load(rtc) The saved state, or None after power loss or if it is unreadable.