dashboard

Dashboard updates: full screen with new data, or only the header.

Functions

fetch_alerts(source, ids)

Active alerts, most severe first; none if the source fails.

fetch(source, cached_readings[, log])

Read the data source, falling back to cached readings.

refresh_full(epd, fb, buffer, readings, tiles, header)

Draw the whole screen and show it on the display.

refresh_header(epd, make_band, old, new[, screen, ...])

Partial refresh of the header band from header old to new.

Module Contents

dashboard.fetch_alerts(source, ids)

Active alerts, most severe first; none if the source fails.

dashboard.fetch(source, cached_readings, log=None)

Read the data source, falling back to cached readings.

Parameters:
  • source – A data source (see datasource).

  • cached_readings – Readings of the last successful fetch, or None.

  • log – Optional callable for the reason when the source fails.

Returns:

fresh readings and True, or the cached ones (or none) and False if the source cannot be reached.

Return type:

(readings, online)

dashboard.refresh_full(epd, fb, buffer, readings, tiles, header, link=None, notice=None, active_alerts=None, partial=False, old=None, power_off=False)

Draw the whole screen and show it on the display.

Parameters:
  • epd – The display driver.

  • fb – Framebuffer to draw into.

  • buffer – The bytes behind fb.

  • readings – What the data source returned.

  • tiles – Tiles in the form of tiles.to_layout.

  • header – Header dict (see header).

  • link – URL to show as QR code, see layout.render.

  • notice – Warning lines for the bottom-left tile.

  • active_alerts – Warnings that replace the tiles.

  • partial – Refresh without flashing instead of a full refresh (which flashes but clears ghosting).

  • old – The image on the panel if the controller lost it.

  • power_off – Switch the display off afterwards instead of sleeping.

dashboard.refresh_header(epd, make_band, old, new, screen=None, power_off=False)

Partial refresh of the header band from header old to new.

make_band() returns a fresh (framebuf, buffer) pair of hdr.WIDTH x hdr.HEIGHT pixels. With screen (the whole image on a panel whose controller lost it) the whole screen is refreshed with the new band patched in, and the new image is returned. Returns False if nothing changed.