adafruit_funhouse

Helper library for the Adafruit FunHouse board.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_funhouse.FunHouse(*, url: Optional[str] = None, headers: Optional[Dict[str, str]] = None, json_path: Optional[Union[List[str], List[List[str]]]] = None, regexp_path: Optional[Sequence[str]] = None, default_bg: int = 0, status_dotstar: Optional[DotStar] = None, json_transform: Optional[Union[Callable, List[Callable]]] = None, rotation: int = 270, scale: int = 1, debug: bool = False)

Class representing the Adafruit FunHouse.

Parameters
  • url – The URL of your data source. Defaults to None.

  • headers – The headers for authentication, typically used by Azure API’s.

  • json_path – The list of json traversal to get data out of. Can be list of lists for multiple data points. Defaults to None to not use json.

  • regexp_path – The list of regexp strings to get data out (use a single regexp group). Can be list of regexps for multiple data points. Defaults to None to not use regexp.

  • default_bg – The path to your default background image file or a hex color. Defaults to 0x000000.

  • status_dotstar – The initialized object for status DotStar. Defaults to None, to not use the status LED

  • json_transform – A function or a list of functions to call with the parsed JSON. Changes and additions are permitted for the dict object.

  • rotation – Default rotation is landscape (270) but can be 0, 90, or 180 for portrait/rotated

  • scale – Default scale is 1, but can be an integer of 1 or greater

  • debug – Turn on debug print outs. Defaults to False.

enter_light_sleep(sleep_time: float) None

Enter light sleep and resume the program after a certain period of time.

See https://circuitpython.readthedocs.io/en/latest/shared-bindings/alarm/index.html for more details.

Parameters

sleep_time (float) – The amount of time to sleep in seconds

adafruit_funhouse.graphics

Helper library for the Adafruit FunHouse board.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_funhouse.graphics.Graphics(*, default_bg: int = 0, rotation: int = 270, scale: int = 1, debug: bool = False)

Graphics Helper Class for the FunHouse Library

Parameters
  • default_bg – The path to your default background image file or a hex color. Defaults to 0x000000.

  • rotation – Default rotation is landscape (270) but can be 0, 90, 180 for portrait/rotated

  • debug – Turn on debug print outs. Defaults to False.

adafruit_funhouse.network

Helper library for the Adafruit FunHouse board.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_funhouse.network.Network(*, status_dotstar: Optional[DotStar] = None, extract_values: bool = True, debug: bool = False)

Class representing the Adafruit FunHouse.

Parameters
  • status_dotstar – The initialized object for status DotStar. Defaults to None, to not use the status LED

  • extract_values (bool) – If true, single-length fetched values are automatically extracted from lists and tuples. Defaults to True.

  • debug – Turn on debug print outs. Defaults to False.

property enabled: bool

Get or Set whether the WiFi is enabled

init_io_mqtt() IO_MQTT

Initialize MQTT for Adafruit IO

init_mqtt(broker: str, port: int = 8883, username: Optional[str] = None, password: Optional[str] = None, use_io: bool = False) Union[MQTT, IO_MQTT]

Initialize MQTT

mqtt_connect(*args: Union[bool, str, int], **kwargs: Union[bool, str, int]) None

Connect to MQTT

mqtt_loop(*args: int, suppress_mqtt_errors: bool = True, **kwargs: int) None

Run the MQTT Loop

mqtt_publish(*args: Union[str, int, float], suppress_mqtt_errors: bool = True, **kwargs: Union[str, int, float]) None

Publish to MQTT

property on_mqtt_connect: Optional[Callable]

Get or Set the MQTT Connect Handler

property on_mqtt_disconnect: Optional[Callable]

Get or Set the MQTT Disconnect Handler

property on_mqtt_message: Optional[Callable]

Get or Set the MQTT Message Handler

property on_mqtt_subscribe: Optional[Callable]

Get or Set the MQTT Subscribe Handler

property on_mqtt_unsubscribe: Optional[Callable]

Get or Set the MQTT Unsubscribe Handler

adafruit_funhouse.peripherals

Helper library for the Adafruit FunHouse board.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_funhouse.peripherals.Peripherals

Peripherals Helper Class for the FunHouse Library

dotstars

The DotStars on the FunHouse board. See https://circuitpython.readthedocs.io/projects/dotstar/en/latest/api.html

Type

DotStar

property any_button_pressed: bool

Return whether any button is pressed

property button_down: bool

Return whether Down Button is pressed

property button_sel: bool

Return whether Sel Button is pressed

property button_up: bool

Return whether Up Button is pressed

property captouch6: bool

Return whether CT6 Touch Pad is touched

property captouch7: bool

Return whether CT7 Touch Pad is touched

property captouch8: bool

Return whether CT8 Touch Pad is touched

deinit() None

Call deinit on all resources to free them

property led: bool

Return or set the value of the LED

property light: int

Return the value of the light sensor. The neopixel_disable property must be false to get a value.

import time
from adafruit_funhouse import FunHouse

funhouse = FunHouse()

while True:
    print(funhouse.peripherals.light)
    time.sleep(0.01)
property pir_sensor: bool

Return the value of the PIR Sensor

static play_tone(frequency: float, duration: float) None

Automatically Enable/Disable the speaker and play a tone at the specified frequency for the specified duration It will attempt to play the sound up to 3 times in the case of an error.

property pressure: float

Return the barometric pressure in hPa, or equivalently in mBar

property relative_humidity: float

Return the relative humidity as a percentage (0 - 100)

set_dotstars(*values: int) None

Set the dotstar values to the provided values

property slider: Optional[float]

Return the slider position value in the range of 0.0-1.0 or None if not touched

property temperature: float

Return the temperature in degrees Celsius