Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. RFM69 new driver delay

RFM69 new driver delay

Scheduled Pinned Locked Moved Troubleshooting
67 Posts 10 Posters 7.9k Views 8 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M mickecarlsson

    Just a hunch, add 4 mm to it so that it is 86 mm instead..
    And the power supply for the RPi must be able to provide at leat 1.5 A at 5Volt. Dont go for a cheap powersupply, it wont cope with the power drain from the ROi.

    pepsonP Offline
    pepsonP Offline
    pepson
    wrote on last edited by
    #34

    @mickecarlsson

    Hi
    my bug lenght antenna is 86mm. Sorry.
    Power for RPI is very good and original raspberry manufacturer provide about 2,5A

    After my tests only on MySensors 2.2.0 on Gateway and on Nodes 2.2.0 with NEW_DRIVER all works ok.

    In other like gateway 2.3.0 and node 2.2.0 or 2.3.0 with NEW_DRIVER or without NEW_DRIVER not working correct.

    pepsonP 1 Reply Last reply
    0
    • K Offline
      K Offline
      kimot
      wrote on last edited by
      #35
      This post is deleted!
      1 Reply Last reply
      0
      • pepsonP pepson

        @mickecarlsson

        Hi
        my bug lenght antenna is 86mm. Sorry.
        Power for RPI is very good and original raspberry manufacturer provide about 2,5A

        After my tests only on MySensors 2.2.0 on Gateway and on Nodes 2.2.0 with NEW_DRIVER all works ok.

        In other like gateway 2.3.0 and node 2.2.0 or 2.3.0 with NEW_DRIVER or without NEW_DRIVER not working correct.

        pepsonP Offline
        pepsonP Offline
        pepson
        wrote on last edited by
        #36

        @kimot

        I dont must use NEW_DRIVER, but when i write sketch to my node without option NEW_DRIVER, it no working. I tested some combination...mix. Gateway 2.3.0 or 2.2.0 with node 2.2.0 and 2.3.0 and Only with NEW_DRIVER works ok and only on 2.2.0 on node and gateway.

        This is my sketch.

        // Enable debug prints to serial monitor
        #define MY_DEBUG
        
        // Enable and select radio type attached
        #define MY_RADIO_RFM69
        #define MY_IS_RFM69HW
        //#define MY_RFM69_FREQUENCY RFM69_868MHZ
        #define RFM69_868MH
        #define MY_RFM69_NEW_DRIVER
        
        #define MY_REPEATER_FEATURE
        
        //#define MY_RFM69_CSMA_LIMIT_DBM (-85)
        
        // uncomment if we want to manually assign an ID
        #define MY_NODE_ID 1
        
        #include <Bounce2.h>
        #include <MySensors.h>
        #include <SPI.h>
        
        #define BUTTON_UP_PIN 3  // Arduino Digital I/O pin number for up button
        #define BUTTON_DOWN_PIN 4  // Arduino Digital I/O pin number for down button
        //#define BUTTON_STOP_PIN 5  // Arduino Digital I/O pin number for stop button
        //#define RELAY_DIR_PIN 6  // Arduino Digital I/O pin number for direction relay
        //#define RELAY_POWER_PIN 7  // Arduino Digital I/O pin number for power relay
        #define RELAY_UP_PIN 5 
        #define RELAY_DOWN_PIN 6
        #define RELAY_ON 0
        #define RELAY_OFF 1
        //#define RELAY_DOWN 1
        //#define RELAY_UP 0
        #define DIRECTION_DOWN 0
        #define DIRECTION_UP 1
        #define SKETCH_NAME "Roleta w sypialni"
        #define SKETCH_VER "2.2"
        #define CHILD_ID_COVER 0   // sensor Id of the sensor child
        #define STATE_UP 100 // 100 is open - up
        #define STATE_DOWN 0 // 0 is closed - down
        //#define CHILD_ID_CALIBRATE 1   // sensor Id of the sensor child to calibrate
        #define CHILD_ID_SET 1   // sensor Id of the sensor child to init the roll time
        #define PRESENT_MESSAGE "Rolety dla Home Assistant"
        const int LEVELS = 100; //the number of levels
        float rollTime = 20.0; //the overall rolling time of the shutter
        const bool IS_ACK = false; //is to acknowlage
        static bool initial_state_sent = false;//for hass we need at list one state send at begining
        
        // debouncing parameters
        int value = 0;
        int oldValueUp = 0;
        int oldValueDown = 0;
        int oldValueStop = 0;
        //static unsigned long last_interrupt_time_up = 0;
        //static unsigned long last_interrupt_time_down = 0;
        //static unsigned long debounce_time = 200;
        
        Bounce debouncerUp = Bounce();
        Bounce debouncerDown = Bounce();
        Bounce debouncerStop = Bounce();
        
        // shutter position parameters
        float timeOneLevel = rollTime / LEVELS;
        int requestedShutterLevel = 0;
        int currentShutterLevel = 0;
        unsigned long lastLevelTime = 0;
        bool isMoving = false;
        int directionUpDown;
        bool calibrateDown;
        bool calibrateUp;
        unsigned long calibrationStartTime;
        float calibrationTime = 5.0;
        bool calibratedDown;
        bool calibratedUp;
        
        enum CoverState {
          STOP,
          UP, // Window covering. Up.
          DOWN, // Window covering. Down.
        };
        
        static int coverState = STOP;
        
        MyMessage msgUp(CHILD_ID_COVER, V_UP);
        MyMessage msgDown(CHILD_ID_COVER, V_DOWN);
        MyMessage msgStop(CHILD_ID_COVER, V_STOP);
        MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE);
        //MyMessage msgCode(CHILD_ID_SET, V_IR_SEND);
        
        void sendState() {
          // Send current state and status to gateway.
        //  send(msgUp.set(coverState == UP));
        //  send(msgDown.set(coverState == DOWN));
        //  send(msgStop.set(coverState == STOP));
          send(msgPercentage.set(currentShutterLevel));
        }
        
        void shuttersUp(void) {
          #ifdef MY_DEBUG
          Serial.println("Shutters going up");
          #endif
          if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) {
            digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
            wait(50);
          }
          digitalWrite(RELAY_UP_PIN, RELAY_ON);
        
          directionUpDown = DIRECTION_UP;
          isMoving = true;
          coverState = UP;
          sendState();
        }
        
        void shuttersDown(void) {
          #ifdef MY_DEBUG
          Serial.println("Shutters going down");
          #endif
          if (digitalRead(RELAY_UP_PIN) == RELAY_ON) {
            digitalWrite(RELAY_UP_PIN, RELAY_OFF);
            wait(50);
          }
          digitalWrite(RELAY_DOWN_PIN, RELAY_ON);
        
          directionUpDown = DIRECTION_DOWN;
          isMoving = true;
          coverState = DOWN;
          sendState();
        }
        
        void shuttersHalt(void) {
        #ifdef MY_DEBUG
          Serial.println("Shutters halted");
        #endif
          digitalWrite(RELAY_UP_PIN, RELAY_OFF);
          digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
        
          isMoving = false;
          requestedShutterLevel = currentShutterLevel;
        #ifdef MY_DEBUG
          Serial.println("saving state to: ");
          Serial.println(String(currentShutterLevel));
        #endif
          saveState(CHILD_ID_COVER, currentShutterLevel);
          coverState = STOP;
          sendState();
        }
        
        void changeShuttersLevel(int level) {
          int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN;
          if (isMoving && dir != directionUpDown) {
            shuttersHalt();
          }
          requestedShutterLevel = level;
        }
        
        void initShutters() {
        #ifdef MY_DEBUG
          Serial.println("Init Cover");
        #endif
          shuttersUp();
          wait((rollTime + timeOneLevel * LEVELS) * 1000);
          currentShutterLevel = STATE_UP;
          requestedShutterLevel = currentShutterLevel;
        }
        
        void receive(const MyMessage &message) {
        #ifdef MY_DEBUG
          Serial.println("recieved incomming message");
          Serial.println("Recieved message for sensor: ");
          Serial.println(String(message.sensor));
          Serial.println("Recieved message with type: ");
          Serial.println(String(message.type));
        #endif
          if (message.sensor == CHILD_ID_COVER) {
            switch (message.type) {
              case V_UP:
                //Serial.println(", New status: V_UP");
                changeShuttersLevel(STATE_UP);
                //state = UP;
                //sendState();
                break;
        
              case V_DOWN:
                //Serial.println(", New status: V_DOWN");
                changeShuttersLevel(STATE_DOWN);
                //state = DOWN;
                //sendState();
                break;
        
              case V_STOP:
                //Serial.println(", New status: V_STOP");
                shuttersHalt();
                //state = IDLE;
                //sendState();
                break;
        
              case V_PERCENTAGE:
                //Serial.println(", New status: V_PERCENTAGE");
                //          if (!initial_state_sent) {
                //            #ifdef MY_DEBUG
                //            Serial.println("Receiving initial value from controller");
                //            #endif
                //            initial_state_sent = true;
                //          }
                int per = message.getInt();
                if (per > STATE_UP) {
                  per = STATE_UP;
                }
                changeShuttersLevel(per);
                //InitShutters(message.getInt());//send value < 0 or > 100 to calibrate
                //sendState();
                break;
            }
          } 
        else if (message.sensor ==  CHILD_ID_SET) {
        
            if (message.type == V_VAR1) {
              #ifdef MY_DEBUG
              Serial.println(", New status: V_VAR1, with payload: ");
              #endif      
              String strRollTime = message.getString();
              rollTime = strRollTime.toFloat();
              #ifdef MY_DEBUG
              Serial.println("rolltime value: ");
              Serial.println(String(rollTime));
              #endif
              saveState(CHILD_ID_SET, rollTime);
            }
          }
        #ifdef MY_DEBUG
          Serial.println("exiting incoming message");
        #endif
          return;
        }
        
        void before() {
        
          // Setup the button
          pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
          // Activate internal pull-up
        //  digitalWrite(BUTTON_UP_PIN, HIGH);
          //  attachInterrupt(digitalPinToInterrupt(BUTTON_UP_PIN), upButtonPress, FALLING);
        
          pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
          // Activate internal pull-up
        //  digitalWrite(BUTTON_DOWN_PIN, HIGH);
          //  attachInterrupt(digitalPinToInterrupt(BUTTON_DOWN_PIN), downButtonPress, FALLING);
        
        //  pinMode(BUTTON_STOP_PIN, INPUT_PULLUP);
          // Activate internal pull-up
        //  digitalWrite(BUTTON_STOP_PIN, HIGH);
        
          // After setting up the button, setup debouncer
          debouncerUp.attach(BUTTON_UP_PIN);
          debouncerUp.interval(5);
          // After setting up the button, setup debouncer
          debouncerDown.attach(BUTTON_DOWN_PIN);
          debouncerDown.interval(5);
          // After setting up the button, setup debouncer
        //  debouncerStop.attach(BUTTON_STOP_PIN);
        //  debouncerStop.interval(5);
        
          // Make sure relays are off when starting up
          digitalWrite(RELAY_UP_PIN, RELAY_OFF);
          // Then set relay pins in output mode
          pinMode(RELAY_UP_PIN, OUTPUT);
        
          // Make sure relays are off when starting up
          digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
          // Then set relay pins in output mode
          pinMode(RELAY_DOWN_PIN, OUTPUT);
        }
        
        void presentation() {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo(SKETCH_NAME, SKETCH_VER);
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK);
          // present(CHILD_ID_SET, S_CUSTOM);
        }
        
        void setup(void) {
          //set up roll time if the saved value is not 255
          #ifdef MY_DEBUG
          Serial.println("getting rolltime from eeprom: ");
          #endif
          float tmpRollTime = loadState(CHILD_ID_SET);
          if (tmpRollTime != 0xff) {
            rollTime = tmpRollTime;
          }
          #ifdef MY_DEBUG
          Serial.println(String(rollTime));
          #endif
          
          int state = loadState(CHILD_ID_COVER);
          
          #ifdef MY_DEBUG
          Serial.println("getting state from eeprom: ");
          Serial.println(String(state));
          #endif
          
        //  if (state == 0xff) {
        //    initShutters();
        //  } else {
            currentShutterLevel = state;
            requestedShutterLevel = state;
        //  }
        }
        
        void loop(void) {
          if (!initial_state_sent) {
        #ifdef MY_DEBUG
            Serial.println("Sending initial value");
        #endif
            sendState();
            
           // send(msgCode.set('20.0'));
            //    #ifdef MY_DEBUG
            //    Serial.println("Requesting initial value from controller");
            //    #endif
            //    request(CHILD_ID_COVER, V_PERCENTAGE);
            //    wait(2000, C_SET, V_PERCENTAGE);
            initial_state_sent = true;
          }
        
          debouncerUp.update();
          value = debouncerUp.read();
          if (value == 0 && value != oldValueUp) {
            if(isMoving){
              shuttersHalt();
            }  
            else{
            calibrateUp = false;
            calibratedUp = false;
            changeShuttersLevel(STATE_UP);
            }
            //state = UP;
            //sendState();
          }
          oldValueUp = value;
        
          debouncerDown.update();
          value = debouncerDown.read();
          if (value == 0 && value != oldValueDown) {
            if(isMoving){
              shuttersHalt();
            }  
            else{
            calibrateDown = false;
            calibratedDown = false;
            changeShuttersLevel(STATE_DOWN);
            }    
            //state = DOWN;
            //sendState();
          }
          oldValueDown = value;
        
        /*  debouncerStop.update();
          value = debouncerStop.read();
          if (value == 0 && value != oldValueStop) {
            shuttersHalt();
            //state = IDLE;
            //sendState();
          }
          oldValueStop = value;
        */
          if(currentShutterLevel != 100)
          {
            calibrateUp = false;
            calibratedUp = false;
          }
          if(currentShutterLevel != 0)
          {
            calibrateDown = false;
            calibratedDown = false;
          }
          
          if (isMoving) 
          {
            unsigned long _now = millis();
            if (_now - lastLevelTime >= timeOneLevel * 1000) {
              if (directionUpDown == DIRECTION_UP) {
                currentShutterLevel += 1;
              } else {
                currentShutterLevel -= 1;
              }
              currentShutterLevel = constrain(currentShutterLevel, 0, 100);
              #ifdef MY_DEBUG
              Serial.println(String(requestedShutterLevel));
              Serial.println(String(currentShutterLevel));
              #endif
              lastLevelTime = millis();
              send(msgPercentage.set(currentShutterLevel));
            }
            if (currentShutterLevel == requestedShutterLevel) 
            {
              if(currentShutterLevel == 0 && !calibratedDown)
              {
                if(calibrateDown == false)
                {
                  calibrateDown = true;
                  calibratedDown = false;
                  calibrationStartTime = _now;
                }
                else 
                {
                  if(calibratedDown == false)
                  {
                    if (_now - calibrationStartTime >= calibrationTime * 1000)
                    {
                     calibratedDown = true;
                    }
                  }
                }
              }
              else if (currentShutterLevel == 100 && !calibratedUp)
              {
                if(calibrateUp == false)
                {
                  calibrateUp = true;
                  calibratedUp = false;
                  calibrationStartTime = _now;
                }
                else 
                {
                  if(calibratedUp == false)
                  {
                    if (_now - calibrationStartTime >= calibrationTime * 1000)
                    {
                     calibratedUp = true;
                    }
                  }
                }
              }
              else
              {
                shuttersHalt();
              }
            }
          } 
          else 
          {
            if (requestedShutterLevel != currentShutterLevel) 
            {
              if (requestedShutterLevel > currentShutterLevel) {
                shuttersUp();
              }
              else {
                shuttersDown();
              }
              lastLevelTime = millis();
            }
          }
        }
        
        pepsonP 1 Reply Last reply
        0
        • pepsonP pepson

          @kimot

          I dont must use NEW_DRIVER, but when i write sketch to my node without option NEW_DRIVER, it no working. I tested some combination...mix. Gateway 2.3.0 or 2.2.0 with node 2.2.0 and 2.3.0 and Only with NEW_DRIVER works ok and only on 2.2.0 on node and gateway.

          This is my sketch.

          // Enable debug prints to serial monitor
          #define MY_DEBUG
          
          // Enable and select radio type attached
          #define MY_RADIO_RFM69
          #define MY_IS_RFM69HW
          //#define MY_RFM69_FREQUENCY RFM69_868MHZ
          #define RFM69_868MH
          #define MY_RFM69_NEW_DRIVER
          
          #define MY_REPEATER_FEATURE
          
          //#define MY_RFM69_CSMA_LIMIT_DBM (-85)
          
          // uncomment if we want to manually assign an ID
          #define MY_NODE_ID 1
          
          #include <Bounce2.h>
          #include <MySensors.h>
          #include <SPI.h>
          
          #define BUTTON_UP_PIN 3  // Arduino Digital I/O pin number for up button
          #define BUTTON_DOWN_PIN 4  // Arduino Digital I/O pin number for down button
          //#define BUTTON_STOP_PIN 5  // Arduino Digital I/O pin number for stop button
          //#define RELAY_DIR_PIN 6  // Arduino Digital I/O pin number for direction relay
          //#define RELAY_POWER_PIN 7  // Arduino Digital I/O pin number for power relay
          #define RELAY_UP_PIN 5 
          #define RELAY_DOWN_PIN 6
          #define RELAY_ON 0
          #define RELAY_OFF 1
          //#define RELAY_DOWN 1
          //#define RELAY_UP 0
          #define DIRECTION_DOWN 0
          #define DIRECTION_UP 1
          #define SKETCH_NAME "Roleta w sypialni"
          #define SKETCH_VER "2.2"
          #define CHILD_ID_COVER 0   // sensor Id of the sensor child
          #define STATE_UP 100 // 100 is open - up
          #define STATE_DOWN 0 // 0 is closed - down
          //#define CHILD_ID_CALIBRATE 1   // sensor Id of the sensor child to calibrate
          #define CHILD_ID_SET 1   // sensor Id of the sensor child to init the roll time
          #define PRESENT_MESSAGE "Rolety dla Home Assistant"
          const int LEVELS = 100; //the number of levels
          float rollTime = 20.0; //the overall rolling time of the shutter
          const bool IS_ACK = false; //is to acknowlage
          static bool initial_state_sent = false;//for hass we need at list one state send at begining
          
          // debouncing parameters
          int value = 0;
          int oldValueUp = 0;
          int oldValueDown = 0;
          int oldValueStop = 0;
          //static unsigned long last_interrupt_time_up = 0;
          //static unsigned long last_interrupt_time_down = 0;
          //static unsigned long debounce_time = 200;
          
          Bounce debouncerUp = Bounce();
          Bounce debouncerDown = Bounce();
          Bounce debouncerStop = Bounce();
          
          // shutter position parameters
          float timeOneLevel = rollTime / LEVELS;
          int requestedShutterLevel = 0;
          int currentShutterLevel = 0;
          unsigned long lastLevelTime = 0;
          bool isMoving = false;
          int directionUpDown;
          bool calibrateDown;
          bool calibrateUp;
          unsigned long calibrationStartTime;
          float calibrationTime = 5.0;
          bool calibratedDown;
          bool calibratedUp;
          
          enum CoverState {
            STOP,
            UP, // Window covering. Up.
            DOWN, // Window covering. Down.
          };
          
          static int coverState = STOP;
          
          MyMessage msgUp(CHILD_ID_COVER, V_UP);
          MyMessage msgDown(CHILD_ID_COVER, V_DOWN);
          MyMessage msgStop(CHILD_ID_COVER, V_STOP);
          MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE);
          //MyMessage msgCode(CHILD_ID_SET, V_IR_SEND);
          
          void sendState() {
            // Send current state and status to gateway.
          //  send(msgUp.set(coverState == UP));
          //  send(msgDown.set(coverState == DOWN));
          //  send(msgStop.set(coverState == STOP));
            send(msgPercentage.set(currentShutterLevel));
          }
          
          void shuttersUp(void) {
            #ifdef MY_DEBUG
            Serial.println("Shutters going up");
            #endif
            if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) {
              digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
              wait(50);
            }
            digitalWrite(RELAY_UP_PIN, RELAY_ON);
          
            directionUpDown = DIRECTION_UP;
            isMoving = true;
            coverState = UP;
            sendState();
          }
          
          void shuttersDown(void) {
            #ifdef MY_DEBUG
            Serial.println("Shutters going down");
            #endif
            if (digitalRead(RELAY_UP_PIN) == RELAY_ON) {
              digitalWrite(RELAY_UP_PIN, RELAY_OFF);
              wait(50);
            }
            digitalWrite(RELAY_DOWN_PIN, RELAY_ON);
          
            directionUpDown = DIRECTION_DOWN;
            isMoving = true;
            coverState = DOWN;
            sendState();
          }
          
          void shuttersHalt(void) {
          #ifdef MY_DEBUG
            Serial.println("Shutters halted");
          #endif
            digitalWrite(RELAY_UP_PIN, RELAY_OFF);
            digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
          
            isMoving = false;
            requestedShutterLevel = currentShutterLevel;
          #ifdef MY_DEBUG
            Serial.println("saving state to: ");
            Serial.println(String(currentShutterLevel));
          #endif
            saveState(CHILD_ID_COVER, currentShutterLevel);
            coverState = STOP;
            sendState();
          }
          
          void changeShuttersLevel(int level) {
            int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN;
            if (isMoving && dir != directionUpDown) {
              shuttersHalt();
            }
            requestedShutterLevel = level;
          }
          
          void initShutters() {
          #ifdef MY_DEBUG
            Serial.println("Init Cover");
          #endif
            shuttersUp();
            wait((rollTime + timeOneLevel * LEVELS) * 1000);
            currentShutterLevel = STATE_UP;
            requestedShutterLevel = currentShutterLevel;
          }
          
          void receive(const MyMessage &message) {
          #ifdef MY_DEBUG
            Serial.println("recieved incomming message");
            Serial.println("Recieved message for sensor: ");
            Serial.println(String(message.sensor));
            Serial.println("Recieved message with type: ");
            Serial.println(String(message.type));
          #endif
            if (message.sensor == CHILD_ID_COVER) {
              switch (message.type) {
                case V_UP:
                  //Serial.println(", New status: V_UP");
                  changeShuttersLevel(STATE_UP);
                  //state = UP;
                  //sendState();
                  break;
          
                case V_DOWN:
                  //Serial.println(", New status: V_DOWN");
                  changeShuttersLevel(STATE_DOWN);
                  //state = DOWN;
                  //sendState();
                  break;
          
                case V_STOP:
                  //Serial.println(", New status: V_STOP");
                  shuttersHalt();
                  //state = IDLE;
                  //sendState();
                  break;
          
                case V_PERCENTAGE:
                  //Serial.println(", New status: V_PERCENTAGE");
                  //          if (!initial_state_sent) {
                  //            #ifdef MY_DEBUG
                  //            Serial.println("Receiving initial value from controller");
                  //            #endif
                  //            initial_state_sent = true;
                  //          }
                  int per = message.getInt();
                  if (per > STATE_UP) {
                    per = STATE_UP;
                  }
                  changeShuttersLevel(per);
                  //InitShutters(message.getInt());//send value < 0 or > 100 to calibrate
                  //sendState();
                  break;
              }
            } 
          else if (message.sensor ==  CHILD_ID_SET) {
          
              if (message.type == V_VAR1) {
                #ifdef MY_DEBUG
                Serial.println(", New status: V_VAR1, with payload: ");
                #endif      
                String strRollTime = message.getString();
                rollTime = strRollTime.toFloat();
                #ifdef MY_DEBUG
                Serial.println("rolltime value: ");
                Serial.println(String(rollTime));
                #endif
                saveState(CHILD_ID_SET, rollTime);
              }
            }
          #ifdef MY_DEBUG
            Serial.println("exiting incoming message");
          #endif
            return;
          }
          
          void before() {
          
            // Setup the button
            pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
            // Activate internal pull-up
          //  digitalWrite(BUTTON_UP_PIN, HIGH);
            //  attachInterrupt(digitalPinToInterrupt(BUTTON_UP_PIN), upButtonPress, FALLING);
          
            pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
            // Activate internal pull-up
          //  digitalWrite(BUTTON_DOWN_PIN, HIGH);
            //  attachInterrupt(digitalPinToInterrupt(BUTTON_DOWN_PIN), downButtonPress, FALLING);
          
          //  pinMode(BUTTON_STOP_PIN, INPUT_PULLUP);
            // Activate internal pull-up
          //  digitalWrite(BUTTON_STOP_PIN, HIGH);
          
            // After setting up the button, setup debouncer
            debouncerUp.attach(BUTTON_UP_PIN);
            debouncerUp.interval(5);
            // After setting up the button, setup debouncer
            debouncerDown.attach(BUTTON_DOWN_PIN);
            debouncerDown.interval(5);
            // After setting up the button, setup debouncer
          //  debouncerStop.attach(BUTTON_STOP_PIN);
          //  debouncerStop.interval(5);
          
            // Make sure relays are off when starting up
            digitalWrite(RELAY_UP_PIN, RELAY_OFF);
            // Then set relay pins in output mode
            pinMode(RELAY_UP_PIN, OUTPUT);
          
            // Make sure relays are off when starting up
            digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
            // Then set relay pins in output mode
            pinMode(RELAY_DOWN_PIN, OUTPUT);
          }
          
          void presentation() {
            // Send the sketch version information to the gateway and Controller
            sendSketchInfo(SKETCH_NAME, SKETCH_VER);
            // Register all sensors to gw (they will be created as child devices)
            present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK);
            // present(CHILD_ID_SET, S_CUSTOM);
          }
          
          void setup(void) {
            //set up roll time if the saved value is not 255
            #ifdef MY_DEBUG
            Serial.println("getting rolltime from eeprom: ");
            #endif
            float tmpRollTime = loadState(CHILD_ID_SET);
            if (tmpRollTime != 0xff) {
              rollTime = tmpRollTime;
            }
            #ifdef MY_DEBUG
            Serial.println(String(rollTime));
            #endif
            
            int state = loadState(CHILD_ID_COVER);
            
            #ifdef MY_DEBUG
            Serial.println("getting state from eeprom: ");
            Serial.println(String(state));
            #endif
            
          //  if (state == 0xff) {
          //    initShutters();
          //  } else {
              currentShutterLevel = state;
              requestedShutterLevel = state;
          //  }
          }
          
          void loop(void) {
            if (!initial_state_sent) {
          #ifdef MY_DEBUG
              Serial.println("Sending initial value");
          #endif
              sendState();
              
             // send(msgCode.set('20.0'));
              //    #ifdef MY_DEBUG
              //    Serial.println("Requesting initial value from controller");
              //    #endif
              //    request(CHILD_ID_COVER, V_PERCENTAGE);
              //    wait(2000, C_SET, V_PERCENTAGE);
              initial_state_sent = true;
            }
          
            debouncerUp.update();
            value = debouncerUp.read();
            if (value == 0 && value != oldValueUp) {
              if(isMoving){
                shuttersHalt();
              }  
              else{
              calibrateUp = false;
              calibratedUp = false;
              changeShuttersLevel(STATE_UP);
              }
              //state = UP;
              //sendState();
            }
            oldValueUp = value;
          
            debouncerDown.update();
            value = debouncerDown.read();
            if (value == 0 && value != oldValueDown) {
              if(isMoving){
                shuttersHalt();
              }  
              else{
              calibrateDown = false;
              calibratedDown = false;
              changeShuttersLevel(STATE_DOWN);
              }    
              //state = DOWN;
              //sendState();
            }
            oldValueDown = value;
          
          /*  debouncerStop.update();
            value = debouncerStop.read();
            if (value == 0 && value != oldValueStop) {
              shuttersHalt();
              //state = IDLE;
              //sendState();
            }
            oldValueStop = value;
          */
            if(currentShutterLevel != 100)
            {
              calibrateUp = false;
              calibratedUp = false;
            }
            if(currentShutterLevel != 0)
            {
              calibrateDown = false;
              calibratedDown = false;
            }
            
            if (isMoving) 
            {
              unsigned long _now = millis();
              if (_now - lastLevelTime >= timeOneLevel * 1000) {
                if (directionUpDown == DIRECTION_UP) {
                  currentShutterLevel += 1;
                } else {
                  currentShutterLevel -= 1;
                }
                currentShutterLevel = constrain(currentShutterLevel, 0, 100);
                #ifdef MY_DEBUG
                Serial.println(String(requestedShutterLevel));
                Serial.println(String(currentShutterLevel));
                #endif
                lastLevelTime = millis();
                send(msgPercentage.set(currentShutterLevel));
              }
              if (currentShutterLevel == requestedShutterLevel) 
              {
                if(currentShutterLevel == 0 && !calibratedDown)
                {
                  if(calibrateDown == false)
                  {
                    calibrateDown = true;
                    calibratedDown = false;
                    calibrationStartTime = _now;
                  }
                  else 
                  {
                    if(calibratedDown == false)
                    {
                      if (_now - calibrationStartTime >= calibrationTime * 1000)
                      {
                       calibratedDown = true;
                      }
                    }
                  }
                }
                else if (currentShutterLevel == 100 && !calibratedUp)
                {
                  if(calibrateUp == false)
                  {
                    calibrateUp = true;
                    calibratedUp = false;
                    calibrationStartTime = _now;
                  }
                  else 
                  {
                    if(calibratedUp == false)
                    {
                      if (_now - calibrationStartTime >= calibrationTime * 1000)
                      {
                       calibratedUp = true;
                      }
                    }
                  }
                }
                else
                {
                  shuttersHalt();
                }
              }
            } 
            else 
            {
              if (requestedShutterLevel != currentShutterLevel) 
              {
                if (requestedShutterLevel > currentShutterLevel) {
                  shuttersUp();
                }
                else {
                  shuttersDown();
                }
                lastLevelTime = millis();
              }
            }
          }
          
          pepsonP Offline
          pepsonP Offline
          pepson
          wrote on last edited by
          #37

          And is any chance to run gateway on RPI3 but on old default driver not with NEW DRIVER ?

          Anybody has any solution for my problem with communication on version 2.3.0 ?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mickecarlsson
            wrote on last edited by mickecarlsson
            #38

            I just checked all my nodes:

            1. Garage - measures temperature/humidity and power usage - uses NEW_DRIVER, Arduino UNO, powered all times.
            2. Storage - measures temperature/humidity and power usage - uses NEW_DRIVER, Arduino UNO powered all times.
            3. Greenhouse - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
            4. Patio - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
            5. Bedroom - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
            6. Kitchen area - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.

            My nodes are within 40 meters from the gateway.
            I will no reprogram the node 4 and 5 to use the new driver to see if that makes any difference.
            Node 1 and 2 are the nodes farthest away from the gateway, there is one brick wall and three wood walls between the node and the gateway.

            pepsonP 1 Reply Last reply
            0
            • M mickecarlsson

              I just checked all my nodes:

              1. Garage - measures temperature/humidity and power usage - uses NEW_DRIVER, Arduino UNO, powered all times.
              2. Storage - measures temperature/humidity and power usage - uses NEW_DRIVER, Arduino UNO powered all times.
              3. Greenhouse - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
              4. Patio - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
              5. Bedroom - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
              6. Kitchen area - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.

              My nodes are within 40 meters from the gateway.
              I will no reprogram the node 4 and 5 to use the new driver to see if that makes any difference.
              Node 1 and 2 are the nodes farthest away from the gateway, there is one brick wall and three wood walls between the node and the gateway.

              pepsonP Offline
              pepsonP Offline
              pepson
              wrote on last edited by pepson
              #39

              @mickecarlsson
              Please also for all points give info what version MySensors use and if you can upload your sketches for all point.

              And Gateway has on RPI3 with version 2.3.0 ? By Serial or ethernet ? And tell me with what controller you use it ? I use with Home Assistant.

              And BTW tell me how long Arduino Mini Pro work for you on battery and what battery you use ... and show your project... Did you remove LED from Arduino to save power battery ?
              In Sketch you measure % power from battery ? And send to controller ? What controller you use ?

              1 Reply Last reply
              0
              • scalzS Offline
                scalzS Offline
                scalz
                Hardware Contributor
                wrote on last edited by scalz
                #40

                @pepson @mickecarlsson
                in theory, if I remember well, length of antenna should be:

                • 86mm for 868mhz
                • 82mm for 915Mhz
                  Better check which frequency you can use where you live.

                Also this is in ideal world, it depends on:

                • antenna material
                • gnd plane size
                • etc

                So when you want to tune your network, you could use a good, 868mhz for example, antenna on gateway (from a reliable supplier, as there are also a lot of unmatched antenna around).
                Then you can try to tune emprically, by checking rssi vs length. Add length or cut, and check. If you need more or less length is dependant on above factors.

                As already said, we don't recommand mixing new driver with older.. As packet has not the same format.
                No eta for fixing rfm69 if issues, too busy for the moment, but we'll try asap.

                pepsonP 1 Reply Last reply
                0
                • scalzS scalz

                  @pepson @mickecarlsson
                  in theory, if I remember well, length of antenna should be:

                  • 86mm for 868mhz
                  • 82mm for 915Mhz
                    Better check which frequency you can use where you live.

                  Also this is in ideal world, it depends on:

                  • antenna material
                  • gnd plane size
                  • etc

                  So when you want to tune your network, you could use a good, 868mhz for example, antenna on gateway (from a reliable supplier, as there are also a lot of unmatched antenna around).
                  Then you can try to tune emprically, by checking rssi vs length. Add length or cut, and check. If you need more or less length is dependant on above factors.

                  As already said, we don't recommand mixing new driver with older.. As packet has not the same format.
                  No eta for fixing rfm69 if issues, too busy for the moment, but we'll try asap.

                  pepsonP Offline
                  pepsonP Offline
                  pepson
                  wrote on last edited by
                  #41

                  @scalz said in RFM69 new driver delay:

                  So when you want to tune your network, you could use a good, 868mhz for example, antenna on gateway (from a reliable supplier, as there are also a lot of unmatched antenna around).
                  Then you can try to tune emprically, by checking rssi vs length. Add length or cut, and check. If you need more or less length is dependant on above factors.
                  As already said, we don't recommand mixing new driver with older.. As packet has not the same format.
                  No eta for fixing rfm69 if issues, too busy for the moment, but we'll try asap.

                  Yes i have for my radio anntena 86mm.
                  On nodes and gateway i am sure that i use freq 868MHz.
                  Look on my command to build gateway and on my sketches node.
                  On version 2.2.0 i use gateway (as people write by my command i use NEW DRIVER) and also on node also use NEW DRIVER and in this solution all works perfect with no problem.

                  When i update gateway and node to 2.3.0 also with NEW DRIVER i have a problem that controll node and connection is no stabilish. In my Home Assistant sometimes i can controll relay but sometimes no reaction on click by Home Assistant. When use on node old driver (but on gateway NEW DRIVER) it is no working. Only on version 2.2.0 on gatewy and node all works perfect.

                  Is any chance to build gateway on RPI3 with old driver to RFM69HW ? Because as people write in default building on gateway on RPI3 use NEW DRIVER and we can not change it.... It is true ?

                  1 Reply Last reply
                  0
                  • scalzS Offline
                    scalzS Offline
                    scalz
                    Hardware Contributor
                    wrote on last edited by scalz
                    #42

                    @pepson
                    My comments about tuning antenna were general, it can be useful for optimizing your network.

                    I already read what you said previously ;) It should be normal that new&old driver not working together (unless a recent change..).

                    We'll take a look at which changes are incorrect. I'm using experimental local mysensors version, so I'm a bit off topic regarding official release and no time for debugging, for the moment, as like I said we'll try to check that asap.

                    Regarding RPI, I'm not using it as gw (I prefer a lower power gw that i can place where i want) so I'm not sure. Take it with a pinch of salt but if i remember, old rfm69 driver spi functions etc are not adapted to linux (whereas new driver is)

                    If 2.3 is blocking, do you need a particular fix in 2.3 ? Else you could stick to 2.2

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mickecarlsson
                      wrote on last edited by mickecarlsson
                      #43

                      OK,
                      Here goes what I have:
                      Arduino Pro Mini, chinese clones. Regulator and led removed. Soldered on EasyPCB rev 9.
                      Radio is RFM69 868 MHz with helicoil antenna on the nodes, 86 mm antenna on the Gateway
                      Bootloader is from https://github.com/MCUdude/MiniCore
                      The bootloader settings are:
                      Board: ATmega328
                      Bootloader: Yes
                      Variant: 328P / 328PA
                      BOD: 1.8v
                      Clock: 1MHz internal
                      Compiler LTO: Disabled (default)

                      On the EasyPCB I have only soldered the radio, the antenna and the Arduino. No booster, no capacitors, no resistors.
                      I have put a link on the REG and run the node on two AA batteries.
                      The nodes only have one sensor, the BME280.

                      The controller I use is Domoticz, latest version (I think).

                      I have now reprogrammed some of the nodes to 2.30 and I use NEW_DRIVER.
                      Gateway - 2.3.0
                      Patio - 2.3.0
                      Test-node - 2.3.0
                      Kitchen - 2.3.0
                      Bedroom - 2.3.0
                      UV and LUX - 2.3.0

                      No problems at all.
                      However, I do not use the receive() function on my nodes.
                      And I see that you use the REPEATER setting, if your node can reach the gateway the disable repeater.

                      pepsonP 1 Reply Last reply
                      0
                      • M mickecarlsson

                        OK,
                        Here goes what I have:
                        Arduino Pro Mini, chinese clones. Regulator and led removed. Soldered on EasyPCB rev 9.
                        Radio is RFM69 868 MHz with helicoil antenna on the nodes, 86 mm antenna on the Gateway
                        Bootloader is from https://github.com/MCUdude/MiniCore
                        The bootloader settings are:
                        Board: ATmega328
                        Bootloader: Yes
                        Variant: 328P / 328PA
                        BOD: 1.8v
                        Clock: 1MHz internal
                        Compiler LTO: Disabled (default)

                        On the EasyPCB I have only soldered the radio, the antenna and the Arduino. No booster, no capacitors, no resistors.
                        I have put a link on the REG and run the node on two AA batteries.
                        The nodes only have one sensor, the BME280.

                        The controller I use is Domoticz, latest version (I think).

                        I have now reprogrammed some of the nodes to 2.30 and I use NEW_DRIVER.
                        Gateway - 2.3.0
                        Patio - 2.3.0
                        Test-node - 2.3.0
                        Kitchen - 2.3.0
                        Bedroom - 2.3.0
                        UV and LUX - 2.3.0

                        No problems at all.
                        However, I do not use the receive() function on my nodes.
                        And I see that you use the REPEATER setting, if your node can reach the gateway the disable repeater.

                        pepsonP Offline
                        pepsonP Offline
                        pepson
                        wrote on last edited by pepson
                        #44

                        @mickecarlsson

                        Tell me for what you change bootloader ? And i also have clone chine arduino pro mini... I also must change bootloader on this Arduino Pro Mini CLONE CHINA ? Because i dont change bootloader after buy...

                        And if you can show also your antenna...and where you buy this antenna ? I try found on Aliexpres but not found.

                        And I see that you use the REPEATER setting, if your node can reach the gateway the disable repeater.
                        But i can not use REPEATER function to to increase the range from the gate - something like the MESH network ?

                        And is any chance to you test my SKETCH with relay on your arduino ?

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mickecarlsson
                          wrote on last edited by
                          #45

                          You don't ned to change bootloader, I do because I run on battery and it fits my need.
                          I can't test your sketch as I don't have the necessary hardware to test it.
                          How far apart are your nodes?
                          My antenna is from AliExpress

                          pepsonP 1 Reply Last reply
                          0
                          • M mickecarlsson

                            You don't ned to change bootloader, I do because I run on battery and it fits my need.
                            I can't test your sketch as I don't have the necessary hardware to test it.
                            How far apart are your nodes?
                            My antenna is from AliExpress

                            pepsonP Offline
                            pepsonP Offline
                            pepson
                            wrote on last edited by pepson
                            #46

                            @mickecarlsson
                            Now my node is very near my Gateway about 6meters. Because now i project my automation in my new home.

                            But if you only have Arduino Pro Mini with Radio RFM69HW you can test my sketch. I think that you dont need 2xrelay to test it... Please...

                            But for what is function REPEATER ? To increase range from Gateway to very far node ? Then the node with the repeater function extends the range?

                            When come back to home i try build node without option REPEATER and try run this...

                            Also can you give on priv info how upload this bootloader ? I can only write by ArduinoIDE or i must do other actions ?

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              mickecarlsson
                              wrote on last edited by
                              #47

                              You only need repeater fi you have a node far away that can’t reach the gateway, then you add repeater on a node nearer the gateway.
                              See here: MySensors Network
                              And if the node has repeater defined it must allways have power and no Sleep.
                              Sorry, I can’t test the sketch.

                              pepsonP 3 Replies Last reply
                              0
                              • M mickecarlsson

                                You only need repeater fi you have a node far away that can’t reach the gateway, then you add repeater on a node nearer the gateway.
                                See here: MySensors Network
                                And if the node has repeater defined it must allways have power and no Sleep.
                                Sorry, I can’t test the sketch.

                                pepsonP Offline
                                pepsonP Offline
                                pepson
                                wrote on last edited by pepson
                                #48

                                @mickecarlsson
                                Can you share me your all sketches ? Thanks
                                And tell me how you have connected Gateway to RPI3? By ethernet or by serial ? Because i see in your building Gateway that you dont use parameter ETHERNET on port 5003

                                And anybody has any contact to developer @tekka007 ?

                                This is info what show in debug on version 2.3.0 gateway and also node on version 2.3.0

                                pi@hassbian:~/MySensors $ sudo /usr/local/bin/mysgw
                                Jun 22 17:22:49 INFO  Starting gateway...
                                Jun 22 17:22:49 INFO  Protocol version - 2.3.0
                                Jun 22 17:22:49 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,VER=2.3.0
                                Jun 22 17:22:49 DEBUG TSF:LRT:OK
                                Jun 22 17:22:49 DEBUG TSM:INIT
                                Jun 22 17:22:49 DEBUG TSF:WUR:MS=0
                                Jun 22 17:22:49 DEBUG TSM:INIT:TSP OK
                                Jun 22 17:22:49 DEBUG TSM:INIT:GW MODE
                                Jun 22 17:22:49 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
                                Jun 22 17:22:49 DEBUG MCO:REG:NOT NEEDED
                                Jun 22 17:22:49 DEBUG Listening for connections on 0.0.0.0:5003
                                Jun 22 17:22:49 DEBUG MCO:BGN:STP
                                Jun 22 17:22:49 DEBUG MCO:BGN:INIT OK,TSP=1
                                Jun 22 17:22:54 DEBUG TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                                Jun 22 17:22:54 DEBUG TSF:MSG:BC
                                Jun 22 17:22:54 DEBUG TSF:MSG:FPAR REQ,ID=2
                                Jun 22 17:22:54 DEBUG TSF:CKU:OK,FCTRL
                                Jun 22 17:22:54 DEBUG TSF:MSG:GWL OK
                                Jun 22 17:22:54 DEBUG TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=O                 K:0
                                Jun 22 17:22:56 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
                                Jun 22 17:22:56 DEBUG TSF:MSG:PINGED,ID=2,HP=1
                                Jun 22 17:22:57 DEBUG TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=                 OK:1
                                Jun 22 17:22:57 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
                                Jun 22 17:22:58 DEBUG TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=                 OK:0100
                                Jun 22 17:22:59 DEBUG TSF:MSG:READ,2-2-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.3.0
                                Jun 22 17:22:59 DEBUG TSF:MSG:READ,2-2-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.3.0
                                Jun 22 17:23:00 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
                                Jun 22 17:23:00 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
                                Jun 22 17:23:03 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=11,pt=0,l=25,sg=0:1xRelay &                  Button-Sypialni
                                Jun 22 17:23:03 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=11,pt=0,l=25,sg=0:1xRelay &                  Button-Sypialni
                                Jun 22 17:23:03 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=12,pt=0,l=5,sg=0:2.2.0
                                Jun 22 17:23:04 DEBUG TSF:MSG:READ,2-2-0,s=1,c=0,t=3,pt=0,l=0,sg=0:
                                Jun 22 17:23:05 DEBUG TSF:MSG:READ,2-2-0,s=1,c=0,t=3,pt=0,l=0,sg=0:
                                Jun 22 17:23:05 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
                                Jun 22 17:23:06 DEBUG TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
                                Jun 22 17:23:07 DEBUG TSF:MSG:READ,2-2-0,s=1,c=1,t=2,pt=2,l=2,sg=0:0
                                Jun 22 17:23:08 DEBUG TSF:MSG:READ,2-2-0,s=1,c=1,t=2,pt=2,l=2,sg=0:0
                                Jun 22 17:23:08 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=1,pt=0,l=0,sg=0:
                                Jun 22 17:23:09 DEBUG TSF:MSG:READ,2-2-0,s=255,c=3,t=1,pt=0,l=0,sg=0:
                                
                                
                                M 1 Reply Last reply
                                0
                                • M mickecarlsson

                                  You only need repeater fi you have a node far away that can’t reach the gateway, then you add repeater on a node nearer the gateway.
                                  See here: MySensors Network
                                  And if the node has repeater defined it must allways have power and no Sleep.
                                  Sorry, I can’t test the sketch.

                                  pepsonP Offline
                                  pepsonP Offline
                                  pepson
                                  wrote on last edited by
                                  #49

                                  @mickecarlsson I done next test.
                                  Updated my Gateway on RPI3 to 2.3.0
                                  Then also update my nodes to 2.3.0
                                  One node which i use is to control Switch Relay. It works ok also with Repeater function and also without Repeater function.
                                  Second node is to control cover by relay. It no working correct also with Reapeater and also without Repeater function. Status is not update in the same time. Sometimes no respod reaction on click button.

                                  Below i see SWITCH releay SKETCH and also to Cover.
                                  Please help me.
                                  Also i need help to convert this sketch for Switch 1xRelay to Switch 2x Releay. ANybody can help me. ?

                                  /*
                                     Relay with button sketch
                                     modified to work with no uplink
                                     to gateway and try to maintain sync to controller
                                  */
                                  
                                  // Enable debug prints to serial monitor
                                  #define MY_DEBUG                               // Enable debug prints to serial monitor
                                  
                                  // Enable and select radio type attached
                                  #define MY_RADIO_RFM69
                                  #define MY_IS_RFM69HW
                                  #define RFM69_868MH
                                  #define MY_RFM69_NEW_DRIVER
                                  
                                  // uncomment if we want to manually assign an ID
                                  #define MY_NODE_ID 2                       // Node id defaults to AUTO (tries to fetch id from controller) 
                                  
                                  #define MY_TRANSPORT_WAIT_READY_MS 5000        //set how long to wait for transport ready in milliseconds
                                  
                                  #define MY_REPEATER_FEATURE                    // Enabled repeater feature for this node
                                  
                                  #include <MySensors.h>
                                  #include <Bounce2.h>
                                  
                                  #define RELAY_PIN  5      // Arduino Digital I/O pin number for relay 
                                  #define BUTTON_PIN  3     // Arduino Digital I/O pin number for button 
                                  #define CHILD_ID 1        // Id of the sensor child
                                  #define RELAY_ON 0
                                  #define RELAY_OFF 1
                                  
                                  Bounce debouncer = Bounce();
                                  int oldValue = 0;
                                  bool uplinkAvailable = true;
                                  bool state = false;
                                  bool requestState;
                                  bool firstStart = true;
                                  unsigned long uplinkCheckTime ;                // holder for uplink checks
                                  unsigned long uplinkCheckPeriod = 30*1000;     // time between checks for uplink in milliseconds
                                  unsigned long returnWait = 1000;               // how long to wait for return from controller in milliseconds.. adjust as needed
                                  unsigned long oldTime = 0;
                                  unsigned long newTime = 0;
                                  MyMessage msg(CHILD_ID, V_STATUS);
                                  
                                  void setup(){
                                    pinMode(BUTTON_PIN, INPUT_PULLUP);           // Setup the button pin, Activate internal pull-up
                                    
                                    debouncer.attach(BUTTON_PIN);                // After setting up the button, setup debouncer
                                    debouncer.interval(5);
                                  
                                    pinMode(RELAY_PIN, OUTPUT);                 // set relay pin in output mode
                                    digitalWrite(RELAY_PIN, RELAY_OFF);         // Make sure relay is off when starting up
                                    send(msg.set(RELAY_OFF), false);           // notify controller to show off state
                                  }
                                  
                                  void presentation()  {
                                    // Send the sketch version information to the gateway and Controller
                                    sendSketchInfo("1xRelay & Button-Sypialnia", "2.2.0");
                                  
                                    // Register all sensors to gw (they will be created as child devices)
                                    present(CHILD_ID, S_BINARY);
                                  }
                                  
                                  
                                  void loop(){
                                    if (firstStart) {                            // this code is only run once at startup
                                      Serial.println("First run started");
                                      requestTime();                             // get time from controller
                                      wait (returnWait);                         // delay to allow time to return
                                      if (oldTime == 0){                         // check to see if there was a return from the time request
                                        Serial.println("uplink not available");
                                        uplinkAvailable = false;                 // no uplink established
                                        uplinkCheckTime = millis();
                                      }
                                       else{
                                        Serial.println("uplink available");
                                        request( CHILD_ID, V_STATUS);            // get status of switch on controller
                                        wait (returnWait);                       //wait needed to allow request to return from controller
                                        Serial.print("controller state --- ");
                                        Serial.println(requestState);
                                        if (requestState != state) {             // check that controller is corectly showing the current relay state
                                          send(msg.set(state), false);           // notify controller of current state
                                        } 
                                       }   
                                    firstStart = false;                                          // set firstStart flag false to prevent code from running again
                                   }
                                  
                                    debouncer.update();
                                    int value = debouncer.read();                               // Get the update value
                                    if (value != oldValue && value == 0) {                      // check for new button push
                                      state =  !state;                                          // Toggle the state
                                      digitalWrite(RELAY_PIN, state ? RELAY_ON : RELAY_OFF);    // switch the relay to the new state
                                      requestTime();
                                      wait (returnWait);                                               // delay to allow time to return
                                      if (oldTime != newTime){                                  // if times are different then uplink is available
                                        send(msg.set(state), false);
                                        oldTime = newTime;
                                      }
                                      else{                                                    // if times are the same no uplink is available
                                       Serial.println("uplink not available");
                                        uplinkAvailable = false;                                // no uplink available, set flag false
                                        uplinkCheckTime = millis();                             // start the timer from now
                                      }
                                  
                                    }
                                    oldValue = value;
                                   
                                    if (!uplinkAvailable && (millis() - uplinkCheckTime > uplinkCheckPeriod) ) {       // test to see if function should be called
                                      uplinkCheck();                                                                  // call uplink checking function
                                    }
                                  
                                  }
                                  
                                  /*-------------------start of functions--------------------------*/
                                  
                                  void receive(const MyMessage &message) {
                                    if (message.type == V_STATUS) {                                   // check to see if incoming message is for a switch
                                      switch (message.getCommand()) {                                 // message.getCommand will give us the command type of the incomming message
                                        case C_SET:                                                   //message is a set command  from controller to update relay state
                                          state = message.getBool();                                  // get the new state
                                          digitalWrite(RELAY_PIN, state ? RELAY_ON : RELAY_OFF);      // switch relay to new state
                                          send(msg.set(state));
                                          uplinkAvailable = true;                                     //  uplink established
                                          /*---- Write some debug info----*/
                                          Serial.print("Incoming change for sensor:");
                                          Serial.print(message.sensor);
                                          Serial.print(", New status: ");
                                          Serial.println(message.getBool());
                                          break;
                                        case C_REQ:                                               // message is a returning request from controller
                                          requestState = message.getBool();                       // update requestState with returning state
                                          break;
                                      }
                                    }
                                  }
                                  
                                  void uplinkCheck() {
                                      requestTime();
                                      wait (returnWait);                       // wait for time return.. this may need to be varied for your system
                                     if (oldTime != newTime){
                                       Serial.println("uplink re-established");
                                       request( CHILD_ID, V_STATUS);
                                       wait (returnWait);                        //wait needed to allow request to return from controller
                                      if (requestState != state) {              // check that controller is corectly showing the current relay state
                                        send(msg.set(state), false);            // notify controller of current state no ack
                                        uplinkAvailable = true;                 //  uplink established
                                        oldTime = newTime;
                                      }
                                    }
                                    uplinkCheckTime = millis();                // reset the checktime
                                    Serial.println("uplinkchecktime reset");
                                  }
                                  
                                  
                                  void receiveTime(unsigned long time)
                                  {
                                    if (firstStart){
                                      oldTime = time;
                                      newTime = time;
                                    }
                                    else{
                                    newTime = time;
                                  }
                                    Serial.print("time received---- " );
                                    Serial.println(time);
                                  }```
                                  pepsonP 1 Reply Last reply
                                  0
                                  • pepsonP pepson

                                    @mickecarlsson I done next test.
                                    Updated my Gateway on RPI3 to 2.3.0
                                    Then also update my nodes to 2.3.0
                                    One node which i use is to control Switch Relay. It works ok also with Repeater function and also without Repeater function.
                                    Second node is to control cover by relay. It no working correct also with Reapeater and also without Repeater function. Status is not update in the same time. Sometimes no respod reaction on click button.

                                    Below i see SWITCH releay SKETCH and also to Cover.
                                    Please help me.
                                    Also i need help to convert this sketch for Switch 1xRelay to Switch 2x Releay. ANybody can help me. ?

                                    /*
                                       Relay with button sketch
                                       modified to work with no uplink
                                       to gateway and try to maintain sync to controller
                                    */
                                    
                                    // Enable debug prints to serial monitor
                                    #define MY_DEBUG                               // Enable debug prints to serial monitor
                                    
                                    // Enable and select radio type attached
                                    #define MY_RADIO_RFM69
                                    #define MY_IS_RFM69HW
                                    #define RFM69_868MH
                                    #define MY_RFM69_NEW_DRIVER
                                    
                                    // uncomment if we want to manually assign an ID
                                    #define MY_NODE_ID 2                       // Node id defaults to AUTO (tries to fetch id from controller) 
                                    
                                    #define MY_TRANSPORT_WAIT_READY_MS 5000        //set how long to wait for transport ready in milliseconds
                                    
                                    #define MY_REPEATER_FEATURE                    // Enabled repeater feature for this node
                                    
                                    #include <MySensors.h>
                                    #include <Bounce2.h>
                                    
                                    #define RELAY_PIN  5      // Arduino Digital I/O pin number for relay 
                                    #define BUTTON_PIN  3     // Arduino Digital I/O pin number for button 
                                    #define CHILD_ID 1        // Id of the sensor child
                                    #define RELAY_ON 0
                                    #define RELAY_OFF 1
                                    
                                    Bounce debouncer = Bounce();
                                    int oldValue = 0;
                                    bool uplinkAvailable = true;
                                    bool state = false;
                                    bool requestState;
                                    bool firstStart = true;
                                    unsigned long uplinkCheckTime ;                // holder for uplink checks
                                    unsigned long uplinkCheckPeriod = 30*1000;     // time between checks for uplink in milliseconds
                                    unsigned long returnWait = 1000;               // how long to wait for return from controller in milliseconds.. adjust as needed
                                    unsigned long oldTime = 0;
                                    unsigned long newTime = 0;
                                    MyMessage msg(CHILD_ID, V_STATUS);
                                    
                                    void setup(){
                                      pinMode(BUTTON_PIN, INPUT_PULLUP);           // Setup the button pin, Activate internal pull-up
                                      
                                      debouncer.attach(BUTTON_PIN);                // After setting up the button, setup debouncer
                                      debouncer.interval(5);
                                    
                                      pinMode(RELAY_PIN, OUTPUT);                 // set relay pin in output mode
                                      digitalWrite(RELAY_PIN, RELAY_OFF);         // Make sure relay is off when starting up
                                      send(msg.set(RELAY_OFF), false);           // notify controller to show off state
                                    }
                                    
                                    void presentation()  {
                                      // Send the sketch version information to the gateway and Controller
                                      sendSketchInfo("1xRelay & Button-Sypialnia", "2.2.0");
                                    
                                      // Register all sensors to gw (they will be created as child devices)
                                      present(CHILD_ID, S_BINARY);
                                    }
                                    
                                    
                                    void loop(){
                                      if (firstStart) {                            // this code is only run once at startup
                                        Serial.println("First run started");
                                        requestTime();                             // get time from controller
                                        wait (returnWait);                         // delay to allow time to return
                                        if (oldTime == 0){                         // check to see if there was a return from the time request
                                          Serial.println("uplink not available");
                                          uplinkAvailable = false;                 // no uplink established
                                          uplinkCheckTime = millis();
                                        }
                                         else{
                                          Serial.println("uplink available");
                                          request( CHILD_ID, V_STATUS);            // get status of switch on controller
                                          wait (returnWait);                       //wait needed to allow request to return from controller
                                          Serial.print("controller state --- ");
                                          Serial.println(requestState);
                                          if (requestState != state) {             // check that controller is corectly showing the current relay state
                                            send(msg.set(state), false);           // notify controller of current state
                                          } 
                                         }   
                                      firstStart = false;                                          // set firstStart flag false to prevent code from running again
                                     }
                                    
                                      debouncer.update();
                                      int value = debouncer.read();                               // Get the update value
                                      if (value != oldValue && value == 0) {                      // check for new button push
                                        state =  !state;                                          // Toggle the state
                                        digitalWrite(RELAY_PIN, state ? RELAY_ON : RELAY_OFF);    // switch the relay to the new state
                                        requestTime();
                                        wait (returnWait);                                               // delay to allow time to return
                                        if (oldTime != newTime){                                  // if times are different then uplink is available
                                          send(msg.set(state), false);
                                          oldTime = newTime;
                                        }
                                        else{                                                    // if times are the same no uplink is available
                                         Serial.println("uplink not available");
                                          uplinkAvailable = false;                                // no uplink available, set flag false
                                          uplinkCheckTime = millis();                             // start the timer from now
                                        }
                                    
                                      }
                                      oldValue = value;
                                     
                                      if (!uplinkAvailable && (millis() - uplinkCheckTime > uplinkCheckPeriod) ) {       // test to see if function should be called
                                        uplinkCheck();                                                                  // call uplink checking function
                                      }
                                    
                                    }
                                    
                                    /*-------------------start of functions--------------------------*/
                                    
                                    void receive(const MyMessage &message) {
                                      if (message.type == V_STATUS) {                                   // check to see if incoming message is for a switch
                                        switch (message.getCommand()) {                                 // message.getCommand will give us the command type of the incomming message
                                          case C_SET:                                                   //message is a set command  from controller to update relay state
                                            state = message.getBool();                                  // get the new state
                                            digitalWrite(RELAY_PIN, state ? RELAY_ON : RELAY_OFF);      // switch relay to new state
                                            send(msg.set(state));
                                            uplinkAvailable = true;                                     //  uplink established
                                            /*---- Write some debug info----*/
                                            Serial.print("Incoming change for sensor:");
                                            Serial.print(message.sensor);
                                            Serial.print(", New status: ");
                                            Serial.println(message.getBool());
                                            break;
                                          case C_REQ:                                               // message is a returning request from controller
                                            requestState = message.getBool();                       // update requestState with returning state
                                            break;
                                        }
                                      }
                                    }
                                    
                                    void uplinkCheck() {
                                        requestTime();
                                        wait (returnWait);                       // wait for time return.. this may need to be varied for your system
                                       if (oldTime != newTime){
                                         Serial.println("uplink re-established");
                                         request( CHILD_ID, V_STATUS);
                                         wait (returnWait);                        //wait needed to allow request to return from controller
                                        if (requestState != state) {              // check that controller is corectly showing the current relay state
                                          send(msg.set(state), false);            // notify controller of current state no ack
                                          uplinkAvailable = true;                 //  uplink established
                                          oldTime = newTime;
                                        }
                                      }
                                      uplinkCheckTime = millis();                // reset the checktime
                                      Serial.println("uplinkchecktime reset");
                                    }
                                    
                                    
                                    void receiveTime(unsigned long time)
                                    {
                                      if (firstStart){
                                        oldTime = time;
                                        newTime = time;
                                      }
                                      else{
                                      newTime = time;
                                    }
                                      Serial.print("time received---- " );
                                      Serial.println(time);
                                    }```
                                    pepsonP Offline
                                    pepsonP Offline
                                    pepson
                                    wrote on last edited by
                                    #50
                                    // Enable debug prints to serial monitor
                                    #define MY_DEBUG
                                    
                                    // Enable and select radio type attached
                                    #define MY_RADIO_RFM69
                                    #define MY_IS_RFM69HW
                                    //#define MY_RFM69_FREQUENCY RFM69_868MHZ
                                    #define RFM69_868MH
                                    #define MY_RFM69_NEW_DRIVER
                                    
                                    // #define MY_REPEATER_FEATURE
                                    
                                    //#define MY_RFM69_CSMA_LIMIT_DBM (-85)
                                    
                                    // uncomment if we want to manually assign an ID
                                    #define MY_NODE_ID 1
                                    
                                    #include <Bounce2.h>
                                    #include <MySensors.h>
                                    #include <SPI.h>
                                    
                                    #define BUTTON_UP_PIN 3  // Arduino Digital I/O pin number for up button
                                    #define BUTTON_DOWN_PIN 4  // Arduino Digital I/O pin number for down button
                                    //#define BUTTON_STOP_PIN 5  // Arduino Digital I/O pin number for stop button
                                    //#define RELAY_DIR_PIN 6  // Arduino Digital I/O pin number for direction relay
                                    //#define RELAY_POWER_PIN 7  // Arduino Digital I/O pin number for power relay
                                    #define RELAY_UP_PIN 5 
                                    #define RELAY_DOWN_PIN 6
                                    #define RELAY_ON 0
                                    #define RELAY_OFF 1
                                    //#define RELAY_DOWN 1
                                    //#define RELAY_UP 0
                                    #define DIRECTION_DOWN 0
                                    #define DIRECTION_UP 1
                                    #define SKETCH_NAME "Roleta w sypialni"
                                    #define SKETCH_VER "2.3"
                                    #define CHILD_ID_COVER 0   // sensor Id of the sensor child
                                    #define STATE_UP 100 // 100 is open - up
                                    #define STATE_DOWN 0 // 0 is closed - down
                                    //#define CHILD_ID_CALIBRATE 1   // sensor Id of the sensor child to calibrate
                                    #define CHILD_ID_SET 1   // sensor Id of the sensor child to init the roll time
                                    #define PRESENT_MESSAGE "Rolety dla Home Assistant"
                                    const int LEVELS = 100; //the number of levels
                                    float rollTime = 20.0; //the overall rolling time of the shutter
                                    const bool IS_ACK = false; //is to acknowlage
                                    static bool initial_state_sent = false;//for hass we need at list one state send at begining
                                    
                                    // debouncing parameters
                                    int value = 0;
                                    int oldValueUp = 0;
                                    int oldValueDown = 0;
                                    int oldValueStop = 0;
                                    //static unsigned long last_interrupt_time_up = 0;
                                    //static unsigned long last_interrupt_time_down = 0;
                                    //static unsigned long debounce_time = 200;
                                    
                                    Bounce debouncerUp = Bounce();
                                    Bounce debouncerDown = Bounce();
                                    Bounce debouncerStop = Bounce();
                                    
                                    // shutter position parameters
                                    float timeOneLevel = rollTime / LEVELS;
                                    int requestedShutterLevel = 0;
                                    int currentShutterLevel = 0;
                                    unsigned long lastLevelTime = 0;
                                    bool isMoving = false;
                                    int directionUpDown;
                                    bool calibrateDown;
                                    bool calibrateUp;
                                    unsigned long calibrationStartTime;
                                    float calibrationTime = 5.0;
                                    bool calibratedDown;
                                    bool calibratedUp;
                                    
                                    enum CoverState {
                                      STOP,
                                      UP, // Window covering. Up.
                                      DOWN, // Window covering. Down.
                                    };
                                    
                                    static int coverState = STOP;
                                    
                                    MyMessage msgUp(CHILD_ID_COVER, V_UP);
                                    MyMessage msgDown(CHILD_ID_COVER, V_DOWN);
                                    MyMessage msgStop(CHILD_ID_COVER, V_STOP);
                                    MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE);
                                    //MyMessage msgCode(CHILD_ID_SET, V_IR_SEND);
                                    
                                    void sendState() {
                                      // Send current state and status to gateway.
                                    //  send(msgUp.set(coverState == UP));
                                    //  send(msgDown.set(coverState == DOWN));
                                    //  send(msgStop.set(coverState == STOP));
                                      send(msgPercentage.set(currentShutterLevel));
                                    }
                                    
                                    void shuttersUp(void) {
                                      #ifdef MY_DEBUG
                                      Serial.println("Shutters going up");
                                      #endif
                                      if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) {
                                        digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                        wait(50);
                                      }
                                      digitalWrite(RELAY_UP_PIN, RELAY_ON);
                                    
                                      directionUpDown = DIRECTION_UP;
                                      isMoving = true;
                                      coverState = UP;
                                      sendState();
                                    }
                                    
                                    void shuttersDown(void) {
                                      #ifdef MY_DEBUG
                                      Serial.println("Shutters going down");
                                      #endif
                                      if (digitalRead(RELAY_UP_PIN) == RELAY_ON) {
                                        digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                        wait(50);
                                      }
                                      digitalWrite(RELAY_DOWN_PIN, RELAY_ON);
                                    
                                      directionUpDown = DIRECTION_DOWN;
                                      isMoving = true;
                                      coverState = DOWN;
                                      sendState();
                                    }
                                    
                                    void shuttersHalt(void) {
                                    #ifdef MY_DEBUG
                                      Serial.println("Shutters halted");
                                    #endif
                                      digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                      digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                    
                                      isMoving = false;
                                      requestedShutterLevel = currentShutterLevel;
                                    #ifdef MY_DEBUG
                                      Serial.println("saving state to: ");
                                      Serial.println(String(currentShutterLevel));
                                    #endif
                                      saveState(CHILD_ID_COVER, currentShutterLevel);
                                      coverState = STOP;
                                      sendState();
                                    }
                                    
                                    void changeShuttersLevel(int level) {
                                      int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN;
                                      if (isMoving && dir != directionUpDown) {
                                        shuttersHalt();
                                      }
                                      requestedShutterLevel = level;
                                    }
                                    
                                    void initShutters() {
                                    #ifdef MY_DEBUG
                                      Serial.println("Init Cover");
                                    #endif
                                      shuttersUp();
                                      wait((rollTime + timeOneLevel * LEVELS) * 1000);
                                      currentShutterLevel = STATE_UP;
                                      requestedShutterLevel = currentShutterLevel;
                                    }
                                    
                                    void receive(const MyMessage &message) {
                                    #ifdef MY_DEBUG
                                      Serial.println("recieved incomming message");
                                      Serial.println("Recieved message for sensor: ");
                                      Serial.println(String(message.sensor));
                                      Serial.println("Recieved message with type: ");
                                      Serial.println(String(message.type));
                                    #endif
                                      if (message.sensor == CHILD_ID_COVER) {
                                        switch (message.type) {
                                          case V_UP:
                                            //Serial.println(", New status: V_UP");
                                            changeShuttersLevel(STATE_UP);
                                            //state = UP;
                                            //sendState();
                                            break;
                                    
                                          case V_DOWN:
                                            //Serial.println(", New status: V_DOWN");
                                            changeShuttersLevel(STATE_DOWN);
                                            //state = DOWN;
                                            //sendState();
                                            break;
                                    
                                          case V_STOP:
                                            //Serial.println(", New status: V_STOP");
                                            shuttersHalt();
                                            //state = IDLE;
                                            //sendState();
                                            break;
                                    
                                          case V_PERCENTAGE:
                                            //Serial.println(", New status: V_PERCENTAGE");
                                            //          if (!initial_state_sent) {
                                            //            #ifdef MY_DEBUG
                                            //            Serial.println("Receiving initial value from controller");
                                            //            #endif
                                            //            initial_state_sent = true;
                                            //          }
                                            int per = message.getInt();
                                            if (per > STATE_UP) {
                                              per = STATE_UP;
                                            }
                                            changeShuttersLevel(per);
                                            //InitShutters(message.getInt());//send value < 0 or > 100 to calibrate
                                            //sendState();
                                            break;
                                        }
                                      } 
                                    else if (message.sensor ==  CHILD_ID_SET) {
                                    
                                        if (message.type == V_VAR1) {
                                          #ifdef MY_DEBUG
                                          Serial.println(", New status: V_VAR1, with payload: ");
                                          #endif      
                                          String strRollTime = message.getString();
                                          rollTime = strRollTime.toFloat();
                                          #ifdef MY_DEBUG
                                          Serial.println("rolltime value: ");
                                          Serial.println(String(rollTime));
                                          #endif
                                          saveState(CHILD_ID_SET, rollTime);
                                        }
                                      }
                                    #ifdef MY_DEBUG
                                      Serial.println("exiting incoming message");
                                    #endif
                                      return;
                                    }
                                    
                                    void before() {
                                    
                                      // Setup the button
                                      pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
                                      // Activate internal pull-up
                                    //  digitalWrite(BUTTON_UP_PIN, HIGH);
                                      //  attachInterrupt(digitalPinToInterrupt(BUTTON_UP_PIN), upButtonPress, FALLING);
                                    
                                      pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
                                      // Activate internal pull-up
                                    //  digitalWrite(BUTTON_DOWN_PIN, HIGH);
                                      //  attachInterrupt(digitalPinToInterrupt(BUTTON_DOWN_PIN), downButtonPress, FALLING);
                                    
                                    //  pinMode(BUTTON_STOP_PIN, INPUT_PULLUP);
                                      // Activate internal pull-up
                                    //  digitalWrite(BUTTON_STOP_PIN, HIGH);
                                    
                                      // After setting up the button, setup debouncer
                                      debouncerUp.attach(BUTTON_UP_PIN);
                                      debouncerUp.interval(5);
                                      // After setting up the button, setup debouncer
                                      debouncerDown.attach(BUTTON_DOWN_PIN);
                                      debouncerDown.interval(5);
                                      // After setting up the button, setup debouncer
                                    //  debouncerStop.attach(BUTTON_STOP_PIN);
                                    //  debouncerStop.interval(5);
                                    
                                      // Make sure relays are off when starting up
                                      digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                      // Then set relay pins in output mode
                                      pinMode(RELAY_UP_PIN, OUTPUT);
                                    
                                      // Make sure relays are off when starting up
                                      digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                      // Then set relay pins in output mode
                                      pinMode(RELAY_DOWN_PIN, OUTPUT);
                                    }
                                    
                                    void presentation() {
                                      // Send the sketch version information to the gateway and Controller
                                      sendSketchInfo(SKETCH_NAME, SKETCH_VER);
                                      // Register all sensors to gw (they will be created as child devices)
                                      present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK);
                                      // present(CHILD_ID_SET, S_CUSTOM);
                                    }
                                    
                                    void setup(void) {
                                      //set up roll time if the saved value is not 255
                                      #ifdef MY_DEBUG
                                      Serial.println("getting rolltime from eeprom: ");
                                      #endif
                                      float tmpRollTime = loadState(CHILD_ID_SET);
                                      if (tmpRollTime != 0xff) {
                                        rollTime = tmpRollTime;
                                      }
                                      #ifdef MY_DEBUG
                                      Serial.println(String(rollTime));
                                      #endif
                                      
                                      int state = loadState(CHILD_ID_COVER);
                                      
                                      #ifdef MY_DEBUG
                                      Serial.println("getting state from eeprom: ");
                                      Serial.println(String(state));
                                      #endif
                                      
                                    //  if (state == 0xff) {
                                    //    initShutters();
                                    //  } else {
                                        currentShutterLevel = state;
                                        requestedShutterLevel = state;
                                    //  }
                                    }
                                    
                                    void loop(void) {
                                      if (!initial_state_sent) {
                                    #ifdef MY_DEBUG
                                        Serial.println("Sending initial value");
                                    #endif
                                        sendState();
                                        
                                       // send(msgCode.set('20.0'));
                                        //    #ifdef MY_DEBUG
                                        //    Serial.println("Requesting initial value from controller");
                                        //    #endif
                                        //    request(CHILD_ID_COVER, V_PERCENTAGE);
                                        //    wait(2000, C_SET, V_PERCENTAGE);
                                        initial_state_sent = true;
                                      }
                                    
                                      debouncerUp.update();
                                      value = debouncerUp.read();
                                      if (value == 0 && value != oldValueUp) {
                                        if(isMoving){
                                          shuttersHalt();
                                        }  
                                        else{
                                        calibrateUp = false;
                                        calibratedUp = false;
                                        changeShuttersLevel(STATE_UP);
                                        }
                                        //state = UP;
                                        //sendState();
                                      }
                                      oldValueUp = value;
                                    
                                      debouncerDown.update();
                                      value = debouncerDown.read();
                                      if (value == 0 && value != oldValueDown) {
                                        if(isMoving){
                                          shuttersHalt();
                                        }  
                                        else{
                                        calibrateDown = false;
                                        calibratedDown = false;
                                        changeShuttersLevel(STATE_DOWN);
                                        }    
                                        //state = DOWN;
                                        //sendState();
                                      }
                                      oldValueDown = value;
                                    
                                    /*  debouncerStop.update();
                                      value = debouncerStop.read();
                                      if (value == 0 && value != oldValueStop) {
                                        shuttersHalt();
                                        //state = IDLE;
                                        //sendState();
                                      }
                                      oldValueStop = value;
                                    */
                                      if(currentShutterLevel != 100)
                                      {
                                        calibrateUp = false;
                                        calibratedUp = false;
                                      }
                                      if(currentShutterLevel != 0)
                                      {
                                        calibrateDown = false;
                                        calibratedDown = false;
                                      }
                                      
                                      if (isMoving) 
                                      {
                                        unsigned long _now = millis();
                                        if (_now - lastLevelTime >= timeOneLevel * 1000) {
                                          if (directionUpDown == DIRECTION_UP) {
                                            currentShutterLevel += 1;
                                          } else {
                                            currentShutterLevel -= 1;
                                          }
                                          currentShutterLevel = constrain(currentShutterLevel, 0, 100);
                                          #ifdef MY_DEBUG
                                          Serial.println(String(requestedShutterLevel));
                                          Serial.println(String(currentShutterLevel));
                                          #endif
                                          lastLevelTime = millis();
                                          send(msgPercentage.set(currentShutterLevel));
                                        }
                                        if (currentShutterLevel == requestedShutterLevel) 
                                        {
                                          if(currentShutterLevel == 0 && !calibratedDown)
                                          {
                                            if(calibrateDown == false)
                                            {
                                              calibrateDown = true;
                                              calibratedDown = false;
                                              calibrationStartTime = _now;
                                            }
                                            else 
                                            {
                                              if(calibratedDown == false)
                                              {
                                                if (_now - calibrationStartTime >= calibrationTime * 1000)
                                                {
                                                 calibratedDown = true;
                                                }
                                              }
                                            }
                                          }
                                          else if (currentShutterLevel == 100 && !calibratedUp)
                                          {
                                            if(calibrateUp == false)
                                            {
                                              calibrateUp = true;
                                              calibratedUp = false;
                                              calibrationStartTime = _now;
                                            }
                                            else 
                                            {
                                              if(calibratedUp == false)
                                              {
                                                if (_now - calibrationStartTime >= calibrationTime * 1000)
                                                {
                                                 calibratedUp = true;
                                                }
                                              }
                                            }
                                          }
                                          else
                                          {
                                            shuttersHalt();
                                          }
                                        }
                                      } 
                                      else 
                                      {
                                        if (requestedShutterLevel != currentShutterLevel) 
                                        {
                                          if (requestedShutterLevel > currentShutterLevel) {
                                            shuttersUp();
                                          }
                                          else {
                                            shuttersDown();
                                          }
                                          lastLevelTime = millis();
                                        }
                                      }
                                    }
                                    
                                    pepsonP 1 Reply Last reply
                                    0
                                    • pepsonP pepson
                                      // Enable debug prints to serial monitor
                                      #define MY_DEBUG
                                      
                                      // Enable and select radio type attached
                                      #define MY_RADIO_RFM69
                                      #define MY_IS_RFM69HW
                                      //#define MY_RFM69_FREQUENCY RFM69_868MHZ
                                      #define RFM69_868MH
                                      #define MY_RFM69_NEW_DRIVER
                                      
                                      // #define MY_REPEATER_FEATURE
                                      
                                      //#define MY_RFM69_CSMA_LIMIT_DBM (-85)
                                      
                                      // uncomment if we want to manually assign an ID
                                      #define MY_NODE_ID 1
                                      
                                      #include <Bounce2.h>
                                      #include <MySensors.h>
                                      #include <SPI.h>
                                      
                                      #define BUTTON_UP_PIN 3  // Arduino Digital I/O pin number for up button
                                      #define BUTTON_DOWN_PIN 4  // Arduino Digital I/O pin number for down button
                                      //#define BUTTON_STOP_PIN 5  // Arduino Digital I/O pin number for stop button
                                      //#define RELAY_DIR_PIN 6  // Arduino Digital I/O pin number for direction relay
                                      //#define RELAY_POWER_PIN 7  // Arduino Digital I/O pin number for power relay
                                      #define RELAY_UP_PIN 5 
                                      #define RELAY_DOWN_PIN 6
                                      #define RELAY_ON 0
                                      #define RELAY_OFF 1
                                      //#define RELAY_DOWN 1
                                      //#define RELAY_UP 0
                                      #define DIRECTION_DOWN 0
                                      #define DIRECTION_UP 1
                                      #define SKETCH_NAME "Roleta w sypialni"
                                      #define SKETCH_VER "2.3"
                                      #define CHILD_ID_COVER 0   // sensor Id of the sensor child
                                      #define STATE_UP 100 // 100 is open - up
                                      #define STATE_DOWN 0 // 0 is closed - down
                                      //#define CHILD_ID_CALIBRATE 1   // sensor Id of the sensor child to calibrate
                                      #define CHILD_ID_SET 1   // sensor Id of the sensor child to init the roll time
                                      #define PRESENT_MESSAGE "Rolety dla Home Assistant"
                                      const int LEVELS = 100; //the number of levels
                                      float rollTime = 20.0; //the overall rolling time of the shutter
                                      const bool IS_ACK = false; //is to acknowlage
                                      static bool initial_state_sent = false;//for hass we need at list one state send at begining
                                      
                                      // debouncing parameters
                                      int value = 0;
                                      int oldValueUp = 0;
                                      int oldValueDown = 0;
                                      int oldValueStop = 0;
                                      //static unsigned long last_interrupt_time_up = 0;
                                      //static unsigned long last_interrupt_time_down = 0;
                                      //static unsigned long debounce_time = 200;
                                      
                                      Bounce debouncerUp = Bounce();
                                      Bounce debouncerDown = Bounce();
                                      Bounce debouncerStop = Bounce();
                                      
                                      // shutter position parameters
                                      float timeOneLevel = rollTime / LEVELS;
                                      int requestedShutterLevel = 0;
                                      int currentShutterLevel = 0;
                                      unsigned long lastLevelTime = 0;
                                      bool isMoving = false;
                                      int directionUpDown;
                                      bool calibrateDown;
                                      bool calibrateUp;
                                      unsigned long calibrationStartTime;
                                      float calibrationTime = 5.0;
                                      bool calibratedDown;
                                      bool calibratedUp;
                                      
                                      enum CoverState {
                                        STOP,
                                        UP, // Window covering. Up.
                                        DOWN, // Window covering. Down.
                                      };
                                      
                                      static int coverState = STOP;
                                      
                                      MyMessage msgUp(CHILD_ID_COVER, V_UP);
                                      MyMessage msgDown(CHILD_ID_COVER, V_DOWN);
                                      MyMessage msgStop(CHILD_ID_COVER, V_STOP);
                                      MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE);
                                      //MyMessage msgCode(CHILD_ID_SET, V_IR_SEND);
                                      
                                      void sendState() {
                                        // Send current state and status to gateway.
                                      //  send(msgUp.set(coverState == UP));
                                      //  send(msgDown.set(coverState == DOWN));
                                      //  send(msgStop.set(coverState == STOP));
                                        send(msgPercentage.set(currentShutterLevel));
                                      }
                                      
                                      void shuttersUp(void) {
                                        #ifdef MY_DEBUG
                                        Serial.println("Shutters going up");
                                        #endif
                                        if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) {
                                          digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                          wait(50);
                                        }
                                        digitalWrite(RELAY_UP_PIN, RELAY_ON);
                                      
                                        directionUpDown = DIRECTION_UP;
                                        isMoving = true;
                                        coverState = UP;
                                        sendState();
                                      }
                                      
                                      void shuttersDown(void) {
                                        #ifdef MY_DEBUG
                                        Serial.println("Shutters going down");
                                        #endif
                                        if (digitalRead(RELAY_UP_PIN) == RELAY_ON) {
                                          digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                          wait(50);
                                        }
                                        digitalWrite(RELAY_DOWN_PIN, RELAY_ON);
                                      
                                        directionUpDown = DIRECTION_DOWN;
                                        isMoving = true;
                                        coverState = DOWN;
                                        sendState();
                                      }
                                      
                                      void shuttersHalt(void) {
                                      #ifdef MY_DEBUG
                                        Serial.println("Shutters halted");
                                      #endif
                                        digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                        digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                      
                                        isMoving = false;
                                        requestedShutterLevel = currentShutterLevel;
                                      #ifdef MY_DEBUG
                                        Serial.println("saving state to: ");
                                        Serial.println(String(currentShutterLevel));
                                      #endif
                                        saveState(CHILD_ID_COVER, currentShutterLevel);
                                        coverState = STOP;
                                        sendState();
                                      }
                                      
                                      void changeShuttersLevel(int level) {
                                        int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN;
                                        if (isMoving && dir != directionUpDown) {
                                          shuttersHalt();
                                        }
                                        requestedShutterLevel = level;
                                      }
                                      
                                      void initShutters() {
                                      #ifdef MY_DEBUG
                                        Serial.println("Init Cover");
                                      #endif
                                        shuttersUp();
                                        wait((rollTime + timeOneLevel * LEVELS) * 1000);
                                        currentShutterLevel = STATE_UP;
                                        requestedShutterLevel = currentShutterLevel;
                                      }
                                      
                                      void receive(const MyMessage &message) {
                                      #ifdef MY_DEBUG
                                        Serial.println("recieved incomming message");
                                        Serial.println("Recieved message for sensor: ");
                                        Serial.println(String(message.sensor));
                                        Serial.println("Recieved message with type: ");
                                        Serial.println(String(message.type));
                                      #endif
                                        if (message.sensor == CHILD_ID_COVER) {
                                          switch (message.type) {
                                            case V_UP:
                                              //Serial.println(", New status: V_UP");
                                              changeShuttersLevel(STATE_UP);
                                              //state = UP;
                                              //sendState();
                                              break;
                                      
                                            case V_DOWN:
                                              //Serial.println(", New status: V_DOWN");
                                              changeShuttersLevel(STATE_DOWN);
                                              //state = DOWN;
                                              //sendState();
                                              break;
                                      
                                            case V_STOP:
                                              //Serial.println(", New status: V_STOP");
                                              shuttersHalt();
                                              //state = IDLE;
                                              //sendState();
                                              break;
                                      
                                            case V_PERCENTAGE:
                                              //Serial.println(", New status: V_PERCENTAGE");
                                              //          if (!initial_state_sent) {
                                              //            #ifdef MY_DEBUG
                                              //            Serial.println("Receiving initial value from controller");
                                              //            #endif
                                              //            initial_state_sent = true;
                                              //          }
                                              int per = message.getInt();
                                              if (per > STATE_UP) {
                                                per = STATE_UP;
                                              }
                                              changeShuttersLevel(per);
                                              //InitShutters(message.getInt());//send value < 0 or > 100 to calibrate
                                              //sendState();
                                              break;
                                          }
                                        } 
                                      else if (message.sensor ==  CHILD_ID_SET) {
                                      
                                          if (message.type == V_VAR1) {
                                            #ifdef MY_DEBUG
                                            Serial.println(", New status: V_VAR1, with payload: ");
                                            #endif      
                                            String strRollTime = message.getString();
                                            rollTime = strRollTime.toFloat();
                                            #ifdef MY_DEBUG
                                            Serial.println("rolltime value: ");
                                            Serial.println(String(rollTime));
                                            #endif
                                            saveState(CHILD_ID_SET, rollTime);
                                          }
                                        }
                                      #ifdef MY_DEBUG
                                        Serial.println("exiting incoming message");
                                      #endif
                                        return;
                                      }
                                      
                                      void before() {
                                      
                                        // Setup the button
                                        pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
                                        // Activate internal pull-up
                                      //  digitalWrite(BUTTON_UP_PIN, HIGH);
                                        //  attachInterrupt(digitalPinToInterrupt(BUTTON_UP_PIN), upButtonPress, FALLING);
                                      
                                        pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
                                        // Activate internal pull-up
                                      //  digitalWrite(BUTTON_DOWN_PIN, HIGH);
                                        //  attachInterrupt(digitalPinToInterrupt(BUTTON_DOWN_PIN), downButtonPress, FALLING);
                                      
                                      //  pinMode(BUTTON_STOP_PIN, INPUT_PULLUP);
                                        // Activate internal pull-up
                                      //  digitalWrite(BUTTON_STOP_PIN, HIGH);
                                      
                                        // After setting up the button, setup debouncer
                                        debouncerUp.attach(BUTTON_UP_PIN);
                                        debouncerUp.interval(5);
                                        // After setting up the button, setup debouncer
                                        debouncerDown.attach(BUTTON_DOWN_PIN);
                                        debouncerDown.interval(5);
                                        // After setting up the button, setup debouncer
                                      //  debouncerStop.attach(BUTTON_STOP_PIN);
                                      //  debouncerStop.interval(5);
                                      
                                        // Make sure relays are off when starting up
                                        digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                        // Then set relay pins in output mode
                                        pinMode(RELAY_UP_PIN, OUTPUT);
                                      
                                        // Make sure relays are off when starting up
                                        digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                        // Then set relay pins in output mode
                                        pinMode(RELAY_DOWN_PIN, OUTPUT);
                                      }
                                      
                                      void presentation() {
                                        // Send the sketch version information to the gateway and Controller
                                        sendSketchInfo(SKETCH_NAME, SKETCH_VER);
                                        // Register all sensors to gw (they will be created as child devices)
                                        present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK);
                                        // present(CHILD_ID_SET, S_CUSTOM);
                                      }
                                      
                                      void setup(void) {
                                        //set up roll time if the saved value is not 255
                                        #ifdef MY_DEBUG
                                        Serial.println("getting rolltime from eeprom: ");
                                        #endif
                                        float tmpRollTime = loadState(CHILD_ID_SET);
                                        if (tmpRollTime != 0xff) {
                                          rollTime = tmpRollTime;
                                        }
                                        #ifdef MY_DEBUG
                                        Serial.println(String(rollTime));
                                        #endif
                                        
                                        int state = loadState(CHILD_ID_COVER);
                                        
                                        #ifdef MY_DEBUG
                                        Serial.println("getting state from eeprom: ");
                                        Serial.println(String(state));
                                        #endif
                                        
                                      //  if (state == 0xff) {
                                      //    initShutters();
                                      //  } else {
                                          currentShutterLevel = state;
                                          requestedShutterLevel = state;
                                      //  }
                                      }
                                      
                                      void loop(void) {
                                        if (!initial_state_sent) {
                                      #ifdef MY_DEBUG
                                          Serial.println("Sending initial value");
                                      #endif
                                          sendState();
                                          
                                         // send(msgCode.set('20.0'));
                                          //    #ifdef MY_DEBUG
                                          //    Serial.println("Requesting initial value from controller");
                                          //    #endif
                                          //    request(CHILD_ID_COVER, V_PERCENTAGE);
                                          //    wait(2000, C_SET, V_PERCENTAGE);
                                          initial_state_sent = true;
                                        }
                                      
                                        debouncerUp.update();
                                        value = debouncerUp.read();
                                        if (value == 0 && value != oldValueUp) {
                                          if(isMoving){
                                            shuttersHalt();
                                          }  
                                          else{
                                          calibrateUp = false;
                                          calibratedUp = false;
                                          changeShuttersLevel(STATE_UP);
                                          }
                                          //state = UP;
                                          //sendState();
                                        }
                                        oldValueUp = value;
                                      
                                        debouncerDown.update();
                                        value = debouncerDown.read();
                                        if (value == 0 && value != oldValueDown) {
                                          if(isMoving){
                                            shuttersHalt();
                                          }  
                                          else{
                                          calibrateDown = false;
                                          calibratedDown = false;
                                          changeShuttersLevel(STATE_DOWN);
                                          }    
                                          //state = DOWN;
                                          //sendState();
                                        }
                                        oldValueDown = value;
                                      
                                      /*  debouncerStop.update();
                                        value = debouncerStop.read();
                                        if (value == 0 && value != oldValueStop) {
                                          shuttersHalt();
                                          //state = IDLE;
                                          //sendState();
                                        }
                                        oldValueStop = value;
                                      */
                                        if(currentShutterLevel != 100)
                                        {
                                          calibrateUp = false;
                                          calibratedUp = false;
                                        }
                                        if(currentShutterLevel != 0)
                                        {
                                          calibrateDown = false;
                                          calibratedDown = false;
                                        }
                                        
                                        if (isMoving) 
                                        {
                                          unsigned long _now = millis();
                                          if (_now - lastLevelTime >= timeOneLevel * 1000) {
                                            if (directionUpDown == DIRECTION_UP) {
                                              currentShutterLevel += 1;
                                            } else {
                                              currentShutterLevel -= 1;
                                            }
                                            currentShutterLevel = constrain(currentShutterLevel, 0, 100);
                                            #ifdef MY_DEBUG
                                            Serial.println(String(requestedShutterLevel));
                                            Serial.println(String(currentShutterLevel));
                                            #endif
                                            lastLevelTime = millis();
                                            send(msgPercentage.set(currentShutterLevel));
                                          }
                                          if (currentShutterLevel == requestedShutterLevel) 
                                          {
                                            if(currentShutterLevel == 0 && !calibratedDown)
                                            {
                                              if(calibrateDown == false)
                                              {
                                                calibrateDown = true;
                                                calibratedDown = false;
                                                calibrationStartTime = _now;
                                              }
                                              else 
                                              {
                                                if(calibratedDown == false)
                                                {
                                                  if (_now - calibrationStartTime >= calibrationTime * 1000)
                                                  {
                                                   calibratedDown = true;
                                                  }
                                                }
                                              }
                                            }
                                            else if (currentShutterLevel == 100 && !calibratedUp)
                                            {
                                              if(calibrateUp == false)
                                              {
                                                calibrateUp = true;
                                                calibratedUp = false;
                                                calibrationStartTime = _now;
                                              }
                                              else 
                                              {
                                                if(calibratedUp == false)
                                                {
                                                  if (_now - calibrationStartTime >= calibrationTime * 1000)
                                                  {
                                                   calibratedUp = true;
                                                  }
                                                }
                                              }
                                            }
                                            else
                                            {
                                              shuttersHalt();
                                            }
                                          }
                                        } 
                                        else 
                                        {
                                          if (requestedShutterLevel != currentShutterLevel) 
                                          {
                                            if (requestedShutterLevel > currentShutterLevel) {
                                              shuttersUp();
                                            }
                                            else {
                                              shuttersDown();
                                            }
                                            lastLevelTime = millis();
                                          }
                                        }
                                      }
                                      
                                      pepsonP Offline
                                      pepsonP Offline
                                      pepson
                                      wrote on last edited by
                                      #51

                                      Finally
                                      In my opinion on MySensors 2.2.0 all my sketches (switch relay and cover ) works better. With no problem. NO PROBLEM.
                                      Cover works perfect and switch works perfect without any timeout and delay. ANd all node works without REPEATER.
                                      My opinion is that in version 2.3.0 something not working correct with radio RFM69HW.
                                      Maybe for sensors which send data from time to time is ok , but for cover which transfer data when cover is roll, it is problem... and gateway can not recived all data when node send position cover. Maybe developer read this thread and can do any changes to correct it.

                                      scalzS S 2 Replies Last reply
                                      0
                                      • M mickecarlsson

                                        You only need repeater fi you have a node far away that can’t reach the gateway, then you add repeater on a node nearer the gateway.
                                        See here: MySensors Network
                                        And if the node has repeater defined it must allways have power and no Sleep.
                                        Sorry, I can’t test the sketch.

                                        pepsonP Offline
                                        pepsonP Offline
                                        pepson
                                        wrote on last edited by
                                        #52

                                        @mickecarlsson

                                        ANd tell me how you connect Gateway to your Domoticz Controller ? What path to usb or serial you setup in Domoticz ?

                                        1 Reply Last reply
                                        0
                                        • pepsonP pepson

                                          Finally
                                          In my opinion on MySensors 2.2.0 all my sketches (switch relay and cover ) works better. With no problem. NO PROBLEM.
                                          Cover works perfect and switch works perfect without any timeout and delay. ANd all node works without REPEATER.
                                          My opinion is that in version 2.3.0 something not working correct with radio RFM69HW.
                                          Maybe for sensors which send data from time to time is ok , but for cover which transfer data when cover is roll, it is problem... and gateway can not recived all data when node send position cover. Maybe developer read this thread and can do any changes to correct it.

                                          scalzS Offline
                                          scalzS Offline
                                          scalz
                                          Hardware Contributor
                                          wrote on last edited by scalz
                                          #53

                                          @pepson said in RFM69 new driver delay:

                                          My opinion is that in version 2.3.0 something not working correct with radio RFM69HW.
                                          Maybe for sensors which send data from time to time is ok , but for cover which transfer data when cover is roll, it is problem... and gateway can not recived all data when node send position cover. Maybe developer read this thread and can do any changes to correct it.

                                          Like I said, we will take a look as soon as we get time. For the moment, busy (at least on my side). And we're a few, using rfm69.
                                          So if 2.2 fixes your issue, it can be a good idea.

                                          pepsonP 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          12

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular