gmag11 / EnigmaIOT

Secure sensor and gateway platform based on ESP8266 and ESP32
https://gmag11.github.io/EnigmaIOT
MIT License
237 stars 48 forks source link

Infinite loop #6

Closed dgcasana closed 4 years ago

dgcasana commented 4 years ago

I have been testing v0.8.3 and I only receive the status and the rssi but not the message. I have compiled the gateway with debug_info and this is what I get: [I][EnigmaIOTGatewayMQTT.ino:174] processRxData(): 7725 Heap: 237524 Published MQTT from A0:20:A6:08:CD:88: {"per":0.000000e+00,"lostmessages":0,"totalmessages":1,"packetshour":11320.75} [I][GwOutput_mqtt.cpp:411] publishMQTT(): 7764 Heap: 237772 Publish MQTT. Esp-New/A0:20:A6:08:CD:88/data : [{"channel":38,"type":103,"name":"temperature","value":27.4},{"channel":38,"type":104,"name":"humidity","value":69},{"channel":38,"type":142,"name":"switch","value":0},{"channel":38,"type":115,"name":"pressure","value":0.9},{"channel":38,"type":142,"name":"switch","value":0},{"channel":39,"type":2,"name":"analog_input","value":42}] [I][EnigmaIOTGateway.cpp:836] manageMessage(): 7780 Heap: 238048 Data OK [I][GwOutput_mqtt.cpp:411] publishMQTT(): 7819 Heap: 238412 Publish MQTT. Esp-New/A0:20:A6:08:CD:88/data : [{"channel":38,"type":103,"name":"temperature","value":27.4},{"channel":38,"type":104,"name":"humidity","value":69},{"channel":38,"type":142,"name":"switch","value":0},{"channel":38,"type":115,"name":"pressure","value":0.9},{"channel":38,"type":142,"name":"switch","value":0},{"channel":39,"type":2,"name":"analog_input","value":42}] [I][GwOutput_mqtt.cpp:411] publishMQTT(): 7863 Heap: 240256 Publish MQTT. Esp-New/A0:20:A6:08:CD:88/data : [{"channel":38,"type":103,"name":"temperature","value":27.4},{"channel":38,"type":104,"name":"humidity","value":69},{"channel":38,"type":142,"name":"switch","value":0},{"channel":38,"type":115,"name":"pressure","value":0.9},{"channel":38,"type":142,"name":"switch","value":0},{"channel":39,"type":2,"name":"analog_input","value":42}] [I][GwOutput_mqtt.cpp:411] publishMQTT(): 7902 Heap: 240256 Publish MQTT. Esp-New/A0:20:A6:08:CD:88/data : [{"channel":38,"type":103,"name":"temperature","value":27.4},{"channel":38,"type":104,"name":"humidity","value":69},{"channel":38,"type":142,"name":"switch","value":0},{"channel":38,"type":115,"name":"pressure","value":0.9},{"channel":38,"type":142,"name":"switch","value":0},{"channel":39,"type":2,"name":"analog_input","value":42}] [I][GwOutput_mqtt.cpp:411] publishMQTT(): 7940 Heap: 240256 Publish MQTT. Esp-New/A0:20:A6:08:CD:88/data : [{"channel":38,"type":103,"name":"temperature","value":27.4},{"channel":38,"type":104,"name":"humidity","value":69},{"channel":38,"type":142,"name":"switch","value":0},{"channel":38,"type":115,"name":"pressure","value":0.9},{"channel":38,"type":142,"name":"switch","value":0},{"channel":39,"type":2,"name":"analog_input","value":42}]

...infinite

I have tried with Wemos D1 mini and with LOLIN32 (without mqtt_secure) both with the same result.

dgcasana commented 4 years ago

I have recompiled version 0.8.3 with dEBUG_LEVEL DBG In Esp32, this is the output:

