Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on MQTT Subscription with H801 #517

Closed
Zero545 opened this issue Apr 17, 2018 · 8 comments
Closed

Crash on MQTT Subscription with H801 #517

Zero545 opened this issue Apr 17, 2018 · 8 comments
Labels
Milestone

Comments

@Zero545
Copy link

Zero545 commented Apr 17, 2018

Hi,

I'm just starting to set up an LED strip controller with the H801. I really wanted to use the Homie framework since it seemed quite well developed.

Unfortunatly I had some issues with the minimum example. Which I also have found a solution for (I hope it's valid).
I got the example to start on my H801 in the following way, but it kept crashing:

#include <Homie.h>

void setup() {
  Serial1.begin(115200);
  Serial1 << endl << endl;
  pinMode(5, OUTPUT);
  
  Homie.disableResetTrigger();
  Homie.setLedPin(5, LOW);
  Homie.setLoggingPrinter(&Serial1);
  
  Homie_setFirmware("bare-minimum", "1.0.0"); // The underscore is not a typo! See Magic bytes
  Homie.setup();
}

void loop() {
  Homie.loop();
}

I narrowed down the the issue to a single line in BootNormal.cpp (in
void BootNormal::_advertise()):

packetId = Interface::get().getMqttClient().subscribe(_prefixMqttTopic(PSTR("/$implementation/ota/firmware/+")), 1);

Here is the log of the crash:

1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v614f7c32
~ld

SDK:2.2.1(cfd48f3)/Core:2.4.1/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1)


💡 Firmware bare-minimum (1.0.0)
🔌 Booting into normal mode 🔌
{} Stored configuration
  • Hardware device ID: 6001946f9420
  • Device ID: led-strip-kitchen
  • Name: Kitchen LED
  • Device Stats Interval: 60 sec
  • Wi-Fi: 
    ◦ SSID: edesteil
    ◦ Password not shown
  • MQTT: 
    ◦ Host: 192.168.0.39
    ◦ Port: 1883
    ◦ Base topic: homie/
    ◦ Auth? yes
    ◦ Username: eweis
    ◦ Password not shown
  • OTA: 
    ◦ Enabled? yes
↕ Attempting to connect to Wi-Fi...
bcn 0
del if1
usl
mode : sta(60:01:94:6f:94:20)
add if0
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 5
cnt 

connected with edesteil, channel 1
dhcp client start...
ip:192.168.0.248,mask:255.255.255.0,gw:192.168.0.1
✔ Wi-Fi connected, IP: 192.168.0.248
Triggering WIFI_CONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...

 ets Jan  8 2013,rst cause:4, boot mode:(1,7)

wdt reset

After changing the line:

size_t longestSubtopicLength = 29 + 1; // /$implementation/ota/firmware

to:

size_t longestSubtopicLength = 31 + 1; // /$implementation/ota/firmware/+

everything seems to work fine. Can someone please confirm that this makes sense?

@luebbe
Copy link
Collaborator

luebbe commented Apr 17, 2018

You can try this one: https://github.com/luebbe/homie-h801.
Not 100% complete but works well with Home Assistant.
Please be aware that it isn't linked to a tag of homie or the other libraries. So it may show the same behaviour as your minimum sketch when compiled wit homie head + latest platform.
Note to self: use tagged revisions of libraries...

@Zero545
Copy link
Author

Zero545 commented Apr 20, 2018

@luebbe: Thank you for sharing. Your project helped me a lot for my first RGB controller implementation.

@luebbe
Copy link
Collaborator

luebbe commented Apr 22, 2018

@Zero545 you're welcome :)

@stritti
Copy link
Collaborator

stritti commented Apr 4, 2019

Could this issue be closed? Please confirm.

@Zero545
Copy link
Author

Zero545 commented Apr 4, 2019

No, it seems the code I mentioned is still the same and probably the problem is also not fixed. But I did not test it again.

@stritti stritti added this to the v3.0.0 milestone Apr 17, 2019
@mkfrey
Copy link
Contributor

mkfrey commented Oct 21, 2019

I created a PR for the MQTT buffer size calculation error pointed out by @Zero545 (see #633).

@stritti
Copy link
Collaborator

stritti commented Nov 1, 2019

PR is merged.

@luebbe
Copy link
Collaborator

luebbe commented Jan 13, 2020

Closing, since the PR is merged

@luebbe luebbe closed this as completed Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants