adafruit / Adafruit_Wippersnapper_Arduino

WipperSnapper is a firmware for creating no-code IoT electronics projects.
https://io.adafruit.com/welcome
MIT License
29 stars 44 forks source link

Update MQTT topics for `api-v2` #618

Open brentru opened 3 weeks ago

brentru commented 3 weeks ago

I've completed refactoring the device UID generation func. and the MQTT topic generation func. The MQTT topic generation func. is also updated to use the new MQTT topics for API v2.

Output:

13:57:28.436 -> Running Wippersnapper API Version: 2
13:57:28.436 -> api v2 instance::connect()
13:57:28.436 -> Adafruit.io WipperSnapper
13:57:28.436 -> -------Device Information-------
13:57:28.436 -> Firmware Version: 1.0.0-rc.1
13:57:28.436 -> API: Version 2
13:57:28.436 -> Board ID: feather-esp32s2
13:57:28.436 -> Adafruit.io User: abc
13:57:28.436 -> WiFi Network: fff
13:57:28.436 -> MAC Address: 7C:DF:A1:94:A0:3A
13:57:28.436 -> -------------------------------
13:57:28.436 -> ESP32 CPU0 RESET REASON: NO_MEAN
13:57:28.436 -> ESP32 CPU1 RESET REASON: POWERON_RESET
13:57:28.436 -> Generating device UID...
13:57:28.436 -> Calculating device UID length...
13:57:28.436 -> Allocating memory for device UID
13:57:28.436 -> Device UID: io-wipper-feather-esp32s258160148
13:57:28.436 -> Device UID generated successfully!
13:57:28.436 -> Setting up MQTT client...
13:57:28.436 -> Set up MQTT client successfully!
13:57:28.436 -> Generating device's MQTT topics...
13:57:28.436 -> Pre-calculating topic lengths...
13:57:28.436 -> Broker-to-device topic: abc/ws-b2d/io-wipper-feather-esp32s258160148
13:57:28.436 -> Device-to-broker topic: abc/ws-d2b/io-wipper-feather-esp32s258160148
13:57:28.436 -> Error topic: abc/errors
13:57:28.436 -> Throttle topic: abc/throttle
13:57:28.436 -> Generated device's MQTT topics successfully!