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

The library is not working #52

Open
danielcera opened this issue May 9, 2018 · 24 comments
Open

The library is not working #52

danielcera opened this issue May 9, 2018 · 24 comments

Comments

@danielcera
Copy link

Make sure you have the latest version of ESP8266MQTTMesh before reporting an issue.

Please Provide the following information:

  • ESP8266MQTTMesh version: 1.0.4
  • AsyncMQTTClient version: 0.8.2
  • ESPAsyncTCP version: 1.1.0
  • ESP8266 Core version: 2.4.1

If you are you using platformio or Arduino, which one?
Arduino

Description of problem:
I'm using the "HelloWorld" example, I get the following on the serial monitor:

[connect_mqtt] Attempting MQTT connection (192.168.1.179:1883)...
[onMqttConnect] MQTT Connected
[publish] Sending: esp8266-out/bssid/a1e097=6A:A6:E6:A1:E0:97
[setup_AP] Initialized AP as 'esp8266_mqtt_mesh_a1e097' IP '10.42.1.1'
[publish] Sending: esp8266-out/a1e097/10608791=hello from 10608791 cnt: 76
[publish] Sending: esp8266-out/a1e097/10608791=hello from 10608791 cnt: 77
[publish] Sending: esp8266-out/a1e097/10608791=hello from 10608791 cnt: 78
[onMqttDisconnect] Disconnected from MQTT: 0
[connect_mqtt] Attempting MQTT connection (192.168.1.179:1883)...
[onMqttConnect] MQTT Connected
[publish] Sending: esp8266-out/bssid/a1e097=6A:A6:E6:A1:E0:97
[setup_AP] Initialized AP as 'esp8266_mqtt_mesh_a1e097' IP '10.42.1.1'
[publish] Sending: esp8266-out/a1e097/10608791=hello from 10608791 cnt: 79
[publish] Sending: esp8266-out/a1e097/10608791=hello from 10608791 cnt: 80
[publish] Sending: esp8266-out/a1e097/10608791=hello from 10608791 cnt: 81
[publish] Sending: esp8266-out/a1e097/10608791=hello from 10608791 cnt: 82

It seems that the mqtt server can be published, but I do not see the messages coming to my server,

I appreciate your collaboration.

Apologies for my English, I'm using the Google translator

@simone1999
Copy link
Collaborator

I think with "#" you can subscribe to all Topics, try to subscrybe to all Topics on an MQTT Client and watch what is coming in, maybe you are just expecting the wrong topic to come in or sth.

@danielcera
Copy link
Author

I'm subscribed to all topic with "#", I tried directly with the examples of the library "AsyncMqttClient" and I can publish without problems with the same configurations, I appreciate your help

Thank you.

@hputzek
Copy link

hputzek commented Mar 15, 2019

I had the same issue and resolved it by applying this patch: #63

@SpeedProg
Copy link

SpeedProg commented Mar 18, 2019

So I had a similar problem
I saw

New client connected from 192.168.2.112 as *** *********.
Client *** has exceeded timeout, disconnecting.

on my mqtt server.
The meshclient seemed to be publishing messages but they never reached the server.

Since I found this on my googlesearch and it fits my problem too I am going to add what was my solution.
So I have 2 subnets.
One with Gateway: 192.168.1.1 and one with Gateway 192.168.2.1
Both have mask: 255.255.255.0

The mesh is connecting to routers in the 192.168.1 subnet while the mqtt server is in the 192.168.2 one.

So the mesh code does this:

    uint octet3 = WiFi.gatewayIP()[2] + 1;
    if (! octet3) {
        octet3++;
    }
    IPAddress apIP(WiFi.gatewayIP()[0],
                   WiFi.gatewayIP()[1],
                   octet3,
                   1);
    IPAddress apGateway(apIP);
    IPAddress apSubmask(255, 255, 255, 0);

here

And since the gateway it gets from the router is 192.168.1.1 it starts settings it's own subnet as 192.168.2 and so everything starts to go wrong from there :)

Not sure how you would fix this for everyone.
I am just going to modify it to do different subnets for my use.
Anyway I hope this will help someone with similar issue in the future.

@OnurYurteri
Copy link

So I had a similar problem
I saw

New client connected from 192.168.2.112 as *** *********.
Client *** has exceeded timeout, disconnecting.

on my mqtt server.
The meshclient seemed to be publishing messages but they never reached the server.

Since I found this on my googlesearch and it fits my problem too I am going to add what was my solution.
So I have 2 subnets.
One with Gateway: 192.168.1.1 and one with Gateway 192.168.2.1
Both have mask: 255.255.255.0

The mesh is connecting to routers in the 192.168.1 subnet while the mqtt server is in the 192.168.2 one.

