adafruit_dash_display

CircuitPython library for creating Adafruit IO dashboards.

  • Author(s): Eva Herrada

Implementation Notes

Hardware:

  • This library currently only officially supports the Adafruit Funhouse but other boards are coming soon.

Software and Dependencies:

class adafruit_dash_display.Feed(key: str, default_text: str, formatted_text: str, callback: Callable | None, color: int | None, pub: Callable | None, index: int)

Feed object to make getting and setting different feed properties easier

property key

Getter for feed key. Will give the value of the feed key

property text

Getter for text ready to be formatted. Will give the feed text

property callback

Getter for callback function. Returns the feed callback

property color

Getter for text color callback function. Will return the color for the feed

property pub

Getter for publish function, called when a new value is published by this library.

property last_val

Getter for the last value received

class adafruit_dash_display.Hub(display: displayio.Display, io_mqtt: IO_MQTT, nav: Tuple[digitalio.DigitalInOut, ...])

Object that lets you make an IOT dashboard

Parameters:
  • display (displayio.Display) – The display for the dashboard.

  • io_mqtt (IO_MQTT) – MQTT communications object.

  • nav (Tuple[DigitalInOut, ...]) – The navigation pushbuttons.

simple_text_callback(client: IO_MQTT, feed_id: str, message: str)

Default callback function that uses the text in the Feed object and the color callback to set the text

update_text(client: IO_MQTT, feed_id: str, message: str)

Updates the text on the display

base_pub(var: Any)

Default function called when a feed is published to

add_device(feed_key: str, default_text: str | None = None, formatted_text: str | None = None, color_callback: int | None = None, callback: Callable | None = None, pub_method: Callable | None = None)

Adds a feed/device to the UI

get()

Gets all the subscribed feeds

static connected(client: IO_MQTT)

Callback for when the device is connected to Adafruit IO

static subscribe(client: IO_MQTT, userdata: Any, topic: str, granted_qos: str)

Callback for when a new feed is subscribed to

static disconnected(client: IO_MQTT)

Callback for when the device disconnects from Adafruit IO

message(client: IO_MQTT, feed_id: str, message: str)

Callback for whenever a new message is received

publish(feed: Feed, message: str)

Callback for publishing a message

loop()

Loops Adafruit IO and also checks to see if any buttons have been pressed