adafruit_funhouse
Helper library for the Adafruit FunHouse board.
Author(s): Melissa LeBlanc-Williams
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s PortalBase library: https://github.com/adafruit/Adafruit_CircuitPython_PortalBase
- class adafruit_funhouse.FunHouse(*, url: str | None = None, headers: Dict[str, str] = None, json_path: List[str] | List[List[str]] | None = None, regexp_path: Sequence[str] | None = None, default_bg: int = 0, status_dotstar: DotStar | None = None, json_transform: Callable | List[Callable] | None = 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 LEDjson_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:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s PortalBase library: https://github.com/adafruit/Adafruit_CircuitPython_PortalBase
- 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:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s PortalBase library: https://github.com/adafruit/Adafruit_CircuitPython_PortalBase
- class adafruit_funhouse.network.Network(*, status_dotstar: DotStar | None = 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 LEDextract_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.
- init_io_mqtt() IO_MQTT
Initialize MQTT for Adafruit IO
- init_mqtt(broker: str, port: int = 8883, username: str = None, password: str = None, use_io: bool = False) MQTT | IO_MQTT
Initialize MQTT
adafruit_funhouse.peripherals
Helper library for the Adafruit FunHouse board.
Author(s): Melissa LeBlanc-Williams
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s PortalBase library: https://github.com/adafruit/Adafruit_CircuitPython_PortalBase
- 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 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)
- 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.