So the mesh code does this:

    uint octet3 = WiFi.gatewayIP()[2] + 1;
    if (! octet3) {
        octet3++;
    }
    IPAddress apIP(WiFi.gatewayIP()[0],
                   WiFi.gatewayIP()[1],
                   octet3,
                   1);
    IPAddress apGateway(apIP);
    IPAddress apSubmask(255, 255, 255, 0);

here

And since the gateway it gets from the router is 192.168.1.1 it starts settings it's own subnet as 192.168.2 and so everything starts to go wrong from there :)

Not sure how you would fix this for everyone.
I am just going to modify it to do different subnets for my use.
Anyway I hope this will help someone with similar issue in the future.

I'm having a similar problem now,
My serial output looked same with @danielcera and when i look up my mqtt server i saw same with @SpeedProg
Difference is i'm not having my mqtt broker on my local network, it's on a remote server.
When i use mqtt broker on local network it's working fine. 'Successfull subscribe acknowledge' etc. But whenever i use mqtt broker on remote server it's connecting, seemed to be publishing but never reached to server. (I'm not seeing 'successfull subscribe acknowledge' line in serial monitor also.)
Any idea how can i make it work with remote mqtt broker?

@simone1999
Copy link
Collaborator

@SpeedProg I'm not sure if the ip Adress is really causing this Issue, but you could try to modify the Code, so it does not change the 3. Byte but the 2. one. if you could test this the Result would also be verry interresting for me, because i have a Subnet Mask of 255.255.0.0 so i could change the 3.Byte to whatever i want and it would still be in the same Subnet. Maybe this is also the Cause of my Stabillity Issues.

an modified Code could look like:
uint octet2 = WiFi.gatewayIP()[1] + 1; if (octet2 == 255) { octet2++; } if (octet2 == 0) { octet2++; } IPAddress apIP(WiFi.gatewayIP()[0], octet2 , 1, 1); IPAddress apGateway(apIP); IPAddress apSubmask(255, 255, 255, 0);
this is by far not the best Solution, because we change the 2. octet but still use a 255.255.255.0 Network Mask, but if the IP range really was the Problem this Change should fix the Issue.

@timurufa86
Copy link

hi
I put the latest version of the library and tried to run the example "Hello world" nodemcu nod does not start, is in a constant reboot. in serialmonitor you can see that the module is being reloaded and some debugging information but this information is given by the module and not the library. I can't find the theme but I tried to run the library from simone1999 / esp8266mqttmesh it started contacted the broker sends messages accepts everything I see in the serialmonitor,

void callback(const char *topic, const char *msg) {
Serial.print(topic); there is nothing...
Serial.print(msg); there is nothing..

if (0 == strcmp(topic, "test")) { there is nothing
  if(String(msg) == "0") {
    Serial.print(HI);
  }else{
    Serial.print(LOW);
  }
}

} the function doesn't work

what am I doing wrong?

@timurufa86
Copy link

timurufa86 commented Mar 27, 2020

there is another problem when running on ESP8266

sending: ESP8266-out / 80d621 / info / RSSI=-55
Sending: with ESP8266-output/80D621/info/connect=FC:2D:5E:FA:4B:80
The AP is initialized as esp8266_mqtt_mesh_80d621' FROM '10.1.1.1'
ISR not in IRAM!

User exception (panic/interruption / approval)
Abort the call

stack>>>

ctx: const
sp: 3ffffeb0 end: 3fffffc0 offset: 0000
3ffffeb0: 00000000 00000000 00000001 00000020
3ffffec0: 000000fe 00000000 00000000 00000000

after reading on the forums I realized that this error is not only mine and the decision to add to all functions with interrupts:
I was able to resolve this by adding
ICACHE_RAM_ATTR in
void InteruptServiceRoutine() declarations
To become so
void ICACHE_RAM_ATTR InteruptServiceRoutine()

@timurufa86
Copy link

@simone1999
Copy link
Collaborator

Thanks a lot timurufa86! That's are some really valuable new Informations.

Which IDE are you using? Because I'm using Platformio without anny fancy configurations and don't get the Error with "ISR not in IRAM!".

Also what exactly happened when you used my fork? Didn't fully understood your previouse post. Generally speaking my fork should be quite a bit more stable/robust than this repo, but I still have some Problems with stability (only when using the Mesh) maybe your error resolves this last instability!

@timurufa86
Copy link

  1. I use the latest ide 2. the error is this: I get information in the series that data is coming from the broker , but I can't process it in the code for further use

@timurufa86
Copy link

serial monitor log:
Message arrived [esp8266-in/8443425/] '12'
Message arrived [esp8266-in/8443425/] '12'
Message arrived [esp8266-in/8443425/] '12'
Message arrived [esp8266-in/8443425/] '12'
Sending: esp8266-out/80D621/8443425=hello from 8443425 cnt: 161
Sending: esp8266-out/80D621/8443425=hello from 8443425 cnt: 162
Sending: esp8266-out/80D621/8443425=hello from 8443425 cnt: 163
Sending: esp8266-out/80D621/8443425=hello from 8443425 cnt: 164
code:
void callback(const char *topic, const char *msg) {

Serial.println(topic);
Serial.println(msg);
if (0 == strcmp(topic, (const char*) ID.c_str())) {
if(String(msg) == "0") {
digitalWrite(LED_PIN, HIGH);
Serial.println("HI");
}else{
digitalWrite(LED_PIN, LOW);
Serial.println("LOW");
}
}
}

here's how to make the LED turn on or off when receiving commands from the broker?

@timurufa86
Copy link

заработало вот с таким топиком : esp8266-in/80D621/8443425

@simone1999
Copy link
Collaborator

Hi, it seems like you are using custom In and Out Topics. It looks like these Topic's aren't configured correctly, you aren't sending to your node Topic. By default it should be esp8266-in/80D621for your node. I don't know what exactly the number you are using should do, but if you just don't touch the in and out topics you should receive the message if you send it to esp8266-in/80D621. Also your last Comment is in an for me unreadable language.

@timurufa86
Copy link

Sorry, I wrote in Russian

@wilson-wsn
Copy link

Hello simone1999.
Install your fork on the Arduino ide.
ARDUINO 1.8.12 2020.02.13

The ESP8266MeshHelloWorld example compiles on this platform. However in NodeMcu where I'm recording, it locks up, goes into a loop. the messages from the serial terminal are:

ets Jan 8 2013, rst cause: 2, boot mode: (3,6)

load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ ld

Exception (3):
epc1 = 0x4000bf64 epc2 = 0x00000000 epc3 = 0x00000000 excvaddr = 0x4024520f depc = 0x00000000

stack >>>

ctx: cont
sp: 3ffffd70 end: 3fffffc0 offset: 0190
3fffff00: 3ffe8ceb 3fffff3c 4024520f 4020af7f
3fffff10: 4020cb5d 00000010 3ffeeab8 40204d6d
3fffff20: 0000001c 0001c200 00000000 00000000
3fffff30: 007a1200 943e371f ffffff00 0000005b
3fffff40: 401052c5 8104f40c 3fff0600 00000000
3fffff50: 80fee4d0 3fff06c8 000003e8 40201a44
3fffff60: 0000002f 3ffe866d 00000000 00000000
3fffff70: 40201024 3fff06c8 3fff0668 3fff0668
3fffff80: 3fffdad0 00000000 3ffeeab8 40201119
3fffff90: 40201024 feefeffe 4020d4e8 4020d4d0
3fffffa0: feefeffe feefeffe 3fff0628 4020b810
3fffffb0: feefeffe feefeffe 3ffe851c 40100d09
<<< stack <<<

I haven't changed anything in your example. it just doesn't work.
Am I doing something wrong?

@simone1999
Copy link
Collaborator

Hm... I can't think of anything that could cause this reliably. I also ran into this Issue multiple times, but for me it always has been an broken esp8266. After replacing them with a new one everything worked for me. Could you please try an other esp8266 and tell me if that changed something?

@wilson-wsn
Copy link

I have 22 NodeMcu units at my disposal. I can test on everyone.

@wilson-wsn
Copy link

I just tested on 5 units, all new. the problem persists.
To test the units, I used examples from the painlessMesh-master library.
in this case the examples work. Therefore, NodeMcu are not defective. Nor could they. They're all new.

@wilson-wsn
Copy link

I was trying to find the problem, and I realized that when we compiled the code without the mesh.begin () statement; Compilation happens and NodeMcu does not freeze.
possibly the instruction, is calling some routine that freezes Esp8266.

@simone1999
Copy link
Collaborator

Just to make sure, you call mesh.begin() and not mesh.begin () right?!

@simone1999
Copy link
Collaborator

mesh.begin() kind of starts everything, so sadly this does not really help us a lot... Without the begin function you only import code but don't run anny of it.

@wilson-wsn
Copy link

Exactly, when starting the mesh network, NodeMcu freezes

@the-magister
Copy link

the-magister commented Feb 16, 2021

Noting crashes with dbgPrintln defined in ESP8266MQTTMesh.cpp. Fix below.

// MGD this was busted. needed FPSTR() wrapper.
//#define dbgPrintln(lvl, msg) if (((lvl) & (EMMDBG_LEVEL)) == (lvl)) Serial.println("[" + String(__FUNCTION__) + "] " + msg)

#define dbgPrintln(lvl, msg) if (((lvl) & (EMMDBG_LEVEL)) == (lvl)) Serial.println("[" + String(FPSTR(__func__)) + "] " + msg)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants