SW_Signing failing: !TSF:MSG:SIGN FAIL



  • Hi,
    I'm trying to get SW signing working, but with no luck...
    Not sure if the signing is just supposed to work after initialization/presentation, because everything seems to go well, and then there is some sort of sleep message and from that point onwards, I get the "!TSF:MSG:SIGN FAIL" message.

    GW: Arduino nano with pin D7 unconnected

    // SIGNING STUFF ***************************************************
    #define MY_SIGNING_SOFT
    #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
    #define MY_SIGNING_REQUEST_SIGNATURES
    
    #include <MySensors.h>
    

    Node: Arduino nano with pin A1 unconnected

    //CODE FOR SIGNING************************************************
    #define MY_SIGNING_SOFT
    #define MY_SIGNING_SOFT_RANDOMSEED_PIN A1
    #define MY_SIGNING_REQUEST_SIGNATURES 
    

    According to the documentation:
    1st step: Decide the back-end.
    I decided to implement the signing by software (#define MY_SIGNING_SOFT) in both GW and node.

    2nd step: "verify configuration" - Basically I understood it as identifying a non-connected pin
    Identified in both GW and node.

    3rd step: Personalize nodes
    Used the security personalizer.

    First, uncommented the GENERATE_KEYS_SOFT in order to generate some keys and ran on the node:

    +------------------------------------------------------------------------------------+
    |                           MySensors security personalizer                          |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                               Configuration settings                               |
    +------------------------------------------------------------------------------------+
    | * Guided key generation for EEPROM using software                                  |
    | * Software based personalization (no ATSHA204A usage whatsoever)                   |
    | * Will not require any UART confirmations                                          |
    | * Will generate HMAC key using software                                            |
    | * Will generate AES key using software                                             |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                           Hardware security peripherals                            |
    +--------------+--------------+--------------+------------------------------+--------+
    | Device       | Status       | Revision     | Serial number                | Locked |
    +--------------+--------------+--------------+------------------------------+--------+
    | AVR          | DETECTED     | N/A          | N/A (generation required)    | N/A    |
    +--------------+--------------+--------------+------------------------------+--------+
    
    +------------------------------------------------------------------------------------+
    |                                   Key generation                                   |
    +--------+--------+------------------------------------------------------------------+
    | Key ID | Status | Key                                                              |
    +--------+--------+------------------------------------------------------------------+
    | HMAC   | OK     | EFD9AF67B3F939FC663B17F2E644BCD7AED0C6820CC9D5454D05BDF282E567BA |
    | AES    | OK     | 4EA43132406FC4C4344E4A0E4589B506                                 |
    +--------+--------+------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                  Key copy section                                  |
    +------------------------------------------------------------------------------------+
    #define MY_HMAC_KEY 0xEF,0xD9,0xAF,0x67,0xB3,0xF9,0x39,0xFC,0x66,0x3B,0x17,0xF2,0xE6,0x44,0xBC,0xD7,0xAE,0xD0,0xC6,0x82,0x0C,0xC9,0xD5,0x45,0x4D,0x05,0xBD,0xF2,0x82,0xE5,0x67,0xBA
    #define MY_AES_KEY 0x4E,0xA4,0x31,0x32,0x40,0x6F,0xC4,0xC4,0x34,0x4E,0x4A,0x0E,0x45,0x89,0xB5,0x06
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                       EEPROM                                       |
    +--------+--------+------------------------------------------------------------------+
    | Key ID | Status | Key                                                              |
    +--------+--------+------------------------------------------------------------------+
    | HMAC   | RESET  | FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF |
    | AES    | RESET  | FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF                                 |
    | SERIAL | RESET  | FFFFFFFFFFFFFFFFFF                                               |
    +--------+--------+------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                      This nodes whitelist entry on other nodes                     |
    +------------------------------------------------------------------------------------+
    {.nodeId = <ID of this node>,.serial = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}}
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                  WHAT TO DO NEXT?                                  |
    +------------------------------------------------------------------------------------+
    | To proceed with the personalization, copy the keys shown in the Key copy section,  |
    | and replace the corresponding definitions in the top of the sketch, then disable   |
    | GENERATE_KEYS_SOFT and enable PERSONALIZE_SOFT or PERSONALIZE_SOFT_RANDOM_SERIAL.  |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                  Execution result                                  |
    +------------------------------------------------------------------------------------+
    | SUCCESS                                                                            |
    +------------------------------------------------------------------------------------+
    
    

    Then copied those keys and HW ID back to the same sketch. These were:

    
    
    #define MY_HMAC_KEY 0xEF,0xD9,0xAF,0x67,0xB3,0xF9,0x39,0xFC,0x66,0x3B,0x17,0xF2,0xE6,0x44,0xBC,0xD7,0xAE,0xD0,0xC6,0x82,0x0C,0xC9,0xD5,0x45,0x4D,0x05,0xBD,0xF2,0x82,0xE5,0x67,0xBA
    #define MY_AES_KEY 0x4E,0xA4,0x31,0x32,0x40,0x6F,0xC4,0xC4,0x34,0x4E,0x4A,0x0E,0x45,0x89,0xB5,0x06
    #define MY_SOFT_SERIAL 0x69,0x2F,0x9D,0x05,0x0D,0x20,0x17,0xB2,0xC6  
    

    Commented back the GENERATE_KEYS_SOFT and uncommented the PERSONALIZE_SOFT_RANDOM_SERIAL. Ran it again:

    +------------------------------------------------------------------------------------+
    |                           MySensors security personalizer                          |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                               Configuration settings                               |
    +------------------------------------------------------------------------------------+
    | * Guided personalization/storage of keys in EEPROM                                 |
    | * Guided storage and generation of random serial in EEPROM                         |
    | * Software based personalization (no ATSHA204A usage whatsoever)                   |
    | * Will not require any UART confirmations                                          |
    | * Will store HMAC key to EEPROM                                                    |
    | * Will store AES key to EEPROM                                                     |
    | * Will generate soft serial using software                                         |
    | * Will store soft serial to EEPROM                                                 |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                           Hardware security peripherals                            |
    +--------------+--------------+--------------+------------------------------+--------+
    | Device       | Status       | Revision     | Serial number                | Locked |
    +--------------+--------------+--------------+------------------------------+--------+
    | AVR          | DETECTED     | N/A          | N/A (generation required)    | N/A    |
    +--------------+--------------+--------------+------------------------------+--------+
    
    +------------------------------------------------------------------------------------+
    |                                   Key generation                                   |
    +--------+--------+------------------------------------------------------------------+
    | Key ID | Status | Key                                                              |
    +--------+--------+------------------------------------------------------------------+
    | SERIAL | OK     | 692F9D050D2017B2C6                                               |
    +--------+--------+------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                    Key storage                                     |
    +--------+--------+------------------------------------------------------------------+
    | Key ID | Status | Key                                                              |
    +--------+--------+------------------------------------------------------------------+
    | HMAC   | OK     | EFD9AF67B3F939FC663B17F2E644BCD7AED0C6820CC9D5454D05BDF282E567BA |
    | AES    | OK     | 4EA43132406FC4C4344E4A0E4589B506                                 |
    | SERIAL | OK     | 692F9D050D2017B2C6                                               |
    +--------+--------+------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                       EEPROM                                       |
    +--------+--------+------------------------------------------------------------------+
    | Key ID | Status | Key                                                              |
    +--------+--------+------------------------------------------------------------------+
    | HMAC   | OK     | EFD9AF67B3F939FC663B17F2E644BCD7AED0C6820CC9D5454D05BDF282E567BA |
    | AES    | OK     | 4EA43132406FC4C4344E4A0E4589B506                                 |
    | SERIAL | OK     | 692F9D050D2017B2C6                                               |
    +--------+--------+------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                      This nodes whitelist entry on other nodes                     |
    +------------------------------------------------------------------------------------+
    {.nodeId = <ID of this node>,.serial = {0x69,0x2F,0x9D,0x05,0x0D,0x20,0x17,0xB2,0xC6}}
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                  WHAT TO DO NEXT?                                  |
    +------------------------------------------------------------------------------------+
    | This device has now been personalized. Run this sketch with its current settings   |
    | on all the devices in your network that have security enabled.                     |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                  Execution result                                  |
    +------------------------------------------------------------------------------------+
    | SUCCESS                                                                            |
    +------------------------------------------------------------------------------------+
    

    Now, just changed the MY_SOFT_SERIAL with another value and ran it in the GW node:

    +-------------------------------+------------------------------------------------------------------------------------+
    |                           MySensors security personalizer                          |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                               Configuration settings                               |
    +------------------------------------------------------------------------------------+
    | * Guided personalization/storage of keys in EEPROM                                 |
    | * Guided storage and generation of random serial in EEPROM                         |
    | * Software based personalization (no ATSHA204A usage whatsoever)                   |
    | * Will not require any UART confirmations                                          |
    | * Will store HMAC key to EEPROM                                                    |
    | * Will store AES key to EEPROM                                                     |
    | * Will generate soft serial using software                                         |
    | * Will store soft serial to EEPROM                                                 |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                           Hardware security peripherals                            |
    +--------------+--------------+--------------+------------------------------+--------+
    | Device       | Status       | Revision     | Serial number                | Locked |
    +--------------+--------------+--------------+------------------------------+--------+
    | AVR          | DETECTED     | N/A          | N/A (generation required)    | N/A    |
    +--------------+--------------+--------------+------------------------------+--------+
    
    +------------------------------------------------------------------------------------+
    |                                   Key generation                                   |
    +--------+--------+------------------------------------------------------------------+
    | Key ID | Status | Key                                                              |
    +--------+--------+------------------------------------------------------------------+
    | SERIAL | OK     | 160022F33241EA8DF2                                               |
    +--------+--------+------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                    Key storage                                     |
    +--------+--------+------------------------------------------------------------------+
    | Key ID | Status | Key                                                              |
    +--------+--------+------------------------------------------------------------------+
    | HMAC   | OK     | EFD9AF67B3F939FC663B17F2E644BCD7AED0C6820CC9D5454D05BDF282E567BA |
    | AES    | OK     | 4EA43132406FC4C4344E4A0E4589B506                                 |
    | SERIAL | OK     | 160022F33241EA8DF2                                               |
    +--------+--------+------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                       EEPROM                                       |
    +--------+--------+------------------------------------------------------------------+
    | Key ID | Status | Key                                                              |
    +--------+--------+------------------------------------------------------------------+
    | HMAC   | OK     | EFD9AF67B3F939FC663B17F2E644BCD7AED0C6820CC9D5454D05BDF282E567BA |
    | AES    | OK     | 4EA43132406FC4C4344E4A0E4589B506                                 |
    | SERIAL | OK     | 160022F33241EA8DF2                                               |
    +--------+--------+------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                      This nodes whitelist entry on other nodes                     |
    +------------------------------------------------------------------------------------+
    {.nodeId = <ID of this node>,.serial = {0x16,0x00,0x22,0xF3,0x32,0x41,0xEA,0x8D,0xF2}}
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                  WHAT TO DO NEXT?                                  |
    +------------------------------------------------------------------------------------+
    | This device has now been personalized. Run this sketch with its current settings   |
    | on all the devices in your network that have security enabled.                     |
    +------------------------------------------------------------------------------------+
    
    +------------------------------------------------------------------------------------+
    |                                  Execution result                                  |
    +------------------------------------------------------------------------------------+
    | SUCCESS                                                                            |
    +------------------------------------------------------------------------------------+
    

    And I thought this would be enough..... However, the GW and node don't seem to be communicating well because I'm getting a lot of "!TSF:MSG:SIGN FAIL" messages (although in the boot of the node the presentation looks good):

     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.2.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNAS--,VER=2.2.0
    25 MCO:BGN:BFR
    171 TSM:INIT
    173 TSF:WUR:MS=0
    180 TSM:INIT:TSP OK
    182 TSF:SID:OK,ID=4
    183 TSM:FPAR
    220 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    766 TSF:MSG:READ,0-0-4,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    772 TSF:MSG:FPAR OK,ID=0,D=1
    2227 TSM:FPAR:OK
    2228 TSM:ID
    2229 TSM:ID:OK
    2231 TSM:UPL
    2234 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2245 TSF:MSG:READ,0-0-4,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2250 TSF:MSG:PONG RECV,HP=1
    2252 TSM:UPL:OK
    2254 TSM:READY:ID=4,PAR=0,DIS=1
    2258 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    2266 TSF:MSG:READ,0-0-4,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    2273 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
    2297 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=0:<NONCE>
    2385 TSF:MSG:SEND,4-4-0-0,s=255,c=0,t=17,pt=0,l=5,sg=1,ft=0,st=OK:2.2.0
    2395 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2496 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    2583 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=6,pt=1,l=1,sg=1,ft=0,st=OK:0
    4591 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4614 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    4702 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=11,pt=0,l=13,sg=1,ft=0,st=OK:MIXED JOAOABS
    4712 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4813 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    4901 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=12,pt=0,l=3,sg=1,ft=0,st=OK:1.0
    4911 TSF:MSG:SEND,4-4-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5012 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    5100 TSF:MSG:SEND,4-4-0-0,s=1,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    5108 TSF:MSG:SEND,4-4-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5190 TSF:MSG:READ,0-0-4,s=1,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    5195 TSF:MSG:ACK
    5222 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    5310 TSF:MSG:SEND,4-4-0-0,s=2,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    5319 TSF:MSG:SEND,4-4-0-0,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5401 TSF:MSG:READ,0-0-4,s=2,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    5406 TSF:MSG:ACK
    5433 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    5521 TSF:MSG:SEND,4-4-0-0,s=3,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    5530 TSF:MSG:SEND,4-4-0-0,s=4,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5612 TSF:MSG:READ,0-0-4,s=3,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    5617 TSF:MSG:ACK
    5644 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    5732 TSF:MSG:SEND,4-4-0-0,s=4,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    5741 TSF:MSG:SEND,4-4-0-0,s=30,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5822 TSF:MSG:READ,0-0-4,s=4,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    5827 TSF:MSG:ACK
    5855 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    5943 TSF:MSG:SEND,4-4-0-0,s=30,c=0,t=0,pt=0,l=6,sg=1,ft=0,st=OK:POENTE
    5951 TSF:MSG:SEND,4-4-0-0,s=31,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6033 TSF:MSG:READ,0-0-4,s=30,c=0,t=0,pt=0,l=6,sg=0:POENTE
    6038 TSF:MSG:ACK
    6066 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6154 TSF:MSG:SEND,4-4-0-0,s=31,c=0,t=0,pt=0,l=8,sg=1,ft=0,st=OK:NASCENTE
    6163 TSF:MSG:SEND,4-4-0-0,s=10,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6245 TSF:MSG:READ,0-0-4,s=31,c=0,t=0,pt=0,l=8,sg=0:NASCENTE
    6250 TSF:MSG:ACK
    6277 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6365 TSF:MSG:SEND,4-4-0-0,s=10,c=0,t=6,pt=0,l=0,sg=1,ft=0,st=OK:
    6374 TSF:MSG:SEND,4-4-0-0,s=11,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6474 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6562 TSF:MSG:SEND,4-4-0-0,s=11,c=0,t=6,pt=0,l=0,sg=1,ft=0,st=OK:
    6571 TSF:MSG:SEND,4-4-0-0,s=50,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6671 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6759 TSF:MSG:SEND,4-4-0-0,s=50,c=0,t=7,pt=0,l=0,sg=1,ft=0,st=OK:
    6768 TSF:MSG:SEND,4-4-0-0,s=60,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6868 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6957 TSF:MSG:SEND,4-4-0-0,s=60,c=0,t=6,pt=0,l=0,sg=1,ft=0,st=OK:
    6965 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    7065 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    7153 TSF:MSG:SEND,4-4-0-0,s=40,c=0,t=1,pt=0,l=3,sg=1,ft=0,st=OK:PIR
    7159 MCO:REG:REQ
    7163 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=0,st=OK:2
    7243 TSF:MSG:READ,0-0-4,s=40,c=0,t=1,pt=0,l=3,sg=0:PIR
    7248 TSF:MSG:ACK
    7262 TSF:MSG:READ,0-0-4,s=255,c=3,t=16,pt=0,l=0,sg=1:
    7283 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    7372 TSF:MSG:READ,0-0-4,s=255,c=3,t=27,pt=1,l=1,sg=1:1
    7456 MCO:PIM:NODE REG=1
    7458 MCO:BGN:STP
    7465 MCO:SLP:MS=2000,SMS=0,I1=255,M1=255,I2=255,M2=255
    7471 TSF:TDI:TSL
    7473 MCO:SLP:WUP=-1
    7475 TSF:TRI:TSB
    7476 MCO:BGN:INIT OK,TSP=1
    7479 TSF:MSG:SEND,4-4-0-0,s=30,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    12485 !TSF:MSG:SIGN FAIL
    12487 TSF:MSG:SEND,4-4-0-0,s=31,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    17494 !TSF:MSG:SIGN FAIL
    0
    17496 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    22502 !TSF:MSG:SIGN FAIL
    0
    22505 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    27511 !TSF:MSG:SIGN FAIL
    0
    27514 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    

    By the way, at the moment, I'm not using any controller: I'm just in testing phase with each node connected to a different computer and checking its messages on the serial ports.

    Any idea of where did I failed in the procedure?

    Thanks,
    Joaoabs


  • Contest Winner

    @joaoabs Hi,
    I can't see anything wrong with the procedure, and it seems to work fine up to the sleep event. I don't know why it seem to break down after that point. There is nothing particular in the signing backend that care about sleep. You could try to enable verbose signing messages.
    But from the timestamps, it looks to me that your log indicate that a nonce request is sent, then after about 5s signing fails which suggests you hit the nonce timeout. That is, nobody responded to your nonce request. I suspect the "other end" is sleeping and does not listen to incoming messages. That mean signing will fail as the nonce has to be sent on request.
    In any case, having logs from both sides would help debugging. With or without verbose signing enabled.



  • Hi Anticimex,

    Yes, I can confirm its the GW that isn't answering.
    It just stops:

    0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RNNGAS--,VER=2.2.0
    0;255;3;0;9;48 TSM:INIT
    0;255;3;0;9;50 TSF:WUR:MS=0
    0;255;3;0;9;58 TSM:INIT:TSP OK
    0;255;3;0;9;61 TSM:INIT:GW MODE
    0;255;3;0;9;64 TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;68 MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.2.0
    0;255;3;0;9;72 MCO:BGN:STP
    0;255;3;0;9;78 MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;23922 TSF:MSG:READ,4-4-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;23928 TSF:MSG:BC
    0;255;3;0;9;23931 TSF:MSG:FPAR REQ,ID=4
    0;255;3;0;9;23936 TSF:PNG:SEND,TO=0
    0;255;3;0;9;23939 TSF:CKU:OK
    0;255;3;0;9;23941 TSF:MSG:GWL OK
    0;255;3;0;9;24338 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;25970 TSF:MSG:READ,4-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;25976 TSF:MSG:PINGED,ID=4,HP=1
    0;255;3;0;9;25981 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;25995 TSF:MSG:READ,4-4-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    0;255;3;0;9;26003 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    0;255;3;0;9;26010 TSF:MSG:READ,4-4-0,s=255,c=3,t=16,pt=0,l=0,sg=0:
    0;255;3;0;9;26034 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:<NONCE>
    0;255;3;0;9;26121 TSF:MSG:READ,4-4-0,s=255,c=0,t=18,pt=0,l=5,sg=1:2.2.0
    4;255;0;0;18;2.2.0
    0;255;3;0;9;26208 TSF:MSG:READ,4-4-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;26231 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;26319 TSF:MSG:READ,4-4-0,s=255,c=3,t=6,pt=1,l=1,sg=1:0
    4;255;3;0;6;0
    0;255;3;0;9;28326 TSF:MSG:READ,4-4-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;28349 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;28437 TSF:MSG:READ,4-4-0,s=255,c=3,t=11,pt=0,l=13,sg=1:MIXED JOAOABS
    4;255;3;0;11;MIXED JOAOABS
    0;255;3;0;9;28524 TSF:MSG:READ,4-4-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;28549 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;28637 TSF:MSG:READ,4-4-0,s=255,c=3,t=12,pt=0,l=3,sg=1:1.0
    4;255;3;0;12;1.0
    0;255;3;0;9;28723 TSF:MSG:READ,4-4-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;28746 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;28833 TSF:MSG:READ,4-4-0,s=1,c=0,t=3,pt=0,l=6,sg=1:RELAYS
    0;255;3;0;9;28919 TSF:MSG:ACK REQ
    0;255;3;0;9;28924 TSF:MSG:SEND,0-0-4-4,s=1,c=0,t=3,pt=0,l=6,sg=0,ft=0,st=OK:RELAYS
    4;1;0;0;3;RELAYS
    0;255;3;0;9;28933 TSF:MSG:READ,4-4-0,s=2,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;28956 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;29043 TSF:MSG:READ,4-4-0,s=2,c=0,t=3,pt=0,l=6,sg=1:RELAYS
    0;255;3;0;9;29129 TSF:MSG:ACK REQ
    0;255;3;0;9;29134 TSF:MSG:SEND,0-0-4-4,s=2,c=0,t=3,pt=0,l=6,sg=0,ft=0,st=OK:RELAYS
    4;2;0;0;3;RELAYS
    0;255;3;0;9;29143 TSF:MSG:READ,4-4-0,s=3,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;29166 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;29253 TSF:MSG:READ,4-4-0,s=3,c=0,t=3,pt=0,l=6,sg=1:RELAYS
    0;255;3;0;9;29339 TSF:MSG:ACK REQ
    0;255;3;0;9;29344 TSF:MSG:SEND,0-0-4-4,s=3,c=0,t=3,pt=0,l=6,sg=0,ft=0,st=OK:RELAYS
    4;3;0;0;3;RELAYS
    0;255;3;0;9;29352 TSF:MSG:READ,4-4-0,s=4,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;29376 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;29463 TSF:MSG:READ,4-4-0,s=4,c=0,t=3,pt=0,l=6,sg=1:RELAYS
    0;255;3;0;9;29549 TSF:MSG:ACK REQ
    0;255;3;0;9;29554 TSF:MSG:SEND,0-0-4-4,s=4,c=0,t=3,pt=0,l=6,sg=0,ft=0,st=OK:RELAYS
    4;4;0;0;3;RELAYS
    0;255;3;0;9;29562 TSF:MSG:READ,4-4-0,s=30,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;29586 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;29673 TSF:MSG:READ,4-4-0,s=30,c=0,t=0,pt=0,l=6,sg=1:POENTE
    0;255;3;0;9;29759 TSF:MSG:ACK REQ
    0;255;3;0;9;29764 TSF:MSG:SEND,0-0-4-4,s=30,c=0,t=0,pt=0,l=6,sg=0,ft=0,st=OK:POENTE
    4;30;0;0;0;POENTE
    0;255;3;0;9;29772 TSF:MSG:READ,4-4-0,s=31,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;29796 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;29883 TSF:MSG:READ,4-4-0,s=31,c=0,t=0,pt=0,l=8,sg=1:NASCENTE
    0;255;3;0;9;29970 TSF:MSG:ACK REQ
    0;255;3;0;9;29975 TSF:MSG:SEND,0-0-4-4,s=31,c=0,t=0,pt=0,l=8,sg=0,ft=0,st=OK:NASCENTE
    4;31;0;0;0;NASCENTE
    0;255;3;0;9;29983 TSF:MSG:READ,4-4-0,s=10,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;30007 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;30094 TSF:MSG:READ,4-4-0,s=10,c=0,t=6,pt=0,l=0,sg=1:
    4;10;0;0;6;
    0;255;3;0;9;30180 TSF:MSG:READ,4-4-0,s=11,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;30203 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;30290 TSF:MSG:READ,4-4-0,s=11,c=0,t=6,pt=0,l=0,sg=1:
    4;11;0;0;6;
    0;255;3;0;9;30376 TSF:MSG:READ,4-4-0,s=50,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;30400 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;30487 TSF:MSG:READ,4-4-0,s=50,c=0,t=7,pt=0,l=0,sg=1:
    4;50;0;0;7;
    0;255;3;0;9;30574 TSF:MSG:READ,4-4-0,s=60,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;30597 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;30685 TSF:MSG:READ,4-4-0,s=60,c=0,t=6,pt=0,l=0,sg=1:
    4;60;0;0;6;
    0;255;3;0;9;30771 TSF:MSG:READ,4-4-0,s=40,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;30793 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;30881 TSF:MSG:READ,4-4-0,s=40,c=0,t=1,pt=0,l=3,sg=1:PIR
    0;255;3;0;9;30966 TSF:MSG:ACK REQ
    0;255;3;0;9;30971 TSF:MSG:SEND,0-0-4-4,s=40,c=0,t=1,pt=0,l=3,sg=0,ft=0,st=OK:PIR
    4;40;0;0;1;PIR
    0;255;3;0;9;30980 TSF:MSG:READ,4-4-0,s=255,c=3,t=26,pt=1,l=1,sg=1:2
    0;255;3;0;9;30988 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
    0;255;3;0;9;31009 TSF:MSG:READ,4-4-0,s=255,c=3,t=17,pt=6,l=25,sg=0:<NONCE>
    0;255;3;0;9;31097 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=27,pt=1,l=1,sg=1,ft=0,st=OK:1
    
    

    How can I enable the signing debug? And should I enable it in both or just in the GW?

    And by the way, I'm not a native english speaker.... What is a "nonce" in the mysensors scope?

    Thanks!
    Joaoabs


  • Contest Winner

    @joaoabs Hi,
    No worries. Verbose signing debug is toggled by the flag MY_DEBUG_VERBOSE_SIGNING.
    Nonce is not a mysensors term, it is a generic security term and is just a designator for some random challenge used for establishing a secure context.
    See Wikipedia.

    Another good signing debug resource is the official docs: https://www.mysensors.org/apidocs/group__MySigningTroubleshootinggrp.html



  • @anticimex said in SW_Signing failing: !TSF:MSG:SIGN FAIL:

    MY_DEBUG_VERBOSE_SIGNING.

    Well, with the debug I can now understand that the signing is being used at the presentation, so the configuration is fine. We just need to find it out why it fails after a while. I've enabled the node as repeater to avoid sleep, but it keeps failing.

    I also thought it could be a eeprom overwrite (my sketch includes the relay code from my sensors that stores statuses in eeprom), but if that was the case, it wouldn't work after re-booting the arduino.

    Could it be as simple as a memory leak in the node? Its loaded and there is no much more left....
    But again, it's the gateway that stops responding...

    Not sure how to solve this one... Any ideas?

    Node:

    Sketch uses 28862 bytes (93%) of program storage space. Maximum is 30720 bytes.
    Global variables use 1585 bytes (77%) of dynamic memory, leaving 463 bytes for local variables. Maximum is 2048 bytes.Here
    
     
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.2.0
    
    16 MCO:BGN:INIT REPEATER,CP=RNNRAS--,VER=2.2.0
    26 MCO:BGN:BFR
    143 SGN:PER:OK
    162 SGN:INI:BND OK
    164 TSM:INIT
    165 TSF:WUR:MS=0
    173 TSM:INIT:TSP OK
    175 TSF:SID:OK,ID=4
    176 TSM:FPAR
    178 SGN:SGN:NREQ=255
    215 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    742 TSF:MSG:READ,0-0-4,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    747 SGN:SKP:MSG CMD=3,TYPE=8
    750 TSF:MSG:FPAR OK,ID=0,D=1
    2222 TSM:FPAR:OK
    2223 TSM:ID
    2224 TSM:ID:OK
    2226 TSM:UPL
    2227 SGN:SKP:MSG CMD=3,TYPE=24
    2231 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2250 TSF:MSG:READ,0-0-4,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2255 SGN:SKP:MSG CMD=3,TYPE=25
    2257 TSF:MSG:PONG RECV,HP=1
    2260 TSM:UPL:OK
    2262 TSM:READY:ID=4,PAR=0,DIS=1
    2265 SGN:PRE:SGN REQ
    2267 SGN:PRE:WHI NREQ
    2269 SGN:SKP:MSG CMD=3,TYPE=15
    2274 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    2280 SGN:PRE:XMT,TO=0
    2282 SGN:PRE:WAIT GW
    2299 TSF:MSG:READ,0-0-4,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    2305 SGN:SKP:MSG CMD=3,TYPE=15
    2308 SGN:PRE:SGN REQ,FROM=0
    2311 SGN:SKP:MSG CMD=3,TYPE=16
    2315 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
    2321 SGN:SGN:NCE REQ,TO=0
    2345 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=0:<NONCE>
    2351 SGN:SKP:MSG CMD=3,TYPE=17
    2354 SGN:NCE:FROM=0
    2356 SGN:BND:NONCE=7398A8658B1243BC9F3DA34CB0EA84C6CB438531CAD6DD7370AAAAAAAAAAAAAA
    2443 SGN:BND:HMAC=75D2449421089944417C6B732BC380240FDBF6B5C5E8B80A297BEC236A978815
    2450 SGN:SGN:SGN
    2455 TSF:MSG:SEND,4-4-0-0,s=255,c=0,t=18,pt=0,l=5,sg=1,ft=0,st=OK:2.2.0
    2461 SGN:SKP:MSG CMD=3,TYPE=16
    2466 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2472 SGN:SGN:NCE REQ,TO=0
    2592 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    2598 SGN:SKP:MSG CMD=3,TYPE=17
    2600 SGN:NCE:FROM=0
    2603 SGN:BND:NONCE=85FEA439ECA14C2904AAA21BE1D0E2B4D2FFDED742E39995FBAAAAAAAAAAAAAA
    2691 SGN:BND:HMAC=E460F110EAFC254FFC3B2D945D74A83493CE694C73211FBF762C9B8003A52D9B
    2698 SGN:SGN:SGN
    2702 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=6,pt=1,l=1,sg=1,ft=0,st=OK:0
    4708 SGN:SKP:MSG CMD=3,TYPE=16
    4713 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4719 SGN:SGN:NCE REQ,TO=0
    4743 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    4749 SGN:SKP:MSG CMD=3,TYPE=17
    4752 SGN:NCE:FROM=0
    4754 SGN:BND:NONCE=EC873D0763BCF3F0A36F908806B0C96B0251C6B67F9928AC84AAAAAAAAAAAAAA
    4841 SGN:BND:HMAC=33845AD9A94FA682AB917198182D5C39E5FD562D7CA4A01B9D756640F61E6973
    4848 SGN:SGN:SGN
    4852 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=11,pt=0,l=13,sg=1,ft=0,st=OK:MIXED JOAOABS
    4860 SGN:SKP:MSG CMD=3,TYPE=16
    4866 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4872 SGN:SGN:NCE REQ,TO=0
    4992 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    4998 SGN:SKP:MSG CMD=3,TYPE=17
    5001 SGN:NCE:FROM=0
    5003 SGN:BND:NONCE=F66A97005E51062331505AA96168CAF9538AC869C886C99310AAAAAAAAAAAAAA
    5090 SGN:BND:HMAC=4E6C5B7463F3CB02247BC05B41BA4BC0D05DAB965514C6737154EDC3F23127A4
    5097 SGN:SGN:SGN
    5101 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=12,pt=0,l=3,sg=1,ft=0,st=OK:1.0
    5107 SGN:SKP:MSG CMD=3,TYPE=16
    5113 TSF:MSG:SEND,4-4-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5118 SGN:SGN:NCE REQ,TO=0
    5238 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    5244 SGN:SKP:MSG CMD=3,TYPE=17
    5246 SGN:NCE:FROM=0
    5249 SGN:BND:NONCE=EF58BA2F93398D09F1C29AD294E5E390B93C7F73D9316B09B1AAAAAAAAAAAAAA
    5337 SGN:BND:HMAC=B55F0C06D850255761EB532B2A5B27271379107EE11A84F0C993F9F08B53EF33
    5344 SGN:SGN:SGN
    5348 TSF:MSG:SEND,4-4-0-0,s=1,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    5354 SGN:SKP:MSG CMD=3,TYPE=16
    5360 TSF:MSG:SEND,4-4-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5365 SGN:SGN:NCE REQ,TO=0
    5462 TSF:MSG:READ,0-0-4,s=1,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    5467 SGN:SKP:ACK CMD=0,TYPE=3
    5470 TSF:MSG:ACK
    5501 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    5507 SGN:SKP:MSG CMD=3,TYPE=17
    5510 SGN:NCE:FROM=0
    5512 SGN:BND:NONCE=46BE373F406494B4011BC61D6EF12BC8BB12F5727A7765CBA9AAAAAAAAAAAAAA
    5599 SGN:BND:HMAC=43EA678DDAEBBFA364BF162AF5E6B564534DF2BBA27342C82DB7786FAE1C839C
    5607 SGN:SGN:SGN
    5611 TSF:MSG:SEND,4-4-0-0,s=2,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    5617 SGN:SKP:MSG CMD=3,TYPE=16
    5622 TSF:MSG:SEND,4-4-0-0,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5628 SGN:SGN:NCE REQ,TO=0
    5725 TSF:MSG:READ,0-0-4,s=2,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    5730 SGN:SKP:ACK CMD=0,TYPE=3
    5733 TSF:MSG:ACK
    5765 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    5770 SGN:SKP:MSG CMD=3,TYPE=17
    5773 SGN:NCE:FROM=0
    5775 SGN:BND:NONCE=72CDF777DED84D899075FD474FE01055A98F4F598E688E3073AAAAAAAAAAAAAA
    5862 SGN:BND:HMAC=2DF8B15EC5D7285BFC26BDA1F715DD0FC0069C26B99575BEB56B10DD2F914F13
    5869 SGN:SGN:SGN
    5873 TSF:MSG:SEND,4-4-0-0,s=3,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    5880 SGN:SKP:MSG CMD=3,TYPE=16
    5885 TSF:MSG:SEND,4-4-0-0,s=4,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5892 SGN:SGN:NCE REQ,TO=0
    5988 TSF:MSG:READ,0-0-4,s=3,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    5993 SGN:SKP:ACK CMD=0,TYPE=3
    5995 TSF:MSG:ACK
    6027 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6033 SGN:SKP:MSG CMD=3,TYPE=17
    6036 SGN:NCE:FROM=0
    6038 SGN:BND:NONCE=DF6D753F198443500BE633B6D3FAE7C466F79404C8910BA55FAAAAAAAAAAAAAA
    6125 SGN:BND:HMAC=CFA92CD5B0558F1C4DD8447444CFB2FB8C034940A4B5F3C32A6E5A6F4CA59453
    6132 SGN:SGN:SGN
    6136 TSF:MSG:SEND,4-4-0-0,s=4,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    6142 SGN:SKP:MSG CMD=3,TYPE=16
    6149 TSF:MSG:SEND,4-4-0-0,s=30,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6155 SGN:SGN:NCE REQ,TO=0
    6250 TSF:MSG:READ,0-0-4,s=4,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    6255 SGN:SKP:ACK CMD=0,TYPE=3
    6258 TSF:MSG:ACK
    6290 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6296 SGN:SKP:MSG CMD=3,TYPE=17
    6298 SGN:NCE:FROM=0
    6300 SGN:BND:NONCE=0B1D83A00F89B8AEDDE0CC1A17B6CABDC028901EC0A6EAB13EAAAAAAAAAAAAAA
    6388 SGN:BND:HMAC=8862DDB7FDF1794F50C06676C2F838E71A8468EC22726B49E506B6D320A3009A
    6395 SGN:SGN:SGN
    6400 TSF:MSG:SEND,4-4-0-0,s=30,c=0,t=0,pt=0,l=6,sg=1,ft=0,st=OK:POENTE
    6406 SGN:SKP:MSG CMD=3,TYPE=16
    6412 TSF:MSG:SEND,4-4-0-0,s=31,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6418 SGN:SGN:NCE REQ,TO=0
    6513 TSF:MSG:READ,0-0-4,s=30,c=0,t=0,pt=0,l=6,sg=0:POENTE
    6519 SGN:SKP:ACK CMD=0,TYPE=0
    6521 TSF:MSG:ACK
    6553 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6559 SGN:SKP:MSG CMD=3,TYPE=17
    6562 SGN:NCE:FROM=0
    6564 SGN:BND:NONCE=F0D039920909FDE780B2EC61713AE3B357471C95B66D501751AAAAAAAAAAAAAA
    6651 SGN:BND:HMAC=FE0162A68ADB100C40363582C95207DE14694124C487CAD706B326B255B1234B
    6659 SGN:SGN:SGN
    6663 TSF:MSG:SEND,4-4-0-0,s=31,c=0,t=0,pt=0,l=8,sg=1,ft=0,st=OK:NASCENTE
    6670 SGN:SKP:MSG CMD=3,TYPE=16
    6675 TSF:MSG:SEND,4-4-0-0,s=10,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6681 SGN:SGN:NCE REQ,TO=0
    6777 TSF:MSG:READ,0-0-4,s=31,c=0,t=0,pt=0,l=8,sg=0:NASCENTE
    6782 SGN:SKP:ACK CMD=0,TYPE=0
    6786 TSF:MSG:ACK
    6817 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    6822 SGN:SKP:MSG CMD=3,TYPE=17
    6825 SGN:NCE:FROM=0
    6828 SGN:BND:NONCE=501756E2817E643A3E517CEC1D16461B471DB2E600BCD878B7AAAAAAAAAAAAAA
    6915 SGN:BND:HMAC=9DA69C9ABD8A32677FD13F37DA542D07030EA626B3337CC4D384EC44D70CEF20
    6923 SGN:SGN:SGN
    6927 TSF:MSG:SEND,4-4-0-0,s=10,c=0,t=6,pt=0,l=0,sg=1,ft=0,st=OK:
    6933 SGN:SKP:MSG CMD=3,TYPE=16
    6938 TSF:MSG:SEND,4-4-0-0,s=11,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6944 SGN:SGN:NCE REQ,TO=0
    7063 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    7069 SGN:SKP:MSG CMD=3,TYPE=17
    7071 SGN:NCE:FROM=0
    7073 SGN:BND:NONCE=ED83EED6A2E7E85EB1AEEE2DED74C058B89C3D6A43E2CC30C4AAAAAAAAAAAAAA
    7161 SGN:BND:HMAC=A2AC5D78A004DDB476DABACE267DCF06ACE0689D9443849974F0FC198FD2015D
    7169 SGN:SGN:SGN
    7173 TSF:MSG:SEND,4-4-0-0,s=11,c=0,t=6,pt=0,l=0,sg=1,ft=0,st=OK:
    7179 SGN:SKP:MSG CMD=3,TYPE=16
    7184 TSF:MSG:SEND,4-4-0-0,s=50,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    7190 SGN:SGN:NCE REQ,TO=0
    7309 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    7315 SGN:SKP:MSG CMD=3,TYPE=17
    7317 SGN:NCE:FROM=0
    7319 SGN:BND:NONCE=C95888EBF76AB6923853908CC55D06D5BF9146B3933F65378FAAAAAAAAAAAAAA
    7407 SGN:BND:HMAC=AD23837E2FA717DC58F1CA64D37EBEB14B0887329D194389705DA32A6B0837B3
    7414 SGN:SGN:SGN
    7418 TSF:MSG:SEND,4-4-0-0,s=50,c=0,t=7,pt=0,l=0,sg=1,ft=0,st=OK:
    7425 SGN:SKP:MSG CMD=3,TYPE=16
    7430 TSF:MSG:SEND,4-4-0-0,s=60,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    7436 SGN:SGN:NCE REQ,TO=0
    7555 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    7561 SGN:SKP:MSG CMD=3,TYPE=17
    7564 SGN:NCE:FROM=0
    7566 SGN:BND:NONCE=AD9D69D1BDEC7D1893E350501EB91FDFE177202A768C8EE1B9AAAAAAAAAAAAAA
    7653 SGN:BND:HMAC=77F996E81C6AFD34CDB4207AD79AC93B681DF93F3FD2C1A115F236D23556CF63
    7660 SGN:SGN:SGN
    7664 TSF:MSG:SEND,4-4-0-0,s=60,c=0,t=6,pt=0,l=0,sg=1,ft=0,st=OK:
    7670 SGN:SKP:MSG CMD=3,TYPE=16
    7675 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    7682 SGN:SGN:NCE REQ,TO=0
    7800 TSF:MSG:READ,0-0-4,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    7806 SGN:SKP:MSG CMD=3,TYPE=17
    7810 SGN:NCE:FROM=0
    7812 SGN:BND:NONCE=5A51EDE317B07AB430EA6A605F5D16B1A1D5B459A17AAA8BDAAAAAAAAAAAAAAA
    7899 SGN:BND:HMAC=6C6F971EE3BA968ABE5EF2A6D1B44CA1C38BC8EA83D76A204BF4C8B232826A89
    7906 SGN:SGN:SGN
    7910 TSF:MSG:SEND,4-4-0-0,s=40,c=0,t=1,pt=0,l=3,sg=1,ft=0,st=OK:PIR
    7916 MCO:REG:REQ
    7918 SGN:SKP:MSG CMD=3,TYPE=26
    7923 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=0,st=OK:2
    8024 TSF:MSG:READ,0-0-4,s=40,c=0,t=1,pt=0,l=3,sg=0:PIR
    8029 SGN:SKP:ACK CMD=0,TYPE=1
    8032 TSF:MSG:ACK
    8048 TSF:MSG:READ,0-0-4,s=255,c=3,t=16,pt=0,l=0,sg=0:
    8053 SGN:SKP:MSG CMD=3,TYPE=16
    8070 SGN:SKP:MSG CMD=3,TYPE=17
    8076 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:<NONCE>
    8082 SGN:NCE:XMT,TO=4
    8190 TSF:MSG:READ,0-0-4,s=255,c=3,t=27,pt=1,l=1,sg=1:1
    8196 SGN:BND:NONCE=BA5601AC14E5860AD182906737D95484017AC13DBAFC9F8E32AAAAAAAAAAAAAA
    8284 SGN:BND:HMAC=7A6EA5CA7E3C880F77BAEEB6BCF45386AA5ACA908B709FC63E25E3C218CF07F1
    8291 SGN:VER:OK
    8292 MCO:PIM:NODE REG=1
    8294 MCO:BGN:STP
    8301 MCO:SLP:MS=2000,SMS=0,I1=255,M1=255,I2=255,M2=255
    8306 !MCO:SLP:REP
    10307 MCO:BGN:INIT OK,TSP=1
    10309 SGN:SKP:MSG CMD=3,TYPE=16
    10313 TSF:MSG:SEND,4-4-0-0,s=30,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    10319 SGN:SGN:NCE REQ,TO=0
    15321 !SGN:SGN:SGN FAIL
    15323 !TSF:MSG:SIGN FAIL
    15325 SGN:SKP:MSG CMD=3,TYPE=16
    15328 TSF:MSG:SEND,4-4-0-0,s=31,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    15334 SGN:SGN:NCE REQ,TO=0
    20337 !SGN:SGN:SGN FAIL
    20339 !TSF:MSG:SIGN FAIL
    0
    20341 SGN:SKP:MSG CMD=3,TYPE=16
    20345 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    20350 SGN:SGN:NCE REQ,TO=0
    25354 !SGN:SGN:SGN FAIL
    25356 !TSF:MSG:SIGN FAIL
    0
    25358 SGN:SKP:MSG CMD=3,TYPE=16
    25362 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    25368 SGN:SGN:NCE REQ,TO=0
    30370 !SGN:SGN:SGN FAIL
    30372 !TSF:MSG:SIGN FAIL
    0
    30374 SGN:SKP:MSG CMD=3,TYPE=16
    30379 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    30385 SGN:SGN:NCE REQ,TO=0
    35387 !SGN:SGN:SGN FAIL
    35389 !TSF:MSG:SIGN FAIL
    0
    35391 SGN:SKP:MSG CMD=3,TYPE=16
    35395 TSF:MSG:SEND,4-4-0-0,s=40,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    35401 SGN:SGN:NCE REQ,TO=0```
    

    Gateway:

    Sketch uses 21440 bytes (69%) of program storage space. Maximum is 30720 bytes.```
    
    
    0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RNNGAS--,VER=2.2.0
    0;255;3;0;9;26 SGN:PER:OK
    0;255;3;0;9;48 SGN:INI:BND OK
    0;255;3;0;9;51 TSM:INIT
    0;255;3;0;9;53 TSF:WUR:MS=0
    0;255;3;0;9;61 TSM:INIT:TSP OK
    0;255;3;0;9;64 TSM:INIT:GW MODE
    0;255;3;0;9;67 TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;71 MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.2.0
    0;255;3;0;9;75 MCO:BGN:STP
    0;255;3;0;9;81 MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;20994 TSF:MSG:READ,4-4-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;21000 TSF:MSG:BC
    0;255;3;0;9;21003 TSF:MSG:FPAR REQ,ID=4
    0;255;3;0;9;21006 TSF:PNG:SEND,TO=0
    0;255;3;0;9;21009 TSF:CKU:OK
    0;255;3;0;9;21012 TSF:MSG:GWL OK
    0;255;3;0;9;21550 SGN:SKP:MSG CMD=3,TYPE=8
    0;255;3;0;9;21556 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;23044 TSF:MSG:READ,4-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;23050 SGN:SKP:MSG CMD=3,TYPE=24
    0;255;3;0;9;23053 TSF:MSG:PINGED,ID=4,HP=1
    0;255;3;0;9;23057 SGN:SKP:MSG CMD=3,TYPE=25
    0;255;3;0;9;23063 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;23086 TSF:MSG:READ,4-4-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    0;255;3;0;9;23092 SGN:SKP:MSG CMD=3,TYPE=15
    0;255;3;0;9;23096 SGN:PRE:SGN REQ,FROM=4
    0;255;3;0;9;23100 SGN:PRE:SGN REQ,TO=4
    0;255;3;0;9;23103 SGN:PRE:WHI NREQ,TO=4
    0;255;3;0;9;23107 SGN:SKP:MSG CMD=3,TYPE=15
    0;255;3;0;9;23112 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    0;255;3;0;9;23119 SGN:PRE:XMT,TO=4
    0;255;3;0;9;23127 TSF:MSG:READ,4-4-0,s=255,c=3,t=16,pt=0,l=0,sg=0:
    0;255;3;0;9;23133 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;23151 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;23158 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:<NONCE>
    0;255;3;0;9;23165 SGN:NCE:XMT,TO=0
    0;255;3;0;9;23267 TSF:MSG:READ,4-4-0,s=255,c=0,t=18,pt=0,l=5,sg=1:2.2.0
    0;255;3;0;9;23273 SGN:BND:NONCE=7398A8658B1243BC9F3DA34CB0EA84C6CB438531CAD6DD7370AAAAAAAAAAAAAA
    0;255;3;0;9;23361 SGN:BND:HMAC=75D2449421089944417C6B732BC380240FDBF6B5C5E8B80A297BEC236A978815
    0;255;3;0;9;23370 SGN:VER:OK
    4;255;0;0;18;2.2.0
    0;255;3;0;9;23373 TSF:MSG:READ,4-4-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;23380 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;23399 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;23405 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;23412 SGN:NCE:XMT,TO=0
    0;255;3;0;9;23514 TSF:MSG:READ,4-4-0,s=255,c=3,t=6,pt=1,l=1,sg=1:0
    0;255;3;0;9;23520 SGN:BND:NONCE=85FEA439ECA14C2904AAA21BE1D0E2B4D2FFDED742E39995FBAAAAAAAAAAAAAA
    0;255;3;0;9;23608 SGN:BND:HMAC=E460F110EAFC254FFC3B2D945D74A83493CE694C73211FBF762C9B8003A52D9B
    0;255;3;0;9;23617 SGN:VER:OK
    4;255;3;0;6;0
    0;255;3;0;9;25525 TSF:MSG:READ,4-4-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;25530 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;25548 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;25555 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;25563 SGN:NCE:XMT,TO=0
    0;255;3;0;9;25664 TSF:MSG:READ,4-4-0,s=255,c=3,t=11,pt=0,l=13,sg=1:MIXED JOAOABS
    0;255;3;0;9;25671 SGN:BND:NONCE=EC873D0763BCF3F0A36F908806B0C96B0251C6B67F9928AC84AAAAAAAAAAAAAA
    0;255;3;0;9;25759 SGN:BND:HMAC=33845AD9A94FA682AB917198182D5C39E5FD562D7CA4A01B9D756640F61E6973
    0;255;3;0;9;25767 SGN:VER:OK
    4;255;3;0;11;MIXED JOAOABS
    0;255;3;0;9;25772 TSF:MSG:READ,4-4-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;25779 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;25797 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;25803 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;25811 SGN:NCE:XMT,TO=0
    0;255;3;0;9;25913 TSF:MSG:READ,4-4-0,s=255,c=3,t=12,pt=0,l=3,sg=1:1.0
    0;255;3;0;9;25919 SGN:BND:NONCE=F66A97005E51062331505AA96168CAF9538AC869C886C99310AAAAAAAAAAAAAA
    0;255;3;0;9;26007 SGN:BND:HMAC=4E6C5B7463F3CB02247BC05B41BA4BC0D05DAB965514C6737154EDC3F23127A4
    0;255;3;0;9;26015 SGN:VER:OK
    4;255;3;0;12;1.0
    0;255;3;0;9;26019 TSF:MSG:READ,4-4-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;26025 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;26044 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;26050 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;26058 SGN:NCE:XMT,TO=0
    0;255;3;0;9;26160 TSF:MSG:READ,4-4-0,s=1,c=0,t=3,pt=0,l=6,sg=1:RELAYS
    0;255;3;0;9;26166 SGN:BND:NONCE=EF58BA2F93398D09F1C29AD294E5E390B93C7F73D9316B09B1AAAAAAAAAAAAAA
    0;255;3;0;9;26254 SGN:BND:HMAC=B55F0C06D850255761EB532B2A5B27271379107EE11A84F0C993F9F08B53EF33
    0;255;3;0;9;26262 SGN:VER:OK
    0;255;3;0;9;26265 TSF:MSG:ACK REQ
    0;255;3;0;9;26268 SGN:SKP:ACK CMD=0,TYPE=3
    0;255;3;0;9;26273 TSF:MSG:SEND,0-0-4-4,s=1,c=0,t=3,pt=0,l=6,sg=0,ft=0,st=OK:RELAYS
    4;1;0;0;3;RELAYS
    0;255;3;0;9;26281 TSF:MSG:READ,4-4-0,s=2,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;26289 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;26307 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;26313 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;26320 SGN:NCE:XMT,TO=0
    0;255;3;0;9;26422 TSF:MSG:READ,4-4-0,s=2,c=0,t=3,pt=0,l=6,sg=1:RELAYS
    0;255;3;0;9;26428 SGN:BND:NONCE=46BE373F406494B4011BC61D6EF12BC8BB12F5727A7765CBA9AAAAAAAAAAAAAA
    0;255;3;0;9;26517 SGN:BND:HMAC=43EA678DDAEBBFA364BF162AF5E6B564534DF2BBA27342C82DB7786FAE1C839C
    0;255;3;0;9;26525 SGN:VER:OK
    0;255;3;0;9;26527 TSF:MSG:ACK REQ
    0;255;3;0;9;26530 SGN:SKP:ACK CMD=0,TYPE=3
    0;255;3;0;9;26536 TSF:MSG:SEND,0-0-4-4,s=2,c=0,t=3,pt=0,l=6,sg=0,ft=0,st=OK:RELAYS
    4;2;0;0;3;RELAYS
    0;255;3;0;9;26545 TSF:MSG:READ,4-4-0,s=3,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;26551 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;26569 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;26576 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;26584 SGN:NCE:XMT,TO=0
    0;255;3;0;9;26685 TSF:MSG:READ,4-4-0,s=3,c=0,t=3,pt=0,l=6,sg=1:RELAYS
    0;255;3;0;9;26691 SGN:BND:NONCE=72CDF777DED84D899075FD474FE01055A98F4F598E688E3073AAAAAAAAAAAAAA
    0;255;3;0;9;26779 SGN:BND:HMAC=2DF8B15EC5D7285BFC26BDA1F715DD0FC0069C26B99575BEB56B10DD2F914F13
    0;255;3;0;9;26787 SGN:VER:OK
    0;255;3;0;9;26790 TSF:MSG:ACK REQ
    0;255;3;0;9;26793 SGN:SKP:ACK CMD=0,TYPE=3
    0;255;3;0;9;26800 TSF:MSG:SEND,0-0-4-4,s=3,c=0,t=3,pt=0,l=6,sg=0,ft=0,st=OK:RELAYS
    4;3;0;0;3;RELAYS
    0;255;3;0;9;26808 TSF:MSG:READ,4-4-0,s=4,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;26814 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;26832 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;26839 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;26847 SGN:NCE:XMT,TO=0
    0;255;3;0;9;26947 TSF:MSG:READ,4-4-0,s=4,c=0,t=3,pt=0,l=6,sg=1:RELAYS
    0;255;3;0;9;26954 SGN:BND:NONCE=DF6D753F198443500BE633B6D3FAE7C466F79404C8910BA55FAAAAAAAAAAAAAA
    0;255;3;0;9;27042 SGN:BND:HMAC=CFA92CD5B0558F1C4DD8447444CFB2FB8C034940A4B5F3C32A6E5A6F4CA59453
    0;255;3;0;9;27051 SGN:VER:OK
    0;255;3;0;9;27054 TSF:MSG:ACK REQ
    0;255;3;0;9;27057 SGN:SKP:ACK CMD=0,TYPE=3
    0;255;3;0;9;27062 TSF:MSG:SEND,0-0-4-4,s=4,c=0,t=3,pt=0,l=6,sg=0,ft=0,st=OK:RELAYS
    4;4;0;0;3;RELAYS
    0;255;3;0;9;27070 TSF:MSG:READ,4-4-0,s=30,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;27077 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;27096 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;27102 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;27110 SGN:NCE:XMT,TO=0
    0;255;3;0;9;27210 TSF:MSG:READ,4-4-0,s=30,c=0,t=0,pt=0,l=6,sg=1:POENTE
    0;255;3;0;9;27217 SGN:BND:NONCE=0B1D83A00F89B8AEDDE0CC1A17B6CABDC028901EC0A6EAB13EAAAAAAAAAAAAAA
    0;255;3;0;9;27305 SGN:BND:HMAC=8862DDB7FDF1794F50C06676C2F838E71A8468EC22726B49E506B6D320A3009A
    0;255;3;0;9;27314 SGN:VER:OK
    0;255;3;0;9;27317 TSF:MSG:ACK REQ
    0;255;3;0;9;27320 SGN:SKP:ACK CMD=0,TYPE=0
    0;255;3;0;9;27325 TSF:MSG:SEND,0-0-4-4,s=30,c=0,t=0,pt=0,l=6,sg=0,ft=0,st=OK:POENTE
    4;30;0;0;0;POENTE
    0;255;3;0;9;27333 TSF:MSG:READ,4-4-0,s=31,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;27340 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;27359 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;27365 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;27373 SGN:NCE:XMT,TO=0
    0;255;3;0;9;27473 TSF:MSG:READ,4-4-0,s=31,c=0,t=0,pt=0,l=8,sg=1:NASCENTE
    0;255;3;0;9;27481 SGN:BND:NONCE=F0D039920909FDE780B2EC61713AE3B357471C95B66D501751AAAAAAAAAAAAAA
    0;255;3;0;9;27569 SGN:BND:HMAC=FE0162A68ADB100C40363582C95207DE14694124C487CAD706B326B255B1234B
    0;255;3;0;9;27577 SGN:VER:OK
    0;255;3;0;9;27580 TSF:MSG:ACK REQ
    0;255;3;0;9;27583 SGN:SKP:ACK CMD=0,TYPE=0
    0;255;3;0;9;27589 TSF:MSG:SEND,0-0-4-4,s=31,c=0,t=0,pt=0,l=8,sg=0,ft=0,st=OK:NASCENTE
    4;31;0;0;0;NASCENTE
    0;255;3;0;9;27597 TSF:MSG:READ,4-4-0,s=10,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;27603 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;27622 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;27629 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;27636 SGN:NCE:XMT,TO=0
    0;255;3;0;9;27738 TSF:MSG:READ,4-4-0,s=10,c=0,t=6,pt=0,l=0,sg=1:
    0;255;3;0;9;27744 SGN:BND:NONCE=501756E2817E643A3E517CEC1D16461B471DB2E600BCD878B7AAAAAAAAAAAAAA
    0;255;3;0;9;27832 SGN:BND:HMAC=9DA69C9ABD8A32677FD13F37DA542D07030EA626B3337CC4D384EC44D70CEF20
    0;255;3;0;9;27840 SGN:VER:OK
    4;10;0;0;6;
    0;255;3;0;9;27843 TSF:MSG:READ,4-4-0,s=11,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;27849 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;27868 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;27875 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;27882 SGN:NCE:XMT,TO=0
    0;255;3;0;9;27983 TSF:MSG:READ,4-4-0,s=11,c=0,t=6,pt=0,l=0,sg=1:
    0;255;3;0;9;27990 SGN:BND:NONCE=ED83EED6A2E7E85EB1AEEE2DED74C058B89C3D6A43E2CC30C4AAAAAAAAAAAAAA
    0;255;3;0;9;28078 SGN:BND:HMAC=A2AC5D78A004DDB476DABACE267DCF06ACE0689D9443849974F0FC198FD2015D
    0;255;3;0;9;28086 SGN:VER:OK
    4;11;0;0;6;
    0;255;3;0;9;28089 TSF:MSG:READ,4-4-0,s=50,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;28095 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;28113 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;28121 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;28128 SGN:NCE:XMT,TO=0
    0;255;3;0;9;28229 TSF:MSG:READ,4-4-0,s=50,c=0,t=7,pt=0,l=0,sg=1:
    0;255;3;0;9;28235 SGN:BND:NONCE=C95888EBF76AB6923853908CC55D06D5BF9146B3933F65378FAAAAAAAAAAAAAA
    0;255;3;0;9;28323 SGN:BND:HMAC=AD23837E2FA717DC58F1CA64D37EBEB14B0887329D194389705DA32A6B0837B3
    0;255;3;0;9;28332 SGN:VER:OK
    4;50;0;0;7;
    0;255;3;0;9;28335 TSF:MSG:READ,4-4-0,s=60,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;28342 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;28359 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;28366 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;28374 SGN:NCE:XMT,TO=0
    0;255;3;0;9;28475 TSF:MSG:READ,4-4-0,s=60,c=0,t=6,pt=0,l=0,sg=1:
    0;255;3;0;9;28481 SGN:BND:NONCE=AD9D69D1BDEC7D1893E350501EB91FDFE177202A768C8EE1B9AAAAAAAAAAAAAA
    0;255;3;0;9;28569 SGN:BND:HMAC=77F996E81C6AFD34CDB4207AD79AC93B681DF93F3FD2C1A115F236D23556CF63
    0;255;3;0;9;28577 SGN:VER:OK
    4;60;0;0;6;
    0;255;3;0;9;28580 TSF:MSG:READ,4-4-0,s=40,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;28588 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;28606 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;28612 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    0;255;3;0;9;28619 SGN:NCE:XMT,TO=0
    0;255;3;0;9;28721 TSF:MSG:READ,4-4-0,s=40,c=0,t=1,pt=0,l=3,sg=1:PIR
    0;255;3;0;9;28727 SGN:BND:NONCE=5A51EDE317B07AB430EA6A605F5D16B1A1D5B459A17AAA8BDAAAAAAAAAAAAAAA
    0;255;3;0;9;28815 SGN:BND:HMAC=6C6F971EE3BA968ABE5EF2A6D1B44CA1C38BC8EA83D76A204BF4C8B232826A89
    0;255;3;0;9;28824 SGN:VER:OK
    0;255;3;0;9;28826 TSF:MSG:ACK REQ
    0;255;3;0;9;28829 SGN:SKP:ACK CMD=0,TYPE=1
    0;255;3;0;9;28835 TSF:MSG:SEND,0-0-4-4,s=40,c=0,t=1,pt=0,l=3,sg=0,ft=0,st=OK:PIR
    4;40;0;0;1;PIR
    0;255;3;0;9;28843 TSF:MSG:READ,4-4-0,s=255,c=3,t=26,pt=1,l=1,sg=1:2
    0;255;3;0;9;28850 SGN:SKP:MSG CMD=3,TYPE=26
    0;255;3;0;9;28854 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;28859 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
    0;255;3;0;9;28866 SGN:SGN:NCE REQ,TO=4
    0;255;3;0;9;28887 TSF:MSG:READ,4-4-0,s=255,c=3,t=17,pt=6,l=25,sg=0:<NONCE>
    0;255;3;0;9;28893 SGN:SKP:MSG CMD=3,TYPE=17
    0;255;3;0;9;28897 SGN:NCE:FROM=4
    0;255;3;0;9;28900 SGN:BND:NONCE=BA5601AC14E5860AD182906737D95484017AC13DBAFC9F8E32AAAAAAAAAAAAAA
    0;255;3;0;9;28988 SGN:BND:HMAC=7A6EA5CA7E3C880F77BAEEB6BCF45386AA5ACA908B709FC63E25E3C218CF07F1
    0;255;3;0;9;28996 SGN:SGN:SGN
    0;255;3;0;9;29002 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=27,pt=1,l=1,sg=1,ft=0,st=OK:1
    

  • Contest Winner

    @joaoabs I suspect the problem lies at the gateway side, not the node side. It is the gateway that hangs, right?
    A common cause for problems is low ram which reduce the amount of usable stack. Causing all sorts of strange issues when stack is exhausted.



  • Without the signing debug the memory in the GW is around 63%... and goes up to 69% when enabling it. Not sure if it would be that...
    I'll try with other arduino, it could be this one that has some defect. Its a cheap clone. Never had issues, but there is always a first time, right?

    And by the way, the gateway "hangs" but if I restart the node, the presentation process goes fine again without needing to restart the gateway, so not really an hang... It just stops responding!

    Thanks,
    Joaoabs


  • Contest Winner

    @joaoabs below 70% should be fine. But is it the gateway you refer to or the node? What type of processor is it? Atmega328p?



  • both of them are nanos with atmega328


  • Contest Winner

    @joaoabs ok. Well, it sure sounds strange. And there are no issues if you just disable signing? Perhaps a dodgy power supply that destabilize something when the radio needs to work a bit harder perhaps (just speculation). Signing does put strain on the radio in the sense that it needs to transmit full sized payloads.



  • With an arduino UNO (same processor type: mega 328p) as GW the behaviour is the same.

    This is just the arduino board connected to a laptop, via an USB3 port (should have enough power). I've also added a 47uF capacitor between 5v and GND, but the behaviour is the same. (the NRFs already have their own 4.7uF capacitor)

    Any idea/suggestuin?

    Thanks,


  • Contest Winner

    @joaoabs no, I am afraid I am out of options. Did you do a comparison with and without signing, just to rule out if signing is the cause of the radio seemingly failing at either end?
    The radio also have verbose debug flags. Perhaps someone with more knowledge about radio debugging could draw conclusions from those.


  • Contest Winner

    @joaoabs one thing I see is that you did not include the ram usage on the GW, just the flash usage. Is the ram usage within reasonable levels? (at least below 75%)



  • Hello,

    The GW sketch is the simplest possible. It is the SerialGateway.ino example just with the added flags for the signing.
    It seems to have enough resources

    Sketch uses 21440 bytes (66%) of program storage space. Maximum is 32256 bytes.
    Global variables use 1401 bytes (68%) of dynamic memory, leaving 647 bytes for local variables. Maximum is 2048 bytes.
    

    The node sketch is the Relay example sketch, where I then added, one by one, the code from other examples such as Door/Win/Button (tripwire), Temperature (DS18B20), Temp/Hum (DHT22) and Motion (HC-SR501).

    I have a pretty basic version control, so for each new sensor type I was adding I was just creating another file. Since all the signature process was done (and written in the eeprom), I went back to the basics (sketch with Relay + Door) with the signing flags enabled and could confirm it worked with signatures (so it must be something I added). I then went version-by-version, enabling the flags and confirmed it was still working as I was progressing.
    I've now reached a point where I just have the last sensor to add (Motion HC-SR501) but the available memory is concerning:

    Build options changed, rebuilding all
    Sketch uses 28030 bytes (91%) of program storage space. Maximum is 30720 bytes.
    Global variables use 1542 bytes (75%) of dynamic memory, leaving 506 bytes for local variables. Maximum is 2048 bytes.
    Low memory available, stability problems may occur.
    
    

    I'll leave as it is, (disabling the signing debug, the memory use drops to 71%). Just out of curiosity, I checked the memory use on the original node sketch (without signing debug) and it was 73%.

    Still not sure if it was an issue related with the memory or with the additional code I added for the Motion Sensor.
    However, the strange conclusion is that it was really on the node, and not on the gateway as we thought.

    I'll leave it on during the night in order to see if it hangs or something.

    Thanks for your help!
    Joaoabs


  • Contest Winner

    @joaoabs I am glad that you at least came to some form of conclusion. I suspect this is just another example of the sketch running out of ram for the stack. The symptoms can be really weird and unpredictable. Just a slight change on the execution path and something that worked fine just before simply explodes or, executed something completely different.

    We really are pushing it with signing on atmega328p, because the library also grows in size with time (new features come in).

    I'd say, and I will probably soon update the documentation with it, that signing/security does technically work on atmega328p, but due to the limited ram, it's usability is very limited to just basic sketches.

    Thanks for reporting this. It adds to the hive mind of knowledge and experience in troubleshooting 👍



  • Thanks,

    The node is still sending periodic updates after 8h uptime. I guess I can considered it as stable.

    By the way, I have a couple of ATSHA204A-STUCZ-T ordered. I think I can easily migrate to HW signing as soon as I get them.
    Will the HW signing unload the AT328p?

    Thanks


  • Contest Winner

    @joaoabs yes, but you need to redo personalization for it, but you have that under control so it should be easy for you.
    Yes, the atsha will put less strain on the atmega328p. Difficult to say how much and if it will resolve your issue but I'd say it's worth a try 🙂


  • Admin

    @joaoabs Could you post the full sketch where signing fails? I assume one of the external libraries may interfere with SPI communication. To confirm, please test this PR with the failing sketch and upload the full debug log here.

    https://github.com/mysensors/MySensors/pull/1116


  • Admin

    @joaoabs Any updates on the issue?



  • Hi,

    Sorry for the delayed answer, I was making sure I had a better testing enviroment:

    Controller/Gateway: RPI3 with OpenHab2 and NRF24L01+ connected directly to the pin header. The NRF has a 4.7uF capacitor soldered to it and is the simple + model (not PA+NLA)

    Node: Arduino mini pro 3v 8MHz, in a prototype board with:

    • Hi-Link power supply (220AC to 5V DC)
    • 2200uF capactior to stabilize 5V (and also a pico range one to filter high frequencies)
    • 3.3V regulator
    • 100uf capacitor to stabilize 3.3V (and also a pico range one to filter high frequencies)
    • NRF24L01+ feed from the 3.3V regulator and with an additional 4.7uF capacitor
    • Connections made by wire around the board
    • The board is supposed to:
      • Interact with a 4-relay module
      • Read the temperature of several DS18B20's (only used 1 in the testing)
      • Detect presence in 3 motion sensors
      • Read temperature/Humidity from a DHT22
    • The node is ~6m away of the GW/Controller with line of sight
    • The pins and skecth options are in its own comments.
    • The " && transportSanityCheck());" patch was applied
    • Signing is activated

    Code:

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/orlçyovzwqi71234567890ll
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 
     *
     * DESCRIPTION
     * Combined sketch with: 
     *      - NODE ID 44
     *      - Relay sketch, base sketch for all          - PIN 3,4,5,6  -   Child ID from 1,2,3,4
     *      - DOOR sketch (trip alarm), added code       - PIN A0,A1    -   Child ID 30,31
     *      - TEMP sketch (DS18B20), added code          - PIN 8        -   Child ID from 10 to 18  (defined 8 as MAX)
     *      - Hum sketch (DHT22), added code             - PIN A7       -   Child ID 50 (Temp) and 60 (Hum)
     *      - MOTION sketch, added code                  - PIN A6       -   Child ID 70
     *      
     *      
     * BOARD
     * 
     * D0 - RX (not used - but can be used with a plug on the programing header))
     * D1 - TX (not used - but can be used with a plug on the programing header))
     * D2 - NRF24 IRQ
     * D3 - RJ-45 (3)
     * D4 - 1-W (RJ-45 (4) & pin header)
     * D5 - Relay (5) (relay pin header has 6 pins where 6 is 5v and 1 is GND)
     * D6 - Relay (4)
     * D7 - Relay (3)
     * D8 - Relay (2)
     * D9 - NRF CE
     * D10- NRF CS
     * D11- NRF MOSI
     * D12- NRF MISO
     * D13- NRF SCK
     * A0 - RJ-45 (6)  (DOOR Sketch) 
     * A1 - RJ-45 (2)  (DOOR Sketch)
     * A2 - RJ-45 (1)
     * A3 - RJ-45 (4)
     * A4 - I2C
     * A5 - I2C
     * A6 - PIR (pin header)  (MOTION Sketch)
     * A7 - DHT (pin header)  
     * 
     *      
     *      
     *      
     *      
     * All sketches copied from http://www.mysensors.org
     *
     * signing "hidden" page: https://www.mysensors.org/apidocs-beta/group__MySigninggrpPub.html
     * 
     * 
     */
     
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Static node ID definition
    #define MY_NODE_ID 44
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    
    // Enable repeater functionality for this node
    //#define MY_REPEATER_FEATURE  
    
    //CODE FOR SIGNING************************************************
    //#define MY_SIGNING_WEAK_SECURITY 
    #define MY_SIGNING_SOFT
    #define MY_SIGNING_SOFT_RANDOMSEED_PIN A4
    #define MY_SIGNING_REQUEST_SIGNATURES  // will inform the gateway that I expect it to sign all messages to me
    //#define MY_DEBUG_VERBOSE_SIGNING
    
    #include <MySensors.h>
    
    //What features/Sketches to use?  ************************************************
    #define RELAY
    //#define DHTCODE
    #define DOOR
    #define MOTION
    //#define TEMP
    
    
    //CODE OF DOOR SKETCH************************************************
    #ifdef DOOR
    #include <Bounce2.h>
    #define CHILD_ID_A 30
    #define CHILD_ID_B 31
    #define BUTTON_PIN_A  A0  // Arduino Digital I/O pin for button/reed switch
    #define BUTTON_PIN_B  A1  // Arduino Digital I/O pin for button/reed switch
    
    Bounce debouncer_a = Bounce(); 
    Bounce debouncer_b = Bounce(); 
    int oldValue_a=-1;
    int oldValue_b=-1;
    // Change to V_LIGHT if you use S_LIGHT in presentation below
    MyMessage msg_door_a(CHILD_ID_A,V_TRIPPED);  
    MyMessage msg_door_b(CHILD_ID_B,V_TRIPPED);     
    #endif
    
    //CODE OF MOTION SKETCH************************************************
    #ifdef MOTION
    int oldMotion_a=-1;
    
    //uint32_t SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR_MOTION_A A6   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define CHILD_ID_MOTION_A 70   // Id of the sensor child
    
    // Initialize motion message
    MyMessage msg_motion_a(CHILD_ID_MOTION_A, V_TRIPPED);
    #endif
    
    
    //CODE OF TEMP SKETCH************************************************
    #ifdef TEMP
    #include <MySensors.h>  
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #define ONE_WIRE_BUS 4 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 10
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    bool receivedConfig = false;
    bool metric = true;
    // Initialize temperature message
    MyMessage msg_temp(0,V_TEMP);
    #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
    #endif
    
    //CODE FOR LOOP************************************************
    long x = 327670;
    int y = 32767;
    
      
    //CODE OF RELAY SKETCH************************************************
    #ifdef RELAY
    #define RELAY_PIN 5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 4 // Total number of attached relays
    #define RELAY_ON 1  // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
    #endif
    
    //CODE OF DHT SKETCH************************************************
    #ifdef DHTCODE
    //#include "DHT.h"
    #include <DHT.h>
    
    // Set this to the pin you connected the DHT's data pin to
    #define DHT_DATA_PIN A7
    
    // Set this offset if the sensor has a permanent small offset to the real temperatures
    #define SENSOR_TEMP_OFFSET 0
    
    // Sleep time between sensor updates (in milliseconds)
    // Must be >1000ms for DHT22 and >2000ms for DHT11
    static const uint64_t UPDATE_INTERVAL = 60000;
    
    // Force sending an update of the temperature after n sensor reads, so a controller showing the
    // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
    // the value didn't change since;
    // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
    static const uint8_t FORCE_UPDATE_N_READS = 10;
    
    #define CHILD_ID_HUM 50
    #define CHILD_ID_TEMP 60
    
    float lastTempdht;
    float lastHumdht;
    uint8_t nNoUpdatesTempdht;
    uint8_t nNoUpdatesHumdht;
    //bool metric = true;
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    DHT dht;
    #endif
    
    void before()
    {
     
     //CODE OF RELAY SKETCH************************************************
     #ifdef RELAY
     for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
            // Then set relay pins in output mode
            pinMode(pin, OUTPUT);
            // Set relay to last known state (using eeprom storage)
            digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
     }
     #endif
    //CODE OF TEMP SKETCH************************************************
     #ifdef TEMP
     sensors.begin();
     #endif
    }
    
    void setup()
    {
    //CODE OF DOOR SKETCH************************************************
    #ifdef DOOR
      // Setup the button A
      pinMode(BUTTON_PIN_A,INPUT);
      // Activate internal pull-up
      digitalWrite(BUTTON_PIN_A,HIGH);
    
      // After setting up the button, setup debouncer
      debouncer_a.attach(BUTTON_PIN_A);
      debouncer_a.interval(5);
    
      // Setup the button B
      pinMode(BUTTON_PIN_B,INPUT);
      // Activate internal pull-up
      digitalWrite(BUTTON_PIN_B,HIGH);
    
      // After setting up the button, setup debouncer
      debouncer_b.attach(BUTTON_PIN_B);
      debouncer_b.interval(5);
    #endif
    
    
    //CODE OF MOTION SKETCH************************************************
    #ifdef MOTION
      pinMode(DIGITAL_INPUT_SENSOR_MOTION_A, INPUT);      // sets the motion sensor digital pin as input
    #endif
      
    
    //CODE OF TEMP SKETCH************************************************
    #ifdef TEMP
      sensors.setWaitForConversion(false);
    #endif
    
    //CODE OF DHT SKETCH************************************************
    #ifdef DHTCODE
      dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor
      if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) {
        Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!");
      }
      // Sleep for the time of the minimum sampling period to give the sensor time to power up
      // (otherwise, timeout errors might occure for the first reading)
      sleep(dht.getMinimumSamplingPeriod());
     #endif
    }
    
    
    void presentation()
    {
    // Send the sketch version information to the gateway and Controller
       sendSketchInfo("MIXED JOAOABS SOTAO", "1.0");
       
    //CODE OF RELAY SKETCH************************************************
    //FOR RELAY: Child ID from 1 to 4
    #ifdef RELAY
       for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
            // Register all sensors to gw (they will be created as child devices)
            //  present(sensor, S_BINARY);
             present(sensor, S_BINARY, "RELAYS", true);  // forcing ack for this child's messages
        }
    #endif
    
    //CODE OF DOOR SKETCH************************************************
    //FOR DOOR: Child ID 30
    #ifdef DOOR
     // present(CHILD_ID_A, S_DOOR);  
     // present(CHILD_ID_B, S_DOOR);  
      present(CHILD_ID_A, S_DOOR, "DOOR_A", true);  // CHILD ID = 30 and forcing ack for this child's messages
      present(CHILD_ID_B, S_DOOR, "DOOR_B", true);  // CHILD ID = 31 and forcing ack for this child's messages
    #endif
    
    //CODE OF MOTION SKETCH************************************************
    #ifdef MOTION
    present(CHILD_ID_MOTION_A, S_MOTION, "PIR", true); // CHILD ID =  70 and forcing ack for this child's messages
    #endif
    
    //CODE OF TEMP SKETCH************************************************
    //FOR TEMP: Child ID from 10 to 18  (defined 8 as MAX)
    // Fetch the number of attached temperature sensors  
    #ifdef TEMP
      numSensors = sensors.getDeviceCount();
    
      // Present all sensors to controller
         int a;
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {  
         a=i+10;  
         present(a, S_TEMP);   
      }
    #endif
    
    //CODE OF DHT SKETCH************************************************
    #ifdef DHTCODE
    //FOR DHT: Child ID 50 and 60
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
      metric = getControllerConfig().isMetric;
    #endif
    }
    
    void loop()
    {
    //CODE OF DOOR SKETCH************************************************
    #ifdef DOOR
    //For DOOR A
    debouncer_a.update();
      // Get the update value
      int value_a = debouncer_a.read();
    
      if (value_a != oldValue_a) {
         // Send in the new value
         send(msg_door_a.set(value_a==HIGH ? 1 : 0));
         oldValue_a = value_a;
      }
    
    //For DOOR B
    debouncer_b.update();
      // Get the update value
      int value_b = debouncer_b.read();
    
      if (value_b != oldValue_b) {
         // Send in the new value
         send(msg_door_b.set(value_b==HIGH ? 1 : 0));
         oldValue_b = value_b;
      }
    #endif
    
    #ifdef MOTION
        // Read digital motion value
        int valueMotion_a = digitalRead(DIGITAL_INPUT_SENSOR_MOTION_A);
        if (valueMotion_a != oldMotion_a)
        {
         #ifdef MY_DEBUG
         Serial.println(valueMotion_a);
         #endif MY_DEBUG
         send(msg_motion_a.set(valueMotion_a?"1":"0"));  // Send tripped value to gw
         oldMotion_a = valueMotion_a;
        }
    
    #endif
    
    //Loop Code ************************************************
    //Resets every 1-2 minutes
      if (x>0)
      {
        x=x-1;
      }
      else
      {
        y=y-1;
        if (x==0 && y==0)
        {
         #ifdef MY_DEBUG
      Serial.println("****** counters reached 0 **************");
         #endif
         x = 1600000;
         y = 32767;
    
    //CODE OF TEMP SKETCH************************************************
    // So Let's fetch temperatures from Dallas sensors
    #ifdef TEMP
      sensors.requestTemperatures();
    
      // query conversion time and sleep until conversion completed
      int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      sleep(conversionTime);
    
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
    
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
     //   Serial.println("temperature:");
     //   Serial.println(temperature);
    
       // Only send data if temperature has changed and no error
        #if COMPARE_TEMP == 1
        if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
        #else
        if (temperature != -127.00 && temperature != 85.00) {
        #endif
         
         int a=i+10; 
          // Send in the new temperature
          send(msg_temp.setSensor(a).set(temperature,1));
          // Save new temperatures for next compare
          lastTemperature[i]=temperature;    
          
        }
       }    
       #endif
    
        #ifdef DHTCODE
        //CODE OF DHT SKETCH************************************************
        // Force reading sensor, so it works also after sleep()
        dht.readSensor(true);
        delay(2000);
        // Get temperature from DHT library
        float temperaturedht = dht.getTemperature();
        if (isnan(temperaturedht))
        {
         Serial.println("Failed reading temperature from DHT!");
        }
        else if (temperaturedht != lastTempdht || nNoUpdatesTempdht == FORCE_UPDATE_N_READS)
        {
         // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
         lastTempdht = temperaturedht;
         if (!metric)
         {
          temperaturedht = dht.toFahrenheit(temperaturedht);
         }
         // Reset no updates counter
         nNoUpdatesTempdht = 0;
         temperaturedht += SENSOR_TEMP_OFFSET;
         send(msgTemp.set(temperaturedht, 1));
         #ifdef MY_DEBUG
         Serial.print("T: ");
         Serial.println(temperaturedht);
         #endif
        } 
        else 
        {
         // Increase no update counter if the temperature stayed the same
         nNoUpdatesTempdht++;
        }
    
        // Get humidity from DHT library
        float humiditydht = dht.getHumidity();
        if (isnan(humiditydht))
        {
         Serial.println("Failed reading humidity from DHT");
        } 
       else if (humiditydht != lastHumdht || nNoUpdatesHumdht == FORCE_UPDATE_N_READS) {
       // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
       lastHumdht = humiditydht;
       // Reset no updates counter
       nNoUpdatesHumdht = 0;
       send(msgHum.set(humiditydht, 1));
    
       #ifdef MY_DEBUG
       Serial.print("H: ");
       Serial.println(humiditydht);
       #endif
       } 
       else
       {
        // Increase no update counter if the humidity stayed the same
        nNoUpdatesHumdht++;
       }
       #endif
      }
     }
    }
    
    
    void receive(const MyMessage &message)
    {
        //CODE OF RELAY SKETCH************************************************
        //THERE IS ONLY RECEIVE CODE for RELAY.  DOOR, TEMP and HUM are just sent periodically and not on-demand
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_STATUS) {
            // Change relay state
            digitalWrite(message.sensor-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF);
            // Store state in eeprom
            saveState(message.sensor, message.getBool());
            // Write some debug info
            Serial.print("Incoming change for sensor:");
            Serial.print(message.sensor);
            Serial.print(", New status: ");
            Serial.println(message.getBool());
        }
    }
    

    If we only choose the relay-related code, I can feel some reliability. Every command that is sent is executed.

    If I activate just the temperature code, I start having signature failures when trying to open/close relays. Not always, but often, so reliability is affected. Example of trying to change the relay 4 (44:4).

    May  3 18:31:32 nettemp mysgw: GWT:RFC:C=0,MSG=44;3;1;1;2;1
    May  3 18:31:32 nettemp mysgw: !TSF:MSG:SEND,0-0-44-44,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=NACK:
    May  3 18:31:32 nettemp mysgw: !TSF:MSG:SIGN FAIL
    May  3 18:31:32 nettemp mysgw: GWT:RFC:C=0,MSG=
    May  3 18:31:32 nettemp mysgw: GWT:RFC:C=0,MSG=44;3;1;1;2;1
    May  3 18:31:32 nettemp mysgw: !TSF:MSG:SEND,0-0-44-44,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=NACK:
    May  3 18:31:32 nettemp mysgw: !TSF:MSG:SIGN FAIL
    May  3 18:31:32 nettemp mysgw: GWT:RFC:C=0,MSG=
    May  3 18:31:32 nettemp mysgw: GWT:RFC:C=0,MSG=44;3;1;1;2;1
    May  3 18:31:32 nettemp mysgw: !TSF:MSG:SEND,0-0-44-44,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=NACK:
    May  3 18:31:32 nettemp mysgw: !TSF:MSG:SIGN FAIL
    May  3 18:31:32 nettemp mysgw: GWT:RFC:C=0,MSG=
    May  3 18:31:33 nettemp mysgw: GWT:RFC:C=0,MSG=44;3;1;1;2;1
    May  3 18:31:33 nettemp mysgw: !TSF:MSG:SEND,0-0-44-44,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=NACK:
    May  3 18:31:33 nettemp mysgw: !TSF:MSG:SIGN FAIL
    May  3 18:31:33 nettemp mysgw: GWT:RFC:C=0,MSG=
    May  3 18:31:34 nettemp mysgw: GWT:RFC:C=0,MSG=44;3;1;1;2;1
    May  3 18:31:34 nettemp mysgw: !TSF:MSG:SEND,0-0-44-44,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=NACK:
    May  3 18:31:34 nettemp mysgw: !TSF:MSG:SIGN FAIL
    May  3 18:31:34 nettemp mysgw: GWT:RFC:C=0,MSG=
    

    (nothing appears in the node log, as it haven't received anything).

     
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.2.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNAS--,VER=2.2.0
    25 MCO:BGN:BFR
    69 TSM:INIT
    70 TSF:WUR:MS=0
    77 TSM:INIT:TSP OK
    79 TSM:INIT:STATID=44
    81 TSF:SID:OK,ID=44
    82 TSM:FPAR
    102 TSF:MSG:SEND,44-44-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    159 TSF:MSG:READ,0-0-44,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    164 TSF:MSG:FPAR OK,ID=0,D=1
    2109 TSM:FPAR:OK
    2110 TSM:ID
    2111 TSM:ID:OK
    2113 TSM:UPL
    2115 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2122 TSF:MSG:READ,0-0-44,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2127 TSF:MSG:PONG RECV,HP=1
    2129 TSM:UPL:OK
    2131 TSM:READY:ID=44,PAR=0,DIS=1
    2136 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    2142 TSF:MSG:READ,0-0-44,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    2152 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
    2158 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=0:<NONCE>
    2246 TSF:MSG:SEND,44-44-0-0,s=255,c=0,t=17,pt=0,l=5,sg=1,ft=0,st=OK:2.2.0
    2255 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2262 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    2352 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=6,pt=1,l=1,sg=1,ft=0,st=OK:0
    2360 TSF:MSG:READ,0-0-44,s=255,c=3,t=16,pt=0,l=0,sg=1:
    2382 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    2397 TSF:MSG:READ,0-0-44,s=255,c=3,t=6,pt=0,l=1,sg=1:M
    2485 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2491 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    2581 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=11,pt=0,l=19,sg=1,ft=0,st=OK:MIXED JOAOABS SOTAO
    2591 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2598 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    2685 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=12,pt=0,l=3,sg=1,ft=0,st=OK:1.0
    2694 TSF:MSG:SEND,44-44-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2701 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    2791 TSF:MSG:SEND,44-44-0-0,s=1,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    2801 TSF:MSG:SEND,44-44-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2807 TSF:MSG:READ,0-0-44,s=1,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    2812 TSF:MSG:ACK
    2814 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    2904 TSF:MSG:SEND,44-44-0-0,s=2,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    2914 TSF:MSG:SEND,44-44-0-0,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2920 TSF:MSG:READ,0-0-44,s=2,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    2926 TSF:MSG:ACK
    2927 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    3015 TSF:MSG:SEND,44-44-0-0,s=3,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    3024 TSF:MSG:SEND,44-44-0-0,s=4,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    3031 TSF:MSG:READ,0-0-44,s=3,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    3036 TSF:MSG:ACK
    3038 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    3125 TSF:MSG:SEND,44-44-0-0,s=4,c=0,t=3,pt=0,l=6,sg=1,ft=0,st=OK:RELAYS
    3134 TSF:MSG:SEND,44-44-0-0,s=30,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    3140 TSF:MSG:READ,0-0-44,s=4,c=0,t=3,pt=0,l=6,sg=0:RELAYS
    3145 TSF:MSG:ACK
    3147 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    3234 TSF:MSG:SEND,44-44-0-0,s=30,c=0,t=0,pt=0,l=6,sg=1,ft=0,st=OK:DOOR_A
    3244 TSF:MSG:SEND,44-44-0-0,s=31,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    3250 TSF:MSG:READ,0-0-44,s=30,c=0,t=0,pt=0,l=6,sg=0:DOOR_A
    3256 TSF:MSG:ACK
    3257 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    3344 TSF:MSG:SEND,44-44-0-0,s=31,c=0,t=0,pt=0,l=6,sg=1,ft=0,st=OK:DOOR_B
    3353 TSF:MSG:SEND,44-44-0-0,s=70,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    3360 TSF:MSG:READ,0-0-44,s=31,c=0,t=0,pt=0,l=6,sg=0:DOOR_B
    3365 TSF:MSG:ACK
    3367 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    3460 TSF:MSG:SEND,44-44-0-0,s=70,c=0,t=1,pt=0,l=3,sg=1,ft=0,st=OK:PIR
    3467 MCO:REG:REQ
    3470 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=0,st=OK:2
    3476 TSF:MSG:READ,0-0-44,s=70,c=0,t=1,pt=0,l=3,sg=0:PIR
    3481 TSF:MSG:ACK
    3483 TSF:MSG:READ,0-0-44,s=255,c=3,t=16,pt=0,l=0,sg=1:
    3510 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    3524 TSF:MSG:READ,0-0-44,s=255,c=3,t=27,pt=1,l=1,sg=1:1
    3609 MCO:PIM:NODE REG=1
    3611 MCO:BGN:STP
    3613 MCO:BGN:INIT OK,TSP=1
    3619 TSF:MSG:SEND,44-44-0-0,s=30,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    3627 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    3714 TSF:MSG:SEND,44-44-0-0,s=30,c=1,t=16,pt=2,l=2,sg=1,ft=0,st=OK:1
    3722 TSF:MSG:SEND,44-44-0-0,s=31,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    3734 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    3822 TSF:MSG:SEND,44-44-0-0,s=31,c=1,t=16,pt=2,l=2,sg=1,ft=0,st=OK:1
    0
    3832 TSF:MSG:SEND,44-44-0-0,s=70,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    3844 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    3932 TSF:MSG:SEND,44-44-0-0,s=70,c=1,t=16,pt=0,l=1,sg=1,ft=0,st=OK:0
    26080 TSF:MSG:READ,0-0-44,s=1,c=3,t=16,pt=0,l=0,sg=1:
    26106 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    26120 TSF:MSG:READ,0-0-44,s=1,c=1,t=2,pt=0,l=1,sg=1:0
    26205 TSF:MSG:ACK REQ
    26209 TSF:MSG:SEND,44-44-0-0,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
    Incoming change for sensor:1, New status: 0
    26216 TSF:MSG:READ,0-0-44,s=1,c=3,t=16,pt=0,l=0,sg=1:
    26240 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    26250 TSF:MSG:READ,0-0-44,s=1,c=1,t=2,pt=0,l=1,sg=1:0
    26334 TSF:MSG:ACK REQ
    26339 TSF:MSG:SEND,44-44-0-0,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
    Incoming change for sensor:1, New status: 0
    29867 TSF:MSG:READ,0-0-44,s=2,c=3,t=16,pt=0,l=0,sg=1:
    29888 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    29902 TSF:MSG:READ,0-0-44,s=2,c=1,t=2,pt=0,l=1,sg=1:0
    29986 TSF:MSG:ACK REQ
    29991 TSF:MSG:SEND,44-44-0-0,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
    Incoming change for sensor:2, New status: 0
    29999 TSF:MSG:READ,0-0-44,s=2,c=3,t=16,pt=0,l=0,sg=1:
    30022 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    30031 TSF:MSG:READ,0-0-44,s=2,c=1,t=2,pt=0,l=1,sg=1:0
    30116 TSF:MSG:ACK REQ
    30120 TSF:MSG:SEND,44-44-0-0,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
    Incoming change for sensor:2, New status: 0
    31344 TSF:MSG:READ,0-0-44,s=3,c=3,t=16,pt=0,l=0,sg=1:
    31366 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    31373 TSF:MSG:READ,0-0-44,s=3,c=1,t=2,pt=0,l=1,sg=1:0
    31457 TSF:MSG:ACK REQ
    31464 TSF:MSG:SEND,44-44-0-0,s=3,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
    Incoming change for sensor:3, New status: 0
    31471 TSF:MSG:READ,0-0-44,s=3,c=3,t=16,pt=0,l=0,sg=1:
    31498 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    31510 TSF:MSG:READ,0-0-44,s=3,c=1,t=2,pt=0,l=1,sg=1:0
    31594 TSF:MSG:ACK REQ
    31597 TSF:MSG:SEND,44-44-0-0,s=3,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
    Incoming change for sensor:3, New status: 0
    32621 TSF:MSG:READ,0-0-44,s=4,c=3,t=16,pt=0,l=0,sg=1:
    32643 TSF:MSG:SEND,44-44-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
    32657 TSF:MSG:READ,0-0-44,s=4,c=1,t=2,pt=0,l=1,sg=1:0
    Incoming change for sensor:4, New status: 0
    32752 TSF:MSG:SEND,44-44-0-0,s=31,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    32758 TSF:MSG:READ,0-0-44,s=255,c=3,t=17,pt=6,l=25,sg=1:<NONCE>
    32845 TSF:MSG:SEND,44-44-0-0,s=31,c=1,t=16,pt=2,l=2,sg=1,ft=0,st=OK:0
    ****** counters reached 0 **************
    33015 MCO:SLP:MS=94,SMS=0,I1=255,M1=255,I2=255,M2=255
    33020 TSF:TDI:TSL
    33022 MCO:SLP:WUP=-1
    33025 TSF:TRI:TSB
    ****** counters reached 0 **************
    160429 MCO:SLP:MS=94,SMS=0,I1=255,M1=255,I2=255,M2=255
    160434 TSF:TDI:TSL
    160436 MCO:SLP:WUP=-1
    160438 TSF:TRI:TSB
    

    I'll keep doing some more tests and will report it here. Meanwhile if there is anything else you'd like me to try, do let me know.

    Thanks,
    Joaoabs


  • Contest Winner

    @joaoabs the failures you see are not signing failures. It is NACKs. Messages are not reaching its destination, and when that happens signing won't work. So you also get errors relating to signing as a consequence.
    It is the rf link that is unstable in your latest log.



  • Thanks Anticimex for replying back,

    I understand now the root cause is not related with the signing itself. It makes sense.
    I may have wrongly associated to it becasue I read somewhere that the radio communication can be affected by signing because the packets are full and therefore the probability to have a missed bit in the between is bigger.

    However, the RF link is the same in test 1 and test 2 (~6m with line of sight), and the result is totally different... It must be something on the code, not in the RF link, don't you think?

    Thanks,
    Joaoabs


  • Contest Winner

    @joaoabs well, I agree that it should not affect the airborne part of it, but one way or another it prevents the messages from coming through. Perhaps your sensor communication induce some disturbance in the radio supply?



  • Hi,

    Some more testing:
    I realised I was doing a rookie mistake: When testing, I changed PC and the default options to compile the mini-pro were 16MHz/5V on the new PC, while mine is 8MHz/3.3v.
    I guess this difference in the clock was messing up the timmings on the 1-W bus, hence the eractic behaviour.
    Now the sketch with the door/motion, relay and temp(DS18B20) seems to be more stable. Adding the DHT code, we get back to erratic behaviour, as the initial post, althought the used memory without "MY_DEBUG" is 70% used.

    I'll be doing more tests and report back.

    Thanks,


  • Contest Winner

    @joaoabs thanks for reporting. Is this with or without @tekka's patch?


  • Admin

    @joaoabs Please post then full debug log when you observe the erratic behaviour (previously mentioned patch must be applied).



  • @tekka What debug flag should I activate for this?

    When I see the erratic behavior there isn't nothing appearing in the serial console, even with the MY_DEBUG on, so I guess there should be other that is of your interest...

    Thanks


Log in to reply
 

Suggested Topics

  • 3
  • 10
  • 2
  • 2
  • 4
  • 1

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts