adafruit / adafruit/Adafruit_CircuitPython_AdafruitIO

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

Open
#99 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
54
Forks
31
PR merge metrics
No merged PRs in 30d

Description

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)?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the example's MQTT setup around minimqtt, IO_MQTT, socketpool, and the ESP32 Wi-Fi library. Compare the CircuitPython 8 settings.toml approach with the current example, then determine how non-secondary ESP chips and grouped datapoints should be covered. Done means the supported examples work on the stated chip variants and the rate-limit behavior is documented or tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.