MQTT name length

ps as a note to you, Firefox did not work for the setup portion of the configuring. I had to use chromium browser.

Thank you for your write up!

be nice if in your next released version, you opened PORT_BUFFER a little so other users (i.e. nymea will not have to go thru this pain).
thanks

sorry I got the above steps to change nme to 32 characters wrong. these are the correct steps.
Steps I used to create a new version of Garadget on ubuntu 20.04 to increase the allowable length of nme to 32 characters
review Build - Particle Firmware
review MQTT support - #5 by garadget

if ubuntu version of gcc-arm is installed, remove it (I use synaptic to find it) and the sudo apt autoremove to clean all out.
open browser to GNU Toolchain | GNU Arm Embedded Toolchain Downloads – Arm Developer
select GNU Arm Embedded Toolchain: 10-2020-q4-major December 11, 2020
download gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 to home directory
file-roller gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
extract to home directory
export PATH="$PATH:/home/homedirectory/gcc-arm-none-eabi-9-2020-q2-update/bin
export PLATFORM=p1
git clone --recursive --branch v2.0.1 https://github.com/particle-iot/firmware.git Particle
cd Particle/user/application
git clone https://github.com/Garadget/firmware garadget
in my case edit garadget/src/global.h
change MINOR_VERSION 25 (changed so you know you have loaded the changes into your device)
change MAXNAMESIZE to 33
change PORT_BUFFER to 0x22
save
cd ~/Particle/modules
make clean all APP=garadget
when finished
sudo apt install mosquitto-clients
connect your device usb to your computer and make sure your broker is up
open terminal
mosquitto_sub -v -h ip of your broker -t garadget/# this is to show you the device is connected
Put your device into the DFU mode by holding down the mode/setup button on the device and then tapping on the RESET button once. Release the MODE/setup button after you start to see the RGB LED flashing in yellow. It’s easy to get this one wrong: Make sure you don’t let go of the MODE/SETUP button until you see flashing yellow, about 3 seconds after you release the RESET button. A flash of white then flashing green can happen when you get this wrong. You want flashing yellow.
dfu-util -l (to make sure device is in dfu mode. My yellow blinking really looked geen to me but have fun here).
dfu-util -d 2b04:d006 -a 0 -s 0x80A0000:leave -D ~/Particle/build/target/user-part/platform-8-m/garadget.bin
I did not update system-part1.bin or system-part2.bin (although I suspect I could have).

I then checked if mosquitto_sub give a line like garadget/garage/config {“sys”:“2.0.1”,“ver”:“1.25”,“id”:“2d0022001447373033383530”,“ssid”:“wifi network name”,“rdt”:1000,“mtt”:10000,“rlt”:300,“rlp”:1000,“srt”:25,“nme”:“garage”,“mqtt”:2,“mqip”:“broker ip address”,“mqpt”:1883,“mqus”:"",“mqto”:5000}
if not Put your unit into listening mode: press and hold “M” button for about 3 seconds until LED starts blinking dark blue.
Connect any WiFi enabled device to PHOTON-XXXX access point.
Open http://192.168.0.1/ in the browser (Firefox failed for me) and (re-)configure WiFi connection, MQTT settings, and topic setting
Submit to save. The device should reconnect to your WiFi network. (did not for me so I hit R to reset device and it came up)
check mosquitto_sub again and should show the config line

final check is
open another terminal and assuming the topic is garage
mosquitto_pub -h ip of your broker -t garadget/garage/command -m “get-status” should immediately responed with a status line
mosquitto_pub -h ip of your broker -t garadget/garage/set-config -m ‘{“nme”:“1234567890123456789012”}’ this number should show up in the config status in the mosquitto_sub terminal
now its accepting 32 characters in the nme that I need for nymea plugin I am developing for NYMEA

have fun

1 Like