wake

Wake a sleeping board through the maintenance switch, for the WLAN tools.

The board sleeps between fetches and cannot be reached then. Setting the retained MQTT flag behind the “Maintenance mode” switch keeps it awake at its next fetch (within 10 to 60 minutes, depending on its mode); the flag is cleared again when the tool is done, also on errors.

Attributes

Functions

set_maintenance(config, value)

Set the retained maintenance flag (MAINTENANCE_ON/OFF) via MQTT.

board_awake(host, probe, wait_min[, switch, sleep, ...])

Yield what probe returns once the board answers.

Module Contents

wake.ROOT
wake.POLL_S = 10
wake.set_maintenance(config, value)

Set the retained maintenance flag (MAINTENANCE_ON/OFF) via MQTT.

wake.board_awake(host, probe, wait_min, switch=None, sleep=time.sleep, clock=time.time, out=_print)

Yield what probe returns once the board answers.

Parameters:
  • host – Host name, for messages.

  • probe – Asks the board for something and returns it, or None if the board does not answer.

  • wait_min – How long to wait for a sleeping board.

  • switch – Sets the maintenance flag; set_maintenance with the local config by default.

  • sleep – Function to wait a number of seconds.

  • clock – Returns the current time in seconds.

  • out – Prints progress.

Raises:

SystemExit – If the board does not wake in time.