ECHO problems when sending with no payload
-
I have this LED matrix to display time and text https://forum.mysensors.org/post/102819.
Text is sent from controller (fhem), time is only requested once from node and the runs only on node.
To switch from text to time, controller sends "" (no text). Node checks received data for NULL.strcpy(tempMessage, message.getString()); // copy it in if (tempMessage[0] == NULL) { //time
I didn't use the text option for a long time. Now it does not work anymore.
If controller sends "", node receives "]" and this does not work with NULL.
Did anything change in MySensors?
How can I debug what raw data is received? Maybe some changes on controller side...
-
Hi, can you provide the node's debug output? It should show what data was received.
-
Debug does not help. According to debug payload is empty "" (or space). When I get the payload in receive() it reads "]".
-
I don't use FHEM but tested with MySController.
Check message.getString() for NULL!
... char tempMessage[32]; char * ret = message.getString ( ); if ( NULL == ret ) { MY_SERIALDEVICE.println ( "ret is <null>" ); } else { strcpy(tempMessage, ret ); // copy it in MY_SERIALDEVICE.println ( tempMessage[0] ); }
Now if you send in an empty string, you will receive:
27148 TSF:MSG:READ,0-0-124,s=36,c=1,t=47,pt=1,l=1,sg=1:0 length: 1, type: 47 ret is <null>
(Note: payload length is 1 even if message is empty)
Also check your data type, if it's not P_STRING, you'll get NULL!. See MyMessage.cpp:const char* MyMessage::getString(void) const { if (this->getPayloadType() == P_STRING) { return this->data; } else { return NULL; } }
-
@frits thanks for supporting. This works.
-
@frits, can you please check, if MySController reads correct ECHO from a no payload message? I have some ECHO problems, when sending with no payload. But maybe FHEM related...
-
Hi,
sending an empty V_TEXT with "ACK" = "YES":
MySensors Ethernet Gateway
1896935 GWT:RFC:MSG=123;1;1;1;47; 1896941 TSF:MSG:SEND,0-0-123-123,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK: 1897074 TSF:MSG:READ,123-123-0,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE> 1897195 TSF:MSG:SEND,0-0-123-123,s=1,c=1,t=47,pt=1,l=1,sg=1,ft=0,st=OK:0 1897365 TSF:MSG:READ,123-123-0,s=1,c=1,t=47,pt=1,l=1,sg=0:0 1897371 TSF:MSG:ECHO
MySensors Node
812210 TSF:MSG:READ,0-0-123,s=1,c=3,t=16,pt=0,l=0,sg=1: 812216 SGN:SKP:MSG CMD=3,TYPE=16 812292 SGN:SKP:MSG CMD=3,TYPE=17 812300 TSF:MSG:SEND,123-123-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE> 812308 SGN:NCE:XMT,TO=123 812445 TSF:MSG:READ,0-0-123,s=1,c=1,t=47,pt=1,l=1,sg=1:0 812451 SGN:BND:NONCE=xxxxxx 812566 SGN:BND:HMAC=xxxxx 812574 SGN:VER:OK 812576 TSF:MSG:ECHO REQ 812580 SGN:SKP:ECHO CMD=1,TYPE=47 812584 TSF:MSG:SEND,123-123-0-0,s=1,c=1,t=47,pt=1,l=1,sg=0,ft=0,st=OK:0
-
Is 2.3.2 running on your GW?
I see different behaviour between 2.3.2 and old 2.2.0.
With 2.3.2 on GW I see ECHO problems, with 2.0.0 everything is fine.
First running a 2.3.2 GW, then switch to a 2.2.0 GW.
The 2.3.2 version is adding a "0", which causes problems.12.11.2020 22:24:11 TX 70;0;1;1;47; 12.11.2020 22:24:11 RX 0;255;3;0;9;41152 TSF:MSG:SEND,0-0-70-70,s=0,c=1,t=47,pt=1,l=1,sg=0,ft=0,st=OK:0 12.11.2020 22:24:11 RX 0;255;3;0;9;41174 TSF:MSG:READ,70-70-0,s=0,c=1,t=47,pt=1,l=1,sg=0:0 12.11.2020 22:24:11 RX 0;255;3;0;9;41192 TSF:MSG:ECHO 12.11.2020 22:24:11 RX 70;0;1;1;47;0 12.11.2020 22:25:10 INFO Disconnected 12.11.2020 22:25:24 INFO Flushing FIFO 12.11.2020 22:25:24 INFO Connected to COM4 12.11.2020 22:25:29 TX 70;0;1;1;47; 12.11.2020 22:25:29 RX 0;255;3;0;9;192065 TSF:MSG:SEND,0-0-70-70,s=0,c=1,t=47,pt=0,l=0,sg=0,ft=0,st=OK: 12.11.2020 22:25:29 RX 0;255;3;0;9;192088 TSF:MSG:READ,70-70-0,s=0,c=1,t=47,pt=0,l=0,sg=0: 12.11.2020 22:25:29 RX 0;255;3;0;9;192106 TSF:MSG:ACK 12.11.2020 22:25:29 RX 70;0;1;1;47;
-
Hi,
yes, it's 2.3.2:
0 MCO:BGN:INIT GW,CP=RNNGAA--,FQ=8,REL=255,VER=2.3.2 38 TSM:INIT 40 TSF:WUR:MS=0 47 TSM:INIT:TSP OK 49 TSM:INIT:GW MODE 51 TSM:READY:ID=0,PAR=0,DIS=0 55 MCO:REG:NOT NEEDED 618 GWT:TIN:IP=192.168.99.13 1622 MCO:BGN:STP *********************************************** MySensors Ethernet Gateway Version 0.1 own mac address: DE:AD:BA:BE:99:13 own network address: 192.168.99.13 Gateway type: MysGW network port: 5003 Radio type: NRF24 signing: yes 2140 MCO:BGN:INIT OK,TSP=1 2148 TSM:READY:NWD REQ 2154 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
-
here's the requests with 2.2.0.
Gateway:
0 MCO:BGN:INIT GW,CP=RNNGA---,VER=2.2.0 4 TSM:INIT 4 TSF:WUR:MS=0 12 TSM:INIT:TSP OK 14 TSM:INIT:GW MODE 16 TSM:READY:ID=0,PAR=0,DIS=0 18 MCO:REG:NOT NEEDED 583 GWT:TIN:IP=192.168.99.13 1587 MCO:BGN:STP *********************************************** MySensors Ethernet Gateway Version 0.1 own mac address: DE:AD:BA:BE:99:13 own network address: 192.168.99.13 Gateway type: MysGW network port: 5003 Radio type: NRF24 signing: no 2105 MCO:BGN:INIT OK,TSP=1 36448 TSF:MSG:READ,123-123-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 36454 TSF:MSG:BC 36456 TSF:MSG:FPAR REQ,ID=123 36460 TSF:PNG:SEND,TO=0 36462 TSF:CKU:OK 36464 TSF:MSG:GWL OK 37095 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 38502 TSF:MSG:READ,123-123-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 38510 TSF:MSG:PINGED,ID=123,HP=1 38514 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 38531 TSF:MSG:READ,123-123-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 38539 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 38549 TSF:MSG:READ,123-123-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.2.0 38557 TSF:MSG:READ,123-123-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 38567 GWT:TSA:ETH OK 38576 GWT:RFC:MSG=123;255;3;0;6;M 38582 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=6,pt=0,l=1,sg=0,ft=0,st=OK:M 38590 TSF:MSG:READ,123-123-0,s=255,c=3,t=11,pt=0,l=20,sg=0:Hello MySensors 328P 38602 TSF:MSG:READ,123-123-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.3 38612 TSF:MSG:READ,123-123-0,s=0,c=0,t=36,pt=0,l=6,sg=0:system 38623 TSF:MSG:READ,123-123-0,s=1,c=0,t=36,pt=0,l=9,sg=0:timestamp 38633 TSF:MSG:READ,123-123-0,s=2,c=0,t=3,pt=0,l=3,sg=0:led 38645 TSF:MSG:READ,123-123-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 38653 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 85934 GWT:RFC:MSG=123;1;1;1;47;hello 85940 TSF:MSG:SEND,0-0-123-123,s=1,c=1,t=47,pt=0,l=5,sg=0,ft=0,st=OK:hello 85950 TSF:MSG:READ,123-123-0,s=1,c=1,t=47,pt=0,l=5,sg=0:hello 85958 TSF:MSG:ACK 93378 GWT:RFC:MSG=123;1;1;1;47;next message empty 93386 TSF:MSG:SEND,0-0-123-123,s=1,c=1,t=47,pt=0,l=18,sg=0,ft=0,st=OK:next messa ge empty 93399 TSF:MSG:READ,123-123-0,s=1,c=1,t=47,pt=0,l=18,sg=0:next message empty 93407 TSF:MSG:ACK 96987 GWT:RFC:MSG=123;1;1;1;47; 96993 TSF:MSG:SEND,0-0-123-123,s=1,c=1,t=47,pt=0,l=0,sg=0,ft=0,st=OK: 97001 TSF:MSG:READ,123-123-0,s=1,c=1,t=47,pt=0,l=0,sg=0: 97007 TSF:MSG:ACK
Node:
0 MCO:BGN:INIT GW,CP=RNNGA---,VER=2.2.0 4 TSM:INIT 4 TSF:WUR:MS=0 12 TSM:INIT:TSP OK 14 TSM:INIT:GW MODE 16 TSM:READY:ID=0,PAR=0,DIS=0 18 MCO:REG:NOT NEEDED 583 GWT:TIN:IP=192.168.99.13 1587 MCO:BGN:STP *********************************************** MySensors Ethernet Gateway Version 0.1 own mac address: DE:AD:BA:BE:99:13 own network address: 192.168.99.13 Gateway type: MysGW network port: 5003 Radio type: NRF24 signing: no 2105 MCO:BGN:INIT OK,TSP=1 36448 TSF:MSG:READ,123-123-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 36454 TSF:MSG:BC 36456 TSF:MSG:FPAR REQ,ID=123 36460 TSF:PNG:SEND,TO=0 36462 TSF:CKU:OK 36464 TSF:MSG:GWL OK 37095 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 38502 TSF:MSG:READ,123-123-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 38510 TSF:MSG:PINGED,ID=123,HP=1 38514 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 38531 TSF:MSG:READ,123-123-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 38539 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 38549 TSF:MSG:READ,123-123-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.2.0 38557 TSF:MSG:READ,123-123-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 38567 GWT:TSA:ETH OK 38576 GWT:RFC:MSG=123;255;3;0;6;M 38582 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=6,pt=0,l=1,sg=0,ft=0,st=OK:M 38590 TSF:MSG:READ,123-123-0,s=255,c=3,t=11,pt=0,l=20,sg=0:Hello MySensors 328P 38602 TSF:MSG:READ,123-123-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.3 38612 TSF:MSG:READ,123-123-0,s=0,c=0,t=36,pt=0,l=6,sg=0:system 38623 TSF:MSG:READ,123-123-0,s=1,c=0,t=36,pt=0,l=9,sg=0:timestamp 38633 TSF:MSG:READ,123-123-0,s=2,c=0,t=3,pt=0,l=3,sg=0:led 38645 TSF:MSG:READ,123-123-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 38653 TSF:MSG:SEND,0-0-123-123,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 85934 GWT:RFC:MSG=123;1;1;1;47;hello 85940 TSF:MSG:SEND,0-0-123-123,s=1,c=1,t=47,pt=0,l=5,sg=0,ft=0,st=OK:hello 85950 TSF:MSG:READ,123-123-0,s=1,c=1,t=47,pt=0,l=5,sg=0:hello 85958 TSF:MSG:ACK 93378 GWT:RFC:MSG=123;1;1;1;47;next message empty 93386 TSF:MSG:SEND,0-0-123-123,s=1,c=1,t=47,pt=0,l=18,sg=0,ft=0,st=OK:next messa ge empty 93399 TSF:MSG:READ,123-123-0,s=1,c=1,t=47,pt=0,l=18,sg=0:next message empty 93407 TSF:MSG:ACK 96987 GWT:RFC:MSG=123;1;1;1;47; 96993 TSF:MSG:SEND,0-0-123-123,s=1,c=1,t=47,pt=0,l=0,sg=0,ft=0,st=OK: 97001 TSF:MSG:READ,123-123-0,s=1,c=1,t=47,pt=0,l=0,sg=0: 97007 TSF:MSG:ACK
-
sorry, ctr-c didn't work
Node:__ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ |___/ 2.2.0 16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.2.0 26 MCO:BGN:BFR *********************************************** Hello MySensors 328P Version 1.3 Radio type: NRF24 signing: no 32 TSM:INIT 40 TSF:WUR:MS=0 47 TSM:INIT:TSP OK 49 TSM:INIT:STATID=123 51 TSF:SID:OK,ID=123 53 TSM:FPAR 90 TSF:MSG:SEND,123-123-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 700 TSF:MSG:READ,0-0-123,s=255,c=3,t=8,pt=1,l=1,sg=0:0 706 TSF:MSG:FPAR OK,ID=0,D=1 2099 TSM:FPAR:OK 2099 TSM:ID 2101 TSM:ID:OK 2103 TSM:UPL 2107 TSF:MSG:SEND,123-123-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 2117 TSF:MSG:READ,0-0-123,s=255,c=3,t=25,pt=1,l=1,sg=0:1 2123 TSF:MSG:PONG RECV,HP=1 2127 TSM:UPL:OK 2129 TSM:READY:ID=123,PAR=0,DIS=1 2134 TSF:MSG:SEND,123-123-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 2142 TSF:MSG:READ,0-0-123,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 2152 TSF:MSG:SEND,123-123-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.2.0 2160 TSF:MSG:SEND,123-123-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 2185 TSF:MSG:READ,0-0-123,s=255,c=3,t=6,pt=0,l=1,sg=0:M 2193 TSF:MSG:SEND,123-123-0-0,s=255,c=3,t=11,pt=0,l=20,sg=0,ft=0,st=OK:Hello MySensors 328P 2205 TSF:MSG:SEND,123-123-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.3 2215 TSF:MSG:SEND,123-123-0-0,s=0,c=0,t=36,pt=0,l=6,sg=0,ft=0,st=OK:system 2226 TSF:MSG:SEND,123-123-0-0,s=1,c=0,t=36,pt=0,l=9,sg=0,ft=0,st=OK:timestamp 2236 TSF:MSG:SEND,123-123-0-0,s=2,c=0,t=3,pt=0,l=3,sg=0,ft=0,st=OK:led 2244 MCO:REG:REQ 2248 TSF:MSG:SEND,123-123-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2 2256 TSF:MSG:READ,0-0-123,s=255,c=3,t=27,pt=1,l=1,sg=0:1 2263 MCO:PIM:NODE REG=1 2265 MCO:BGN:STP 2267 MCO:BGN:INIT OK,TSP=1 49412 TSF:MSG:READ,0-0-123,s=1,c=1,t=47,pt=0,l=5,sg=0:hello 49420 TSF:MSG:ACK REQ 49424 TSF:MSG:SEND,123-123-0-0,s=1,c=1,t=47,pt=0,l=5,sg=0,ft=0,st=OK:hello h received message for sensor 1, type 47, value hello 56838 TSF:MSG:READ,0-0-123,s=1,c=1,t=47,pt=0,l=18,sg=0:next message empty 56846 TSF:MSG:ACK REQ 56850 TSF:MSG:SEND,123-123-0-0,s=1,c=1,t=47,pt=0,l=18,sg=0,ft=0,st=OK:next message empty n received message for sensor 1, type 47, value next message empty 60434 TSF:MSG:READ,0-0-123,s=1,c=1,t=47,pt=0,l=0,sg=0: 60440 TSF:MSG:ACK REQ 60444 TSF:MSG:SEND,123-123-0-0,s=1,c=1,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
-
I again checked with latest 2.3.2 development lib. Same, ECHO does not work.
You use ethernet gateway, my is serial. This might be the difference...13.11.2020 09:17:20 TX 70;0;1;1;47; 13.11.2020 09:17:20 RX 0;255;3;0;9;10969 TSF:MSG:SEND,0-0-70-70,s=0,c=1,t=47,pt=1,l=1,sg=0,ft=0,st=OK:0 13.11.2020 09:17:20 RX 0;255;3;0;9;10989 TSF:MSG:READ,70-70-0,s=0,c=1,t=47,pt=1,l=1,sg=0:0 13.11.2020 09:17:20 RX 0;255;3;0;9;11008 TSF:MSG:ECHO 13.11.2020 09:17:20 RX 70;0;1;1;47;0
I now try to setup an ethernet gateway just for test.
-
Same with ethernet gateway (UNO, W5100)
gateway 2.2.0
10:25:06.047 -> 73634 GWT:RFC:MSG=70;0;1;1;47; 10:25:06.047 -> 73639 TSF:MSG:SEND,0-0-70-70,s=0,c=1,t=47,pt=0,l=0,sg=0,ft=0,st=OK: 10:25:06.088 -> 73652 TSF:MSG:READ,70-70-0,s=0,c=1,t=47,pt=0,l=0,sg=0: 10:25:06.088 -> 73657 TSF:MSG:ACK
MYSController
13.11.2020 10:25:06 TX 70;0;1;1;47; 13.11.2020 10:25:06 RX 70;0;1;1;47;
gateway 2.3.2
10:30:45.718 -> 22546 GWT:RFC:MSG=70;0;1;1;47; 10:30:45.718 -> 22550 TSF:MSG:SEND,0-0-70-70,s=0,c=1,t=47,pt=1,l=1,sg=0,ft=0,st=OK:0 10:30:45.718 -> 22561 TSF:MSG:READ,70-70-0,s=0,c=1,t=47,pt=1,l=1,sg=0:0 10:30:45.718 -> 22566 TSF:MSG:ECHO
MYSController
13.11.2020 10:30:45 TX 70;0;1;1;47; 13.11.2020 10:30:45 RX 70;0;1;1;47;0
Now I have to look for some ESP board...
-
@karlheinz2000
Which type of radio you are using? There might be a difference between nRF24 and other (RFM-based?) transceivers. So if possible, also make a test with 2.3.2 and nRF24.
Problem may be related to the change from soft ACK to ECHO (https://github.com/mysensors/MySensors/releases).
-
All tests are done with nRF24 radio only.
-
Thx, so this seems not to be the reason behind that.
Sth. else: If possible, it could be a good idea to add some more content to the thread title (ECHO in 2.3.2 changes message content)?
-
the library differs the way it sends empty V_TEXT messages between 2.2.0 and 2.3.2.
2.2.0 10:25:06.047 -> 73639 TSF:MSG:SEND,0-0-70-70,s=0,c=1,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
note: length = 0, payload type = 0
2.3.2
10:30:45.718 -> 22550 TSF:MSG:SEND,0-0-70-70,s=0,c=1,t=47,pt=1,l=1,sg=0,ft=0,st=OK:0
note: length = 1, payload type = 1
-
I think the issue found it's way into the library here:
https://github.com/mysensors/MySensors/commit/74e566f5602261ba58e9a7fb06357810ae793b0b#diff-75e571c3ad1b2847e816b36b077fb7306d69ac8386b59d600a265f12bee1f8baold code:
// payload if (command == C_STREAM) { uint8_t bvalue[MAX_PAYLOAD_SIZE]; uint8_t blen = 0;
new code:
// payload if (str == NULL) { // no payload, set default value message.set((uint8_t)0); } else if (command == C_STREAM) { // stream payload
if there's no payload, the library assumes uint8_t with value 0
-
@frits: Thx for analyzing this issue. Atm I honestly don't have no clue how to deal with this change in the FHEM module code. When analyzing ECHO, there's a check weather send info is identical to what's been sent.
So the only way out seems to be less exact and also let be 0 the same as "nothing" (Perl doesn't use NULL).@karlheinz2000 Perhaps, we could ad a small if statement at the end of line 760 to treat 0 as "nothing" or undef?
or $_->{payload} ne $msg->{payload} if $msg->{payload}
Deleting the entire line might cause problems...
-
I've opened an issue for that.
https://github.com/mysensors/MySensors/issues/1452According to API payload is same on ECHO message.
I feel this should be handled/fixed in lib, but I have no idea how to do...
If it is not possible to fix in lib, it shall not be allowed to send message with no payload anymore, which controller has to make sure then.
@rejoe2
Regarding FHEM, at the moment we should keep it as it is. No payload is not the normal use case.
I flashed gateway with 2.2.0 and this fixed the problem for me.