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=None, headers=None, json_path=None, regexp_path=None, default_bg=0, status_dotstar=None, json_transform=None, rotation=270, scale=1, debug=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)¶
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=0, rotation=270, scale=1, debug=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=None, extract_values=True, debug=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.
- property enabled¶
Get or Set whether the WiFi is enabled
- init_io_mqtt()¶
Initialize MQTT for Adafruit IO
- init_mqtt(broker, port=8883, username=None, password=None, use_io=False)¶
Initialize MQTT
- mqtt_connect(*args, **kwargs)¶
Connect to MQTT
- mqtt_loop(*args, suppress_mqtt_errors=True, **kwargs)¶
Run the MQTT Loop
- mqtt_publish(*args, suppress_mqtt_errors=True, **kwargs)¶
Publish to MQTT
- property on_mqtt_connect¶
Get or Set the MQTT Connect Handler
- property on_mqtt_disconnect¶
Get or Set the MQTT Disconnect Handler
- property on_mqtt_message¶
Get or Set the MQTT Message Handler
- property on_mqtt_subscribe¶
Get or Set the MQTT Subscribe Handler
- property on_mqtt_unsubscribe¶
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:
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
- property any_button_pressed¶
Return whether any button is pressed
- property button_down¶
Return whether Down Button is pressed
- property button_sel¶
Return whether Sel Button is pressed
- property button_up¶
Return whether Up Button is pressed
- property captouch6¶
Return whether CT6 Touch Pad is touched
- property captouch7¶
Return whether CT7 Touch Pad is touched
- property captouch8¶
Return whether CT8 Touch Pad is touched
- deinit()¶
Call deinit on all resources to free them
- property led¶
Return or set the value of the LED
- property light¶
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¶
Return the value of the PIR Sensor
- static play_tone(frequency, duration)¶
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¶
Return the barometric pressure in hPa, or equivalently in mBar
- property relative_humidity¶
Return the relative humidity as a percentage (0 - 100)
- set_dotstars(*values)¶
Set the dotstar values to the provided values
- property slider¶
Return the slider position value in the range of 0.0-1.0 or None if not touched
- property temperature¶
Return the temperature in degrees Celsius