API Reference
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:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- 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
- Parameters:
key (str) – The Adafruit IO key.
default_text (str) – Text to display before data has been pulled from Adafruit IO.
formatted_text (str) – String with formatting placeholders within it ready to have data formatted into it.
callback (Callable) – A function to call when the feed is fetched.
color (int) – Hex color code for the feed text.
pub (Callable) – a function to call when data is published to the feed.
- class adafruit_dash_display.Hub(display: BusDisplay, io_mqtt: IO_MQTT, nav: Tuple[digitalio.DigitalInOut, ...])
Object that lets you make an IOT dashboard
- Parameters:
display (busdisplay.BusDisplay) – 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) str
Default callback function that uses the text in the Feed object and the color callback to set the text
- 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
- Parameters:
feed_key – The Adafruit IO feed key.
default_text (str) – The default text for the device.
formatted_text (str) – The formatted text for the device.
color_callback (int) – The color to use for the device
callback (Callable) – The callback function to be called when data is fetched.
pub_method (Callable) – The pub_method to be called when data is published.
- static connected(client: IO_MQTT) None
Callback for when the device is connected to Adafruit IO
- Parameters:
client (IO_MQTT) – The MQTT client to use.
- static subscribe(client: IO_MQTT, userdata: Any, topic: str, granted_qos: str) None
Callback for when a new feed is subscribed to
- static disconnected(client: IO_MQTT) None
Callback for when the device disconnects from Adafruit IO
- Parameters:
client (IO_MQTT) – The MQTT client to use.
- message(client: IO_MQTT, feed_id: str, message: str) None
Callback for whenever a new message is received