[D][EnigmaIOTGateway.cpp:703] addInputMsgQueue(): 91226 Heap: 237536 Message 0x01 added from B4:E6:2D:44:A0:E9. Size: 1 [D][EnigmaIOTGateway.h:186] front(): 91237 Heap: 237536 Read element. ReadIdx: 0. WriteIdx: 1. Size: 1

[D][EnigmaIOTGateway.cpp:727] getInputMsgQueue(): 91246 Heap: 239244 EnigmaIOT message got from queue. Size: 1 [D][EnigmaIOTGateway.h:168] pop(): 91256 Heap: 239244 Remove element. Buffer was not empty

[D][EnigmaIOTGateway.h:169] pop(): 91264 Heap: 239244 Before -- > ReadIdx: 0. WriteIdx: 1. Size: 1

[D][EnigmaIOTGateway.h:177] pop(): 91273 Heap: 237536 After -- > ReadIdx: 1. WriteIdx: 1. Size: 0

[D][EnigmaIOTGateway.cpp:751] popInputMsgQueue(): 91281 Heap: 239244 EnigmaIOT message pop. Size 0 [D][EnigmaIOTGateway.cpp:835] handle(): 91290 Heap: 239244 EnigmaIOT input message from queue. MsgType: 0x01 [I][EnigmaIOTGateway.cpp:845] manageMessage(): 91300 Heap: 239244 Reveived message. Origin MAC: B4:E6:2D:44:A0:E9 [I][EnigmaIOTGateway.cpp:919] manageMessage(): 91310 Heap: 239244 <------- ENCRYPTED DATA [D][GwOutput_mqtt.cpp:458] addMQTTqueue(): 91318 Heap: 238364 1 MQTT messages queued Len:175 Esp-New/B4:E6:2D:44:A0:E9/data [{"channel":8,"type":103,"name":"temperature","value":85},{"channel":9,"type":103,"name":"temperature","value":93.1},{"channel":10,"type":103,"name":"temperature","value":85}] [I][GwOutput_mqtt.cpp:506] outputDataSend(): 91344 Heap: 238364 MQTT queued Esp-New/B4:E6:2D:44:A0:E9/data. Length 175 [I][EnigmaIOTGatewayMQTT.ino:163] processRxData(): 91354 Heap: 238444 Published data message from B4:E6:2D:44:A0:E9, length 175: [{"channel":8,"type":103,"name":"temperature","value":85},{"channel":9,"type":103,"name":"temperature","value":93.1},{"channel":10,"type":103,"name":"temperature","value":85}] [D][GwOutput_mqtt.cpp:458] addMQTTqueue(): 91381 Heap: 237928 2 MQTT messages queued Len:75 Esp-New/B4:E6:2D:44:A0:E9/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":1,"packetshour":55.12} [I][GwOutput_mqtt.cpp:506] outputDataSend(): 91398 Heap: 237928 MQTT queued Esp-New/B4:E6:2D:44:A0:E9/status. Length 75 [I][EnigmaIOTGatewayMQTT.ino:175] processRxData(): 91409 Heap: 238004 Published MQTT from B4:E6:2D:44:A0:E9: {"per":0.000000e+00,"lostmessages":0,"totalmessages":1,"packetshour":55.12} [I][EnigmaIOTGateway.cpp:932] manageMessage(): 91425 Heap: 238528 Data OK [D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 91432 Heap: 238528 MQTT message got from queue [I][GwOutput_mqtt.cpp:411] publishMQTT(): 91439 Heap: 238528 Publish MQTT. Esp-New/B4:E6:2D:44:A0:E9/data : [{"channel":8,"type":103,"name":"temperature","value":85},{"channel":9,"type":103,"name":"temperature","value":93.1},{"channel":10,"type":103,"name":"temperature","value":85}] [D][EnigmaIOTGateway.cpp:781] handle(): 91464 Heap: 238528 EnigmaIOTGatewayClass::flashrx [D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 91472 Heap: 238528 MQTT message got from queue [I][GwOutput_mqtt.cpp:411] publishMQTT(): 91480 Heap: 238528 Publish MQTT. Esp-New/B4:E6:2D:44:A0:E9/data : [{"channel":8,"type":103,"name":"temperature","value":85},{"channel":9,"type":103,"name":"temperature","value":93.1},{"channel":10,"type":103,"name":"temperature","value":85}] [D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 91505 Heap: 238528 MQTT message got from queue

