Skip to content

Add support/example for CPY 8, and non-secondary ESP chips #99

Open
@tyeth

Description

@tyeth

I don't know how to change the example to work with circuitpython 8, I think this detracts from the usability hugely. I hoped i could just setup an MQTT client from minimqtt (set broker details) and pass that to adafruit_io with the wifi already connected, but alas no joy without passing socketpool too.
This was my eventual code (no need to connect to wifi in v8 if secrets set in .env):

# Set up the MQTT client
mqtt_client = MQTT(
    broker="io.adafruit.com",
    port=1883,
    username=aio_username,
    password=aio_key,
    socket_pool=socketpool.SocketPool(wifi.radio),
)
print("Connecting to Adafruit IO MQTT broker...")

# Pass the MQTT client to the IO_MQTT constructor
aio_client = IO_MQTT(mqtt_client)
aio_client.connect()
print('Connected to Adafruit IO!')

There are quite a few adafruit devices with ESP32 native chips, so should the ESP32 SPI wifi library still be used, also secrets go elsewhere these days.
Like a settings.toml file with this content:

CIRCUITPY_WIFI_SSID="WIFI_SSID_NAME"
CIRCUITPY_WIFI_PASSWORD="password"
CIRCUITPY_AIO_USERNAME="tyeth"
CIRCUITPY_AIO_KEY="MYSUPERSECRETAPIKEY"

Also on my mind, is the group issue (#97) affecting the data points per minute count of the IO rate limit, or does it not matter (e.g. if I send a single group REST api post with 8 datapoints, compared to sending 8 single REST post calls)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions