smartSleep with 2.3.0, missing messages



  • Hi.
    I went from 2.1.1 to 2.3.0 hoping I would get a more stable network.
    When i did this I tried some OTA and went from sleep to smartSleep in some sketches.
    My problem. it's a binary sensor node reading a blinking LED.
    But if the LED blink too fast the node won't send the state change.
    I only get:

    718	2018-10-05 21:59:52	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_POST_SLEEP_NOTIFICATION	0
    719	2018-10-05 21:59:52	RX	5 - Pannrum	1 - S_DOOR	C_SET	NO	V_TRIPPED	0
    720	2018-10-05 21:59:52	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_BATTERY_LEVEL	100
    721	2018-10-05 21:59:52	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_PRE_SLEEP_NOTIFICATION	50
    722	2018-10-05 21:59:53	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_POST_SLEEP_NOTIFICATION	0
    723	2018-10-05 21:59:53	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_BATTERY_LEVEL	100
    724	2018-10-05 21:59:53	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_PRE_SLEEP_NOTIFICATION	50
    725	2018-10-05 21:59:54	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_POST_SLEEP_NOTIFICATION	0
    726	2018-10-05 21:59:54	RX	5 - Pannrum	1 - S_DOOR	C_SET	NO	V_TRIPPED	1
    727	2018-10-05 21:59:54	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_BATTERY_LEVEL	100
    728	2018-10-05 21:59:54	RX	5 - Pannrum	INTERNAL	C_INTERNAL	NO	I_PRE_SLEEP_NOTIFICATION	50
    

    This is from MYSController, what the gateway see.
    As you see sometimes i Only get the presleep, postsleep and battery, not the C_SET/ Value.

    Some from serial monitor but not the exact same time as the log above.

    51511 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=2,st=OK:
    53624 !TSM:FPAR:NO REPLY
    53641 TSM:FPAR
    53706 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    55246 TSF:MSG:READ,4-4-5,s=255,c=3,t=8,pt=1,l=1,sg=0:1
    55312 TSF:MSG:FPAR OK,ID=4,D=2
    55803 TSM:FPAR:OK
    55820 TSM:ID
    55836 TSM:ID:OK
    55853 TSM:UPL
    55902 TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    56213 !TSF:SND:TNR
    56229 !TSF:SND:TNR
    57999 TSM:UPL
    58032 TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    60129 TSM:UPL
    60178 !TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
    61276 !TSF:SND:TNR
    62275 TSM:UPL
    62308 TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=OK:1
    64405 !TSM:UPL:FAIL
    64421 TSM:FPAR
    64471 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    64667 TSF:MSG:READ,4-4-5,s=255,c=3,t=8,pt=1,l=1,sg=0:1
    64733 TSF:MSG:FPAR OK,ID=4,D=2
    66322 !TSF:SND:TNR
    66584 TSM:FPAR:OK
    66600 TSM:ID
    66617 TSM:ID:OK
    66633 TSM:UPL
    66682 TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    68763 TSM:UPL
    68780 TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    70877 TSM:UPL
    70893 TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    70975 TSF:MSG:READ,0-4-5,s=255,c=3,t=25,pt=1,l=1,sg=0:2
    71041 TSF:MSG:PONG RECV,HP=2
    71073 TSM:UPL:OK
    71106 TSM:READY:ID=5,PAR=4,DIS=2
    71368 TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
    71450 MCO:SLP:MS=0,SMS=1,I1=0,M1=1,I2=1,M2=1
    71516 TSF:MSG:SEND,5-5-4-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=0,st=OK:100
    71712 TSF:TDI:TSL
    

    The 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.
    
     *******************************
    
       DESCRIPTION
    
       Interrupt driven binary switch example with dual interrupts
       Author: Patrick 'Anticimex' Fallberg
       Connect one button or door/window reed switch between
       digitial I/O pin 3 (BUTTON_PIN below) and GND and the other
       one in similar fashion on digital I/O pin 2.
       This example is designed to fit Arduino Nano/Pro Mini
    
    */
    
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    #define MY_BAUD_RATE 9600
    #define MY_SMART_SLEEP_WAIT_DURATION_MS 100
    
    #define MY_NODE_ID 5
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    #define MY_RF24_PA_LEVEL RF24_PA_MAX
    
    #include <SPI.h>
    #include <MySensors.h>
    #include <Vcc.h>
    
    #define SKETCH_NAME "Pannrum"
    #define SKETCH_MAJOR_VER "1"
    #define SKETCH_MINOR_VER "0"
    
    #define PRIMARY_CHILD_ID 1
    #define SECONDARY_CHILD_ID 2
    
    #define PRIMARY_INPUT_PIN 2   // Arduino Digital I/O pin for button/reed switch
    #define SECONDARY_INPUT_PIN 3
    
    const float VccMin   = 1.9;           // Minimum expected Vcc level, in Volts. (NRF can only go to 1.9V)
    const float VccMax   = 3.3;           // Maximum expected Vcc level, in Volts.
    const float VccCorrection = 1.0 / 1.0; // Measured Vcc by multimeter divided by reported Vcc
    
    Vcc vcc(VccCorrection);
    
    // Change to V_LIGHT if you use S_LIGHT in presentation below
    MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED);
    MyMessage msg2(SECONDARY_CHILD_ID, V_TRIPPED);
    
    void setup()
    {
    
      // Setup the buttons
      pinMode(PRIMARY_INPUT_PIN, INPUT);
      pinMode(SECONDARY_INPUT_PIN, INPUT);
    
      // Activate internal pull-ups
      //  digitalWrite(INPUT1_PIN, HIGH);
    
    }
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER);
    
      // Register binary input sensor to sensor_node (they will be created as child devices)
      // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage.
      // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
      present(PRIMARY_CHILD_ID, S_DOOR);
      present(SECONDARY_CHILD_ID, S_DOOR);
    }
    
    // Loop will iterate on changes on the BUTTON_PINs
    void loop()
    {
      uint8_t value;
      static uint8_t sentValue = 2;
      static uint8_t sentValue2 = 2;
    
      // Short delay to allow buttons to properly settle
      wait(5);
    
      value = digitalRead(PRIMARY_INPUT_PIN);
    
      if (value != sentValue) {
        // Value has changed from last transmission, send the updated value
        send(msg.set(value == HIGH));
        sentValue = value;
      }
    
      value = digitalRead(SECONDARY_INPUT_PIN);
    
      if (value != sentValue2) {
        // Value has changed from last transmission, send the updated value
        send(msg2.set(value == HIGH));
        sentValue2 = value;
      }
    
    
      float  p = vcc.Read_Perc(VccMin, VccMax);
      sendBatteryLevel((uint8_t)p);
    
    
    // Sleep until something happens with the sensor
    if (isTransportReady()) {
      smartSleep(PRIMARY_INPUT_PIN-2, CHANGE, SECONDARY_INPUT_PIN-2, CHANGE, 0); // transport is OK, node can sleep
    }
    else {
      wait(5000); // transport is not operational, allow the transport layer to fix this
    }
    
    
    } 
    

    I tried This, just replacing all three files in the RF24 folder. Loading this to the sensor but it didn't help.


 

414
Online

7.9k
Users

8.7k
Topics

93.7k
Posts