In mosquitto I receive nothing, only this:

pi@RaspiZero:~ $ mosquitto_sub -t Esp-New/# 1 1 {"reason":4} {"rssi":-67,"channel":6} 1 {"reason":4} {"rssi":-76,"channel":6}

gmag11 commented 4 years ago

Hello, looking at log data I cannot conclude any error. Indeed there is no warning or error message.

Output from mosquitto_sub command does not correspond to that log because {reason:4} indicates node key revocation. I recommend to add -v option to see mqtt topic.

dgcasana commented 4 years ago

This is the output of LOLIN32 with enigmaiot0.8.3 Gateway:

[I][GwOutput_mqtt.cpp:231] reconnect(): 4376 Heap: 242224 Attempting MQTT connection... [D][GwOutput_mqtt.cpp:237] reconnect(): 4384 Heap: 242224 Clock set. [D][GwOutput_mqtt.cpp:239] reconnect(): 4390 Heap: 242224 Connect to MQTT server: user Esp32, pass , topic Esp-New/gateway/status [W][GwOutput_mqtt.cpp:242] reconnect(): 4489 Heap: 239812 MQTT connected [I][GwOutput_mqtt.cpp:411] publishMQTT(): 4489 Heap: 239812 Publish MQTT. Esp-New/gateway/status : 1 [D][EnigmaIOTGateway.h:142] push(): 94157 Heap: 237916 Add element. Buffer was not full

[D][EnigmaIOTGateway.h:143] push(): 94157 Heap: 237916 Before -- > ReadIdx: 0. WriteIdx: 0. Size: 0

[D][EnigmaIOTGateway.h:158] push(): 94163 Heap: 237916 After -- > ReadIdx: 0. WriteIdx: 1. Size: 1

[D][EnigmaIOTGateway.cpp:703] addInputMsgQueue(): 94172 Heap: 237916 Message 0xFF added from 2C:F4:32:4A:08:00. Size: 1 [D][EnigmaIOTGateway.h:186] front(): 94182 Heap: 237916 Read element. ReadIdx: 0. WriteIdx: 1. Size: 1

[D][EnigmaIOTGateway.cpp:727] getInputMsgQueue(): 94191 Heap: 239624 EnigmaIOT message got from queue. Size: 1 [D][EnigmaIOTGateway.h:168] pop(): 94201 Heap: 239624 Remove element. Buffer was not empty

[D][EnigmaIOTGateway.h:169] pop(): 94209 Heap: 239624 Before -- > ReadIdx: 0. WriteIdx: 1. Size: 1

[D][EnigmaIOTGateway.h:177] pop(): 94218 Heap: 239624 After -- > ReadIdx: 1. WriteIdx: 1. Size: 0

