defaults

Defaults for everything configurable (versioned).

Per installation, src/config.py (git-ignored, template config_example) starts with from defaults import * and adds the secrets (WLAN, Home Assistant token, MQTT login) plus whatever should differ from these defaults. The firmware only reads config.

Attributes

HOME_ASSISTANT_URL

Base URL of Home Assistant's REST API.

FETCH_INTERVAL_S

Fetch interval on USB power (awake mode).

BATTERY_MODES

Fetch interval on battery by charge level.

LOW_BATTERY_PERCENT

Below this level the bottom-left tile asks to charge the board.

NIGHT

Night in local time as (start, end) in minutes since midnight.

NIGHT_FETCH_INTERVAL_S

Shortest fetch interval at night, see NIGHT.

AWAKE_AFTER_RESET_S

How long the web API stays up after a reset (not a timer wake).

USB_SENSE_PIN

GPIO with a voltage divider from the Feather's "USB" pin (8 = A5).

USB_SENSE_DIVIDER

(upper + lower) / lower resistance.

DISPLAY_OFF_IN_SLEEP

Switch the display off in deep sleep (Rev2.2 PWR pin).

FULL_REFRESH_INTERVAL_S

Shortest interval between full refreshes.

MAINTENANCE_S

How long the maintenance switch keeps the board awake at most.

WATCHDOG_S

Restart the board if main does not feed the watchdog for this long.

SHOW_QR_CODE

Show a QR code for the web interface in the bottom-left tile.

STATUS_SCREENS

Show boot sequence and updates on the display (see statusscreen).

STATUS_SCREEN_PAUSE_S

How long the last line of a status screen stays before going on.

DEVICE_NAME

Name of the board as a device in Home Assistant (MQTT discovery).

DEVICE_MODEL

Model of the board as a device in Home Assistant (MQTT discovery).

DEFAULT_TILES

Tiles until others are saved through the web interface.

DEFAULT_ALERTS

Warning sources until others are saved through the web interface.

Module Contents

defaults.HOME_ASSISTANT_URL = 'http://homeserver.local:8123'

Base URL of Home Assistant’s REST API.

defaults.FETCH_INTERVAL_S = 600

Fetch interval on USB power (awake mode).

defaults.BATTERY_MODES

Fetch interval on battery by charge level.

Rows of (from percent, fetch interval s, update the clock every minute); the first row the battery reaches applies. The minute clock is off everywhere: it cost too much battery, and the header shows the last and next update instead.

defaults.LOW_BATTERY_PERCENT = 25

Below this level the bottom-left tile asks to charge the board.

defaults.NIGHT

Night in local time as (start, end) in minutes since midnight.

At night there is no minute clock and fetches come at most every NIGHT_FETCH_INTERVAL_S; None disables the night mode.

defaults.NIGHT_FETCH_INTERVAL_S = 3600

Shortest fetch interval at night, see NIGHT.

defaults.AWAKE_AFTER_RESET_S = 120

How long the web API stays up after a reset (not a timer wake).

The board can then be reached for deploys and debugging before it goes to sleep.

defaults.USB_SENSE_PIN = None

GPIO with a voltage divider from the Feather’s “USB” pin (8 = A5).

It detects USB power directly, wakes the board when USB is plugged in and shows the charging symbol; None judges USB power from the fuel gauge instead, which takes a few minutes after plugging in or out. See the wiring page for the divider.

defaults.USB_SENSE_DIVIDER = 1.68

(upper + lower) / lower resistance.

68 kΩ to the USB pin and 100 kΩ to GND give about 3 V at the pin, safely high enough to wake the board; 100 kΩ/100 kΩ (ratio 2) is measured fine but at 2.5 V too close to the pin’s threshold for waking.

Type:

Ratio of the USB divider

defaults.DISPLAY_OFF_IN_SLEEP = True

Switch the display off in deep sleep (Rev2.2 PWR pin).

The panel keeps its image without power, and partial refreshes compare against the copy of the image on flash (screen) either way, so this only saves current. False keeps the display powered, for comparing the sleep current.

defaults.FULL_REFRESH_INTERVAL_S = 3600

Shortest interval between full refreshes.

Data updates refresh the screen without flashing; a full refresh flashes but clears ghosting.

defaults.MAINTENANCE_S = 1800

How long the maintenance switch keeps the board awake at most.

The “Maintenance mode” switch in Home Assistant (or deploy_wlan) keeps the board awake at its next fetch, for web interface and updates.

defaults.WATCHDOG_S = 120

Restart the board if main does not feed the watchdog for this long.

It catches hangs such as in the WLAN driver; the longest regular step, trying all known WLANs, takes about 35 s.

defaults.SHOW_QR_CODE = False

Show a QR code for the web interface in the bottom-left tile.

While the board is awake, the WLAN symbol in the header shows that the web interface can be reached. qr_sticker prints the QR code as a sticker for the frame instead.

defaults.STATUS_SCREENS = False

Show boot sequence and updates on the display (see statusscreen).

Every start that is not a wake from deep sleep shows “Dashboard startet” and each WLAN connection attempt; an update over the WLAN shows which files it changed before the board restarts. Each pauses STATUS_SCREEN_PAUSE_S before going on. Useful while developing; it costs a few seconds and display refreshes per reset.

defaults.STATUS_SCREEN_PAUSE_S = 2

How long the last line of a status screen stays before going on.

defaults.DEVICE_NAME = 'ePaper'

Name of the board as a device in Home Assistant (MQTT discovery).

defaults.DEVICE_MODEL = 'Feather ESP32-S3 + Waveshare 4.2"'

Model of the board as a device in Home Assistant (MQTT discovery).

defaults.DEFAULT_TILES

Tiles until others are saved through the web interface.

Display order, two per row; see tiles for the format.

defaults.DEFAULT_ALERTS = []

Warning sources until others are saved through the web interface.

While one of them is on, a warning screen replaces the tiles (see alerts). Set the NINA sensors of your area, for instance, in config.py.