[Solved] Node not resetting itself



  • I am using the RF69W radio and the latest development branch of MySensors. My problem is that the node doesn't reset itself if the connection between node and gateway failed for some reason.

    Here is the debug

    2490
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:2490
    1
    4041
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:4041
    1
    5728
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:5728
    1
    2615
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=NACK:2615
    0
    5408
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=1,st=NACK:5408
    0
    186
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=2,st=NACK:186
    0
    1681
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=3,st=NACK:1681
    0
    1805
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=4,st=NACK:1805
    0
    2490
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=5,st=NACK:2490
    0
    !TSM:READY:UPL FAIL,SNP
    TSM:FPAR
    TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=6,st=bc:
    754
    !TSF:SEND:TNR
    0
    186
    !TSF:SEND:TNR
    0
    4296
    !TSF:SEND:TNR
    0
    559
    !TSF:SEND:TNR
    0
    3549
    !TSF:SEND:TNR
    0
    3730
    !TSF:SEND:TNR
    0
    2051
    !TSF:SEND:TNR
    0
    
    

  • Admin

    @kenci Please post your sketch and the full debug log over an extended time period after the connection is lost.



  • @tekka

    MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.0.1-beta
    TSM:INIT
    TSM:INIT:TSP OK
    TSM:INIT:STATID,ID=254
    TSF:ASID:OK,ID=254
    TSM:FPAR
    TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSF:MSG:READ,0-0-254,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSF:MSG:FPAR RES,ID=0,D=0
    TSF:MSG:FPAR OK,ID=0,D=1
    TSM:FPAR:OK
    TSM:ID
    TSM:ID:OK,ID=254
    TSM:UPL
    TSF:PING:SEND,TO=0
    TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    TSF:MSG:READ,0-0-254,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSF:MSG:PONG RECV,HP=1
    TSF:CHKUPL:OK
    TSM:UPL:OK
    TSM:READY
    TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    !TSF:MSG:SEND,254-254-0-0,s=255,c=0,t=17,pt=0,l=10,sg=0,ft=0,st=NACK:2.0.1-beta
    TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=OK:0
    TSF:MSG:READ,0-0-254,s=255,c=3,t=6,pt=0,l=1,sg=0:0
    TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=OK:Light Sensor
    TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    !TSF:MSG:SEND,254-254-0-0,s=0,c=0,t=16,pt=0,l=0,sg=0,ft=0,st=NACK:
    MCO:REG:REQ
    !TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=NACK:2
    TSF:MSG:READ,0-0-254,s=255,c=3,t=0,pt=0,l=1,sg=0:0
    TSF:MSG:READ,0-0-254,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    MCO:PIM:NODE REG=1
    MCO:BGN:INIT OK,ID=254,PAR=0,DIS=1,REG=1
    446
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=2,st=OK:446
    1
    3046
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:3046
    1
    4524
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:4524
    1
    3617
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:3617
    1
    1859
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:1859
    1
    4476
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:4476
    1
    2735
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:2735
    1
    4856
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=NACK:4856
    0
    1434
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=1,st=NACK:1434
    0
    561
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=2,st=NACK:561
    0
    2498
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=3,st=OK:2498
    1
    4060
    TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:4060
    1
    5746
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=NACK:5746
    0
    2627
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=1,st=NACK:2627
    0
    5442
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=2,st=NACK:5442
    0
    187
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=3,st=NACK:187
    0
    1694
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=4,st=NACK:1694
    0
    1819
    !TSF:MSG:SEND,254-254-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=5,st=NACK:1819
    0
    !TSM:READY:UPL FAIL,SNP
    TSM:FPAR
    TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=6,st=bc:
    2537
    !TSF:SEND:TNR
    0
    754
    !TSF:SEND:TNR
    0
    188
    !TSF:SEND:TNR
    0
    4336
    !TSF:SEND:TNR
    0
    566
    !TSF:SEND:TNR
    0
    3588
    !TSF:SEND:TNR
    0
    3777
    !TSF:SEND:TNR
    0
    2077
    !TSF:SEND:TNR
    0
    6232
    !TSF:SEND:TNR
    0
    
    

    !TSF:SEND:TNR repeating itself for hours

    Sketch:

    /**
     * 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/or
     * 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 - Henrik EKblad
     * 
     * DESCRIPTION
     * Example sketch showing how to measue light level using a LM393 photo-resistor 
     * http://www.mysensors.org/build/light
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_DEBUG
    #define MY_NODE_ID 254
    #define MY_BAUD_RATE 57600
    
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RF69_868MHZ
    #define MY_RFM69_NETWORKID 100 // 0-127
    
    #include <SPI.h>
    #include <MySensors.h>  
    
    #define CHILD_ID_LIGHT 0
    #define LIGHT_SENSOR_ANALOG_PIN 0
    
    unsigned long SLEEP_TIME = 5000; // Sleep time between reads (in milliseconds)
    
    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    int lastLightLevel;
    
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Light Sensor", "1.0");
    
      // Register all sensors to gateway (they will be created as child devices)
      present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    }
    
    void loop()      
    {     
      int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23*random(0,100); 
      Serial.println(lightLevel);
      bool test =     send(msg.set(lightLevel));
      Serial.println(test);
      sleep(SLEEP_TIME);
    }
    

    RFM69 connected to Arduino Pro mini 3v3 8Mhz as described on Mysensors Homepage


  • Admin

    @kenci If you substitute sleep() to wait() it will re-initialize.

    Please find here an alternative approach:

    https://forum.mysensors.org/topic/4394/node-not-reconnecting/7



  • @tekka Is that a problem if i am using battery powered sensors?


  • Admin

    @kenci see the alternative solution mentioned above.



  • @tekka i just read that you have implemented that in the library and need to push a PR? Is this feature in the latest dev branch?


  • Admin

    @kenci Not yet :smile:


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.