[D][EnigmaIOTGateway.cpp:751] popInputMsgQueue(): 94227 Heap: 239624 EnigmaIOT message pop. Size 0 [D][EnigmaIOTGateway.cpp:835] handle(): 94236 Heap: 239624 EnigmaIOT input message from queue. MsgType: 0xFF [I][EnigmaIOTGateway.cpp:845] manageMessage(): 94245 Heap: 239624 Reveived message. Origin MAC: 2C:F4:32:4A:08:00 [I][EnigmaIOTGateway.cpp:863] manageMessage(): 94255 Heap: 239624 <------- CLIENT HELLO [D][EnigmaIOTGateway.cpp:1374] processClientHello(): 94323 Heap: 239624 Node key: 78 B8 BB 26 73 6E EA 13 B1 D6 9F 74 62 E9 63 5D B7 43 9F 31 2F E9 33 01 A1 31 C5 B6 A8 6E 5B 4E [I][EnigmaIOTGateway.cpp:1565] serverHello(): 94328 Heap: 239624 -------> SERVER_HELLO [D][espnow_hal.cpp:103] send(): ESP-NOW message to 2C:F4:32:4A:08:00 [D][espnow_hal.cpp:114] send(): Peer added on channel 6. Result 0 [D][espnow_hal.cpp:125] send(): esp now send result = 0 [D][espnow_hal.cpp:128] send(): Peer deleted. Result 0 [I][EnigmaIOTGateway.cpp:1567] serverHello(): 94358 Heap: 239624 Server Hello message sent to 2C:F4:32:4A:08:00 [I][EnigmaIOTGateway.cpp:868] manageMessage(): 94367 Heap: 239624 Server Hello sent [D][GwOutput_mqtt.cpp:458] addMQTTqueue(): 94375 Heap: 239452 1 MQTT messages queued Len:0 Esp-New/2C:F4:32:4A:08:00/hello [I][GwOutput_mqtt.cpp:601] newNodeSend(): 94386 Heap: 239452 Published MQTT Esp-New/2C:F4:32:4A:08:00/hello [D][EnigmaIOTGatewayMQTT.ino:207] newNodeConnected(): 94395 Heap: 239528 New node 2C:F4:32:4A:08:00 message sent MAC Address: 2C:F4:32:4A:08:00 Last counter: 0 Key valid from: 34 ms ago Key: Valid Status: Registered. Wait for messages

[D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 94417 Heap: 239528 MQTT message got from queue [I][GwOutput_mqtt.cpp:411] publishMQTT(): 94424 Heap: 239528 Publish MQTT. Esp-New/2C:F4:32:4A:08:00/hello : [D][GwOutput_mqtt.cpp:403] loop(): 94435 Heap: 237572 MQTT published. Esp-New/2C:F4:32:4A:08:00/hello [D][GwOutput_mqtt.cpp:486] popMQTTqueue(): 94443 Heap: 238036 MQTT message pop. Size 0 [D][EnigmaIOTGateway.cpp:781] handle(): 94451 Heap: 238036 EnigmaIOTGatewayClass::flashrx [D][EnigmaIOTGateway.h:142] push(): 95050 Heap: 237916 Add element. Buffer was not full

[D][EnigmaIOTGateway.h:143] push(): 95050 Heap: 237916 Before -- > ReadIdx: 1. WriteIdx: 1. Size: 0

[D][EnigmaIOTGateway.h:158] push(): 95056 Heap: 237916 After -- > ReadIdx: 1. WriteIdx: 2. Size: 1

[D][EnigmaIOTGateway.cpp:703] addInputMsgQueue(): 95065 Heap: 237916 Message 0x01 added from 2C:F4:32:4A:08:00. Size: 1 [D][EnigmaIOTGateway.h:186] front(): 95075 Heap: 237916 Read element. ReadIdx: 1. WriteIdx: 2. Size: 1

[D][EnigmaIOTGateway.cpp:727] getInputMsgQueue(): 95085 Heap: 239624 EnigmaIOT message got from queue. Size: 1 [D][EnigmaIOTGateway.h:168] pop(): 95094 Heap: 239624 Remove element. Buffer was not empty

[D][EnigmaIOTGateway.h:169] pop(): 95102 Heap: 239624 Before -- > ReadIdx: 1. WriteIdx: 2. Size: 1

[D][EnigmaIOTGateway.h:177] pop(): 95111 Heap: 239624 After -- > ReadIdx: 2. WriteIdx: 2. Size: 0

[D][EnigmaIOTGateway.cpp:751] popInputMsgQueue(): 95120 Heap: 239624 EnigmaIOT message pop. Size 0 [D][EnigmaIOTGateway.cpp:835] handle(): 95129 Heap: 239624 EnigmaIOT input message from queue. MsgType: 0x01 [I][EnigmaIOTGateway.cpp:845] manageMessage(): 95138 Heap: 239624 Reveived message. Origin MAC: 2C:F4:32:4A:08:00 [I][EnigmaIOTGateway.cpp:919] manageMessage(): 95148 Heap: 239624 <------- ENCRYPTED DATA [D][GwOutput_mqtt.cpp:458] addMQTTqueue(): 95157 Heap: 238640 1 MQTT messages queued Len:280 Esp-New/2C:F4:32:4A:08:00/data [{"channel":0,"type":2,"name":"analog_in","value":3},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] [I][GwOutput_mqtt.cpp:506] outputDataSend(): 95191 Heap: 238640 MQTT queued Esp-New/2C:F4:32:4A:08:00/data. Length 280 [I][EnigmaIOTGatewayMQTT.ino:163] processRxData(): 95202 Heap: 238716 Published data message from 2C:F4:32:4A:08:00, length 280: [{"channel":0,"type":2,"name":"analog_in","value":3},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] [D][GwOutput_mqtt.cpp:458] addMQTTqueue(): 95238 Heap: 238192 2 MQTT messages queued Len:77 Esp-New/2C:F4:32:4A:08:00/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":1,"packetshour":4609.48} [I][GwOutput_mqtt.cpp:506] outputDataSend(): 95255 Heap: 238192 MQTT queued Esp-New/2C:F4:32:4A:08:00/status. Length 77 [I][EnigmaIOTGatewayMQTT.ino:175] processRxData(): 95266 Heap: 238272 Published MQTT from 2C:F4:32:4A:08:00: {"per":0.000000e+00,"lostmessages":0,"totalmessages":1,"packetshour":4609.48} [I][EnigmaIOTGateway.cpp:932] manageMessage(): 95282 Heap: 237084 Data OK [D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 95289 Heap: 238796 MQTT message got from queue [I][GwOutput_mqtt.cpp:411] publishMQTT(): 95297 Heap: 238796 Publish MQTT. Esp-New/2C:F4:32:4A:08:00/data : [{"channel":0,"type":2,"name":"analog_in","value":3},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] [D][EnigmaIOTGateway.cpp:781] handle(): 95330 Heap: 238796 EnigmaIOTGatewayClass::flashrx [D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 95338 Heap: 238796 MQTT message got from queue [I][GwOutput_mqtt.cpp:411] publishMQTT(): 95346 Heap: 238796 Publish MQTT. Esp-New/2C:F4:32:4A:08:00/data : [{"channel":0,"type":2,"name":"analog_in","value":3},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] [D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 95380 Heap: 238796 MQTT message got from queue [I][GwOutput_mqtt.cpp:411] publishMQTT(): 95388 Heap: 238796 Publish MQTT. Esp-New/2C:F4:32:4A:08:00/data : [{"channel":0,"type":2,"name":"analog_in","value":3},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] [D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 95422 Heap: 238796 MQTT message got from queue

** more the same

[I][GwOutput_mqtt.cpp:411] publishMQTT(): 96975 Heap: 238796 Publish MQTT. Esp-New/2C:F4:32:4A:08:00/data : [{"channel":0,"type":2,"name":"analog_in","value":3},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] [D][GwOutput_mqtt.cpp:465] getMQTTqueue(): 97008 Heap: 238796 MQTT message got from queue [I][GwOutput_mqtt.cpp:411] publishMQTT(Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0) Core 0 register dump: PC : 0x4008b570 PS : 0x00060034 A0 : 0x8008a6ef A1 : 0x3ffaefd0
A2 : 0x3ffb81f0 A3 : 0x3ffb5e70 A4 : 0x00000001 A5 : 0x00000001
A6 : 0x00060023 A7 : 0x00000000 A8 : 0x3ffb5e70 A9 : 0x3ffb5e70
A10 : 0x00000002 A11 : 0x00000002 A12 : 0x00000001 A13 : 0x00000001
A14 : 0x00060023 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffd

Backtrace: 0x4008b570:0x3ffaefd0 0x4008a6ec:0x3ffaeff0 0x40088987:0x3ffaf010 0x400e8a84:0x3ffaf050 0x400d9e42:0x3ffaf0b0 0x400d9f3a:0x3ffaf0f0 0x400d9fad:0x3ffaf240 0x400dc4a5:0x3ffaf260 0x401488fd:0x3ffaf280 0x401172cf:0x3ffaf2a0 0x401171b0:0x3ffaf2d0 0x4010243d:0x3ffaf300 0x4010273b:0x3ffaf400 0x40157969:0x3ffaf420 0x4008f616:0x3ffaf470 0x40088b81:0x3ffaf4b0

Core 1 register dump: PC : 0x4008903a PS : 0x00060034 A0 : 0x80089799 A1 : 0x3ffb1cc0
A2 : 0x3ffbf434 A3 : 0xb33fffff A4 : 0x00060023 A5 : 0x003fffff
A6 : 0x3ffbe7d8 A7 : 0x00000001 A8 : 0x0000cdcd A9 : 0x0000abab
A10 : 0x0000cdcd A11 : 0x3ffb0060 A12 : 0x8008a377 A13 : 0x3ffbe760
A14 : 0x00000008 A15 : 0x00000001 SAR : 0x00000020 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffff8

Backtrace: 0x4008903a:0x3ffb1cc0 0x40089796:0x3ffb1cf0 0x4008b40c:0x3ffb1d10 0x4008b3c2:0x4000bff0

Rebooting... ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:9720 ho 0 tail 12 room 4 load:0x40080400,len:6352 entry 0x400806b8

[D][GwOutput_mqtt.cpp:114] loadConfig(): 133 Heap: 299424 Opening /mqtt.json file [D][GwOutput_mqtt.cpp:118] loadConfig(): 133 Heap: 299168 /mqtt.json opened. 83 bytes [D][GwOutput_mqtt.cpp:124] loadConfig(): 138 Heap: 298496 JSON file parsed

This the Mosquitto_sub output:

pi@RaspiZero:~ $ mosquitto_sub -t Esp-New/# -v Esp-New/gateway/status 1 Esp-New/gateway/status 0 Esp-New/gateway/status 1 Esp-New/gateway/status 0 Esp-New/gateway/status 1 Esp-New/2C:F4:32:4A:08:00/hello (null) Esp-New/gateway/status 1 ** Next reboot of Node Esp-New/2C:F4:32:4A:08:00/bye {"reason":4} Esp-New/2C:F4:32:4A:08:00/hello (null) Esp-New/2C:F4:32:4A:08:00/result/rssi {"rssi":-16,"channel":6} Esp-New/gateway/status 1 Esp-New/2C:F4:32:4A:08:00/bye {"reason":4} Esp-New/2C:F4:32:4A:08:00/hello (null) Esp-New/2C:F4:32:4A:08:00/result/rssi {"rssi":-34,"channel":6}

gmag11 commented 4 years ago

I would say that you are sending messages too quick. As Debug is activated Serial buffer is overflowed and that's why esp32 crashes before sending first data. Try to slow down node messages and reduce debug level.

dgcasana commented 4 years ago

Esp32 Gateway debug_level WARN:

WM: Connecting as wifi client... WM: Try to connect with saved credentials WM: Connection result: WM: 3 WM: IP Address: WM: 192.168.31.229 [W][GwOutput_mqtt.cpp:242] reconnect(): 5362 Heap: 231112 MQTT connected

Node: 0 MAC Address: 2C:F4:32:4A:08:00 Last counter: 0 Key valid from: 1 ms ago Key: Valid Status: Registered. Wait for messages

dhcps: send_offer>>udp_sendto result 0 dhcps: send_nak>>udp_sendto result 0

pi@RaspiZero:~ $ mosquitto_sub -t Esp-New/# -v Esp-New/gateway/status 1 Esp-New/gateway/status 0 Esp-New/gateway/status 1 Esp-New/2C:F4:32:4A:08:00/bye {"reason":4} Esp-New/2C:F4:32:4A:08:00/hello (null) Esp-New/2C:F4:32:4A:08:00/result/rssi {"rssi":-15,"channel":6} Esp-New/2C:F4:32:4A:08:00/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":1,"packetshour":348.84} Esp-New/2C:F4:32:4A:08:00/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":2,"packetshour":242.34} Esp-New/2C:F4:32:4A:08:00/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":3,"packetshour":178.89} Esp-New/2C:F4:32:4A:08:00/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":4,"packetshour":177.18} Esp-New/2C:F4:32:4A:08:00/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":5,"packetshour":127.78}

Node don't have reset pin connected, each time I push reset button I only get status message.

I think there is someting wrong with my libraries, but I don't know what. I use fresh arduino IDE .zip with portable folder inside and only libraries you link in github.. If you can upload .bin firmware of Gateway I will try it.

gmag11 commented 4 years ago

I've just released a new version. Please test it. Share your code if still not working. Please use code blocks to improve readability https://guides.github.com/features/mastering-markdown/

dgcasana commented 4 years ago

This time I have used a linux live distribution on usb to install Arduino IDE from scratch. I have installed in .zip:

when I have compiled arduino it has asked me for a library espasyntcp.h I have used https://github.com/me-no-dev/ESPAsyncTCP The code used is the example # EnigmaIOTGatewayMQTT # from the enigmaIOT library in esp8266 (wemos D1 mini), I have only modified (Linux is case-sensitive):

-Debug level: Info

The node is also a wemos d1 mini with the example of the library without a bridge between D0 and RST, it only restarts when I press the reset button.

The serial output of the Gateway: _W [9565] 28976 free (reconnect:242) MQTT connected I [9565] 28976 free (publishMQTT:411) Publish MQTT. Esp-New/gateway/status : 1 I [33657] 28976 free (manageMessage:851) Reveived message. Origin MAC: B4:E6:2D:45:7A:34 I [33658] 28976 free (manageMessage:869) <------- CLIENT HELLO I [34253] 28976 free (serverHello:1581) -------> SERVER_HELLO I [34254] 28760 free (serverHello:1583) Server Hello message sent to B4:E6:2D:45:7A:34 I [34256] 28760 free (manageMessage:874) Server Hello sent I [34261] 28624 free (newNodeSend:601) Published MQTT Esp-New/B4:E6:2D:45:7A:34/hello

Node: 0 MAC Address: B4:E6:2D:45:7A:34 Last counter: 0 Key valid from: 12 ms ago Key: Valid Status: Registered. Wait for messages

I [34283] 28696 free (publishMQTT:411) Publish MQTT. Esp-New/B4:E6:2D:45:7A:34/hello : I [34594] 28976 free (manageMessage:851) Reveived message. Origin MAC: B4:E6:2D:45:7A:34 I [34594] 28976 free (manageMessage:925) <------- ENCRYPTED DATA I [34597] 27944 free (processRxData:140) CayenneLPP message I [34603] 27520 free (outputDataSend:506) MQTT queued Esp-New/B4:E6:2D:45:7A:34/data. Length 283 I [34610] 27592 free (processRxData:175) Published data message from B4:E6:2D:45:7A:34, length 283: [{"channel":0,"type":2,"name":"analog_in","value":3.02},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}], Encoding 0x81 I [34646] 27144 free (outputDataSend:506) MQTT queued Esp-New/B4:E6:2D:45:7A:34/status. Length 78 I [34654] 27216 free (processRxData:187) Published MQTT from B4:E6:2D:45:7A:34: {"per":0.000000e+00,"lostmessages":0,"totalmessages":1,"packetshour":10746.27} I [34668] 28248 free (manageMessage:938) Data OK I [34673] 28248 free (publishMQTT:411) Publish MQTT. Esp-New/B4:E6:2D:45:7A:34/data : [{"channel":0,"type":2,"name":"analog_in","value":3.02},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] I [34705] 28248 free (publishMQTT:411) Publish MQTT. Esp-New/B4:E6:2D:45:7A:34/data : [{"channel":0,"type":2,"name":"analog_in","value":3.02},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] I [34736] 28248 free (publishMQTT:411) Publish MQTT. Esp-New/B4:E6:2D:45:7A:34/data : [{"channel":0,"type":2,"name":"analog_in","value":3.02},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}]__ loop, I only press node RST button one time node rst button _I [934273] 25672 free (manageMessage:851) Reveived message. Origin MAC: B4:E6:2D:45:7A:34 I [934281] 25672 free (manageMessage:925) <------- ENCRYPTED DATA I [934287] 24640 free (processRxData:140) CayenneLPP message I [934293] 24216 free (outputDataSend:506) MQTT queued Esp-New/B4:E6:2D:45:7A:34/data. Length 283 I [934301] 24288 free (processRxData:175) Published data message from B4:E6:2D:45:7A:34, length 283: [{"channel":0,"type":2,"name":"analog_in","value":3.02},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}], Encoding 0x81 I [934336] 24072 free (outputDataSend:506) MQTT queued Esp-New/B4:E6:2D:45:7A:34/status. Length 76 I [934344] 24144 free (processRxData:187) Published MQTT from B4:E6:2D:45:7A:34: {"per":0.000000e+00,"lostmessages":0,"totalmessages":6,"packetshour":475.82} I [934358] 25176 free (manageMessage:938) Data OK I [934364] 25176 free (publishMQTT:411) Publish MQTT. Esp-New/B4:E6:2D:45:7A:34/status : {"per":0.000000e+00,"lostmessages":0,"totalmessages":4,"packetshour":640.57} I [934378] 24648 free (publishMQTT:411) Publish MQTT. Esp-New/B4:E6:2D:45:7A:34/data : [{"channel":0,"type":2,"name":"analog_in","value":3.02},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] I [934411] 25320 free (publishMQTT:411) Publish MQTT. Esp-New/B4:E6:2D:45:7A:34/data : [{"channel":0,"type":2,"name":"analog_in","value":3.02},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digital_in","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}] I [934441] 25320 free (publishMQTT:411) Publish MQTT. Esp-New/B4:E6:2D:45:7A:34/data : [{"channel":0,"type":2,"name":"analog_in","value":3.02},{"channel":1,"type":103,"name":"temperature","value":20.3},{"channel":2,"type":0,"name":"digitalin","value":123},{"channel":3,"type":115,"name":"pressure","value":1007.2},{"channel":4,"type":117,"name":"current","value":2.43}]

mosquitto_sub -t Esp-Now / # -v: Esp-New/gateway/status 1 node rst button Esp-New/B4:E6:2D:45:7A:34/hello (null) node rst button _Esp-New/B4:E6:2D:45:7A:34/result/rssi {"rssi":-28,"channel":6} node rst button Esp-New/B4:E6:2D:45:7A:34/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":1,"packetshour":233.24} node rst button Esp-New/B4:E6:2D:45:7A:34/status {"per":0.000000e+00,"lostmessages":0,"totalmessages":2,"packetshour":415.87}

When I press the reset button of the node I only receive the status message in mqtt, never the data message.

dgcasana commented 4 years ago

Well today I have tried node_msgpack and it works fine !! Data received, and there is no infinite loop on the gateway output. I am using the gateway that yesterday failed.

gmag11 commented 4 years ago

Still looks strange. I understand that you are using basic node example, aren't you?

Gateway show received messages correctly and no warning or errors. Everything looks normal in logs.

gmag11 commented 4 years ago

@dgcasana If you have more info feel free to share it here and reopen the issue

dgcasana commented 4 years ago

yes, I use enigmaiot_node example, without changes.