add MQTT and OTA update support #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "add_mqtt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -13,10 +13,11 @@ platform = espressif8266
framework = arduino
monitor_speed = 115200
upload_speed = 500000
upload_protocol = espota
I presume with this change, flashing initially with USB is no longer an option? I.e., this needs to be commented? If so, I'd appreciate a short comment. It's been a really long time since I've used ArduinoOTA.
I honestly have no idea. I was happy when I got this working with the platform io thingy.
@ -14,2 +14,4 @@
monitor_speed = 115200
upload_speed = 500000
upload_protocol = espota
upload_port = led-marquee-sign.fablab.local
Would it be sufficient just to target the mDNS hostname that by default should be
led-marquee-sign.local
?IIRC that didn't work when we tried that.
Works when using just
led-marquee-sign
:)That is some odd behavior, but then again, if it works... mDNS is pretty standard with these IoT devices nowadays. For example, WLED also advertises a (user-configurable) hostname. Perhaps PlatformIO applies some magic here.
@ -13,0 +19,4 @@
#define AIO_SERVERPORT credentials::mqtt_port
#define AIO_USERNAME credentials::mqtt_username.c_str()
#define AIO_KEY credentials::mqtt_password.c_str()
WiFiClient client;
Please add a blank line above.
done 👍
@ -56,0 +90,4 @@
}
uint8_t retries = 6;
while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
I'd highly appreciate if you'd avoid the use of inline comments.
I think I copied the whole function from some code in an example of one of the libraries. Feel free to adjust to your prefered code style.
Will do. I'll also test the USB flashing locally.
@ -56,0 +95,4 @@
// wait 10s till next try
for (int i = 0; i < 10000; i += 5) {
ArduinoOTA.handle();
A chance to flash it while it's in the back-off? I'd appreciate a comment explaining this line.
see above, I copied this from an example from one of the used libraries
@ -56,0 +101,4 @@
retries--;
if (retries == 0) {
ESP.restart();
Why not restart right away? I mean, sure, it's not quite necessary to do so, but it wouldn't hurt a lot either. Is there some rate limit?
see above, I copied this from an example from one of the used libraries
Looks pretty solid to me. This is such a niche application anyway...
While working on integrating the led sign into homeassistant (using MQTT) and potentially maybe also into our chat, we noticed that setting up https://git.fablab-altmuehlfranken.de/fmueller/led-marquee-sign-client as a separate service seems like a bit overkill and thought it would be nice to integrate it into this codebase.
We had a really hard time getting this to work. With the help of chatgpt I was able to get to this working version which should cover most characters on a german keyboard, except ° and § for which I didn't find a suitable mapping in your existing mapping and the mapping I found in codepage 437 didn't work, so 🤷
The mapping listed in both the Python and C++ code was deduced from the vendor's software which I blackbox reverse engineered with some USB serial converters. It was a tedious, time consuming process, but it's the best data we have. (The software even contained a "simulator" to show which dots would be lit.)
Why use a Windows codepage, though? UTF is the universal standard nowadays.
I'll review the new code ASAP.
If the led sign would support UTF-8, we wouldn't have to worry about translation shenanigans at all, I guess :D
As written above, this is what chatgpt came up with. I basically told it some example input and output and asked to write the according code for the arduino platform (+3-4 rounds of telling it to fix bugs).
The python code will still work and you can still submit the output of that to the raw http endpoint like before. I didn't change anything on that end.
So you are saying the LED sign's own encoding is close to CP437? I.e., if I send text to the sign that is in CP437 already, it would display most of it?
What I'm confused about is what is the real input format of
convertToCP437
? Is it UTF-8? Is it UTF-16? Or is it a mixture?That's what chatgpt guessed and when searching for some of the characters missing in the existing mapping table you added and trying the encoding for CP437, that somewhat seemed to hold true, yes. At least this way I found
µ
:)I guess it's whatever the string contains you send to the sign, so usually I'd assume UTF-8.
That would be my assumption, too. At least for Python 3, we can be sure of it. And almost all browsers and terminals use UTF-8, too.
Checkout
From your project repository, check out a new branch and test the changes.