[Solved] Function repeater not working



  • Help, function repeater not working
    Vera lite fw 1.7.830
    GW Arduino nano serial - MySensors Arduino Library v2.0.0 master
    node/repeater Arduino nano MySensors Arduino Library v2.0.0 master

    code node/repeater ID=3

    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    // Enable repeater functionality for this node
    #define MY_REPEATER_FEATURE
    

    node ID = 4 and ID = 6 long distance and worked perfectly through the library 1.5.4 and repeater ID = 3

    After the transition to version 2, these two nodes fallen off

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=3)
    TSM:FPAR
    TSP:MSG:SEND 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 0-0-3 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=3)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 3-3-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:MSG:READ 0-0-3 s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSP:MSG:PONG RECV (hops=1)
    TSP:CHKUPL:OK
    TSM:UPL:OK
    TSM:READY
    Setup: 
    !TSP:MSG:SEND 3-3-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=fail:0100
    TSP:MSG:SEND 3-3-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=1,st=ok:2.0.0
    TSP:MSG:SEND 3-3-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
    TSP:MSG:READ 0-0-3 s=255,c=3,t=6,pt=0,l=1,sg=0:M
    TSP:MSG:SEND 3-3-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=ok:Alarm Sensor
    TSP:MSG:SEND 3-3-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0
    TSP:MSG:SEND 3-3-0-0 s=1,c=0,t=1,pt=0,l=0,sg=0,ft=0,st=ok:
    TSP:MSG:SEND 3-3-0-0 s=2,c=0,t=1,pt=0,l=0,sg=0,ft=0,st=ok:
    TSP:MSG:SEND 3-3-0-0 s=3,c=0,t=1,pt=0,l=0,sg=0,ft=0,st=ok:
    TSP:MSG:SEND 3-3-0-0 s=4,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    TSP:MSG:SEND 3-3-0-0 s=5,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    Request registration...
    TSP:MSG:SEND 3-3-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
    TSP:MSG:READ 0-0-3 s=255,c=3,t=27,pt=1,l=1,sg=0:1
    Node registration=1
    Init complete, id=3, parent=0, distance=1, registration=1
    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 6-6-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 6-6-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:SEND 3-3-0-0 s=3,c=1,t=16,pt=0,l=1,sg=0,ft=0,st=ok:0
    

  • Admin

    @Daemon-D said:

    Starting sensor (RNNNA-, 2.0.0)
    

    Node 3 is not defined as repeater:
    RNNNA- indicates normal node operation. This also explains, why node 3 does not reply to I_FIND_PARENT requests:

    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 6-6-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 6-6-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    TSP:MSG:BC
    

    Please double check and upload node 3 sketch if problem persists.



  • @Daemon-D said:

    // Enable repeater functionality for this node
    #define MY_REPEATER_FEATURE
    

    that is enough to enable the repeater?


  • Admin

    @Daemon-D Please post the full repeater sketch



  • @tekka

    #include "CyberLib.h" //Библиотека от Cyber-Place.ru
    #include <SPI.h>
    #include <Bounce2.h>
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    // Enable repeater functionality for this node
    #define MY_REPEATER_FEATURE
    
    #define ConsoleComm 0
    #define TIME_READ_INPUT_SEPIC_SIGN 1000 //время снятия показаний с входов
    #define TIME_SEND_VERA_SEPTIC 66000 //время для отправки данных септика
    #define TIME_SEND_VERA_SIGN 11000 //время для отправки данных сигнализации
    #define TIME_SEND_VERA_220 53100 //время для отправки данных 220
    #define RELAY_SIGN  6  // pin relay сигнализации
    #define DIGITAL_INPUT_SEPTIC 7   // The digital input D7 септик
    #define DIGITAL_INPUT_SIGN 8   // The digital input D8 сигнализация
    #define INTERRUPT_220V 3   // пин датчика наличия 220
    #define CHILD_VERA_SEPTIC 1   // Id Vera вирутального сенсора ошибки септика
    #define CHILD_VERA_SIGN 2   // Id  Vera вирутального сенсора срабатывания сигнализации 
    #define CHILD_VERA_220 3 // ID Vera вирутального сенсора наличия 220
    #define CHILD_VERA_RELAY_SIGN 4 // Id Vera реле сигнализации 
    #define CHILD_VERA_ROLLING 5 // Id Vera  рольставни
    #define RELAY_ON 1  // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
    
    //MySensor gw; // MySensor
    Bounce debouncerInputSeptic = Bounce();
    Bounce debouncerInputSign = Bounce();
    
    MyMessage errorMsgSeptic(CHILD_VERA_SEPTIC, V_TRIPPED); // виртуальный сенсор ошибки септика
    MyMessage errorMsgSign(CHILD_VERA_SIGN, V_TRIPPED); // виртуальный сенсор сигнализации
    MyMessage errorMsg220(CHILD_VERA_220, V_TRIPPED); // виртуальный сенсор 220
    
    int powerlostint; // храним нарастающим итогом переходы 0 по 220
    bool powerlost, valueSeptic, valueSign;
    unsigned long currentTime;
    unsigned long loopTimeRead, loopTimeSeptic, loopTimeSign, loopTime220;
    Metro timer_read = Metro(TIME_READ_INPUT_SEPIC_SIGN); // храним время опросов датчиков входов
    Metro time_send_septic = Metro(TIME_SEND_VERA_SEPTIC); // храним время отправки данных на Vera о септике
    Metro time_send_sign = Metro(TIME_SEND_VERA_SIGN); // храним время отправки данных на Vera о сигнализации
    Metro time_send_220 = Metro(TIME_SEND_VERA_220); // храним время отправки данных на Vera о 220
    
    void presentation()  {
    
     // Initialize library and add callback for incoming messages
      //  gw.begin(incomingMessage, AUTO, true); //repeater node
    
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Alarm Sensor", "1.0");
        present(CHILD_VERA_SEPTIC, S_MOTION); //alarm D7
        present(CHILD_VERA_SIGN, S_MOTION); //alarm D8
        present(CHILD_VERA_220, S_MOTION); //alarm 220
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_VERA_RELAY_SIGN, S_LIGHT); //relay D6
        present(CHILD_VERA_ROLLING, S_LIGHT); // вирутальное реле для рольставень
    
    }
    
    //********************обработчики прерываний*******************************
    void  detect_up() { // обработка внешнего прерывания. Сработает по переднему фронту
    
        powerlostint++; // если 50 раз в секунду получаем прерывание, увеличиваем powerlostint
    }
    
    
    //****************************SETUP*********************************************
    
    
    void setup() {
    
        UART_Init(115200);//инициализация последовательного порта
    #if ConsoleComm
        Serial << "Setup: " <<  endl;
    #endif
    
      
        // Then set relay pins in output mode
        pinMode(RELAY_SIGN, OUTPUT);
        // Set relay to last known state (using eeprom storage)
        D4_Out; //Настраиваем пин D4 на выход для управления рольставнями
        pinMode(DIGITAL_INPUT_SEPTIC, INPUT);  // определяем DIGITAL_INPUT_SEPTIC как вход
        digitalWrite(DIGITAL_INPUT_SEPTIC, HIGH);     // подключить подтягивающий резистор
        pinMode(DIGITAL_INPUT_SIGN, INPUT);  // определяем IGITAL_INPUT_SENSOR_D7 как вход
        digitalWrite(DIGITAL_INPUT_SIGN, HIGH);     // подключить подтягивающий резистор
    
        // After setting up the button, setup debouncer
        debouncerInputSeptic.attach(DIGITAL_INPUT_SEPTIC);
        debouncerInputSeptic.interval(5);
        debouncerInputSign.attach(DIGITAL_INPUT_SIGN);
        debouncerInputSign.interval(5);
    
    }
    
    //**************************** LOOP ********************************************************
    
    void loop() {
    
       // gw.process(); // By calling process() you route messages in the background
        debouncerInputSeptic.update();  // обновляем статус боунсера септика
        debouncerInputSign.update(); // обновляем статус боунсера сигнализации
    
        if (timer_read.check() == 1) ReadD(); // через TIME_READ_INPUT_SEPIC_SIGN запускаем ReadD()
        if (time_send_septic.check() == 1) SendVeraSeptic(); // через TIME_SEND_VERA_SEPTIC запускаем SendVeraSeptic()
        if (time_send_sign.check() == 1) SendVeraSign(); // через TIME_SEND_VERA_SIGN запускаем SendVeraSign()
        if (time_send_220.check() == 1) SendVera220(); // через TIME_SEND_VERA_220 запускаем SendVera220()
    
    
    }
    
    //************************ END LOOP **********************************************************
    
    //************************** ReadD() *********************************************************
    
    // считываем данные со входов
    
    void ReadD() {
    
        // Get the update value
        valueSeptic = debouncerInputSeptic.read();
    
        // Get the update value
        valueSign = debouncerInputSign.read();
    
        //valueSign = digitalRead(DIGITAL_INPUT_SIGN);
    #if ConsoleComm
        Serial << "valueSign: " << valueSign << endl;
        Serial << "valueSeptic: " << valueSeptic << endl;
        Serial << "powerlost: " << powerlost << endl;
    #endif
    
    }
    
    //******************************** END ReadD() ****************************************************
    
    //********************************* SendVeraSeptic() ***********************************************
    
    // отсылаем данные на Vera о септике
    void SendVeraSeptic() {
    #if ConsoleComm
        Serial << "SendVeraSeptic(): " << valueSeptic << endl;
    #endif
        send(errorMsgSeptic.set(valueSeptic ? "1" : "0")); // Send tripped value to gw
    
    }
    
    //********************************* END SendVeraSeptic() ***********************************************
    
    //********************************* SendVeraSign() ***********************************************
    
    // отсылаем данные на Vera о сигнализации
    void SendVeraSign() {
    #if ConsoleComm
        Serial << "SendVeraSign(): " << valueSign << endl;
    #endif
        send(errorMsgSign.set(valueSign ? "1" : "0")); // Send tripped value to gw
    
    }
    
    //********************************* END SendVeraSign() ***********************************************
    
    //********************************* SendVera220() ***********************************************
    
    // отсылаем данные на Vera о 220
    void SendVera220() {
    
    #if ConsoleComm
        Serial << "220: " << powerlostint << endl;
    #endif
        attachInterrupt(digitalPinToInterrupt(INTERRUPT_220V),detect_up, LOW); // включаем прерывание чтобы наловить фронты 220
        delay(2); // нужен, т.к. бывает не успевает собрать данные
        if (powerlostint > 0) powerlost = false; // если получили кучу прерываний, значит 220 есть
        else powerlost=true;	// если нет прерываний, нет и 220
        detachInterrupt(digitalPinToInterrupt(INTERRUPT_220V)); //временно выключаем прерывание
        send(errorMsg220.set(powerlost ? "1" : "0")); // Send tripped value to gw
        powerlostint=0; // обнуляем счётчик прерываний
    }
    
    //********************************* END SendVera220() ***********************************************
    
    //********************************** incomingMessage ************************************************
    
    void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type == V_LIGHT) {
            // Change relay state
            if (message.sensor == CHILD_VERA_RELAY_SIGN) { // если пришло для сигнализации
                digitalWrite(RELAY_SIGN, message.getBool() ? RELAY_ON : RELAY_OFF);
                // Store state in eeprom
                // gw.saveState(message.sensor, message.getBool());
            }
            if (message.sensor == CHILD_VERA_ROLLING) { // если пришло для рольставень
                detachInterrupt(digitalPinToInterrupt(INTERRUPT_220V)); //временно выключаем прерывание
                if (message.getBool() == true) { // если пришла 1 то закрываем
                    for (int i = 0; i < 5; i++) {
                        closers();
                    }
                } else if (message.getBool() == false)
                    for (int i = 0; i < 5; i++) { // если пришёл 0 то открываем
                        for (int i = 0; i < 5; i++) {
                            openrs();
                        }
    
                    }
                //  attachInterrupt(digitalPinToInterrupt(INTERRUPT_220V), detect_up, LOW);  // настроить срабатывание прерывания interrupt1 на pin 2 на низкий уровень
            }
            // Write some debug info
    #if ConsoleComm
            Serial.print("Incoming change for sensor:");
            Serial.print(message.sensor);
            Serial.print(", New status: ");
            Serial.println(message.getBool());
    #endif
        }
    }
    
    //************************************* END incomingMessage ******************************************
    

  • Admin

    @Daemon-D Hmm...where do you load the MySensors lib?

    #include <MySensors.h>
    

    (this statement is missing in your sketch)



  • @tekka

    Используем библиотеку MySensors версии 2.0.1-beta из папки: C:\Users\Daemon\Google Drive\Project\libraries\MySensors 
    

    Already I tried the beta of the development, all the same.


  • MySensors Evangelist

    @tekka interesting. I assume people are already using repeaters in 2.0.x so it will be safe for me to. Migrate from 1.5.4 to 2.0.0??



  • @sincze said:

    @tekka interesting. I assume people are already using repeaters in 2.0.x so it will be safe for me to. Migrate from 1.5.4 to 2.0.0??

    Yes, Migrate from 1.5.4 to 2.0.0


  • MySensors Evangelist

    @Daemon-D okay for you still not working right??



  • @sincze said:

    @Daemon-D okay for you still not working right??
    Repeater not working :(


  • Admin

    @Daemon-D I'm not sure you got my question regarding the issue you have with your repeater node. I suggest you try the RepeaterNode sketch from the MySensors examples and post the debug log here.


  • Admin

    @sincze said:

    @tekka interesting. I assume people are already using repeaters in 2.0.x so it will be safe for me to. Migrate from 1.5.4 to 2.0.0??

    Yes, should be safe to use.



  • @tekka

    @tekka said:

    @Daemon-D I'm not sure you got my question regarding the issue you have with your repeater node. I suggest you try the RepeaterNode sketch from the MySensors examples and post the debug log here.

    The problem was solved by a code transfer at the very beginning as a test sketch before #include

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Enabled repeater feature for this node
    #define MY_REPEATER_FEATURE```

  • Admin

    @Daemon-D Can you explain how you solved the issue - I'm sure other user could also profit if they face a similar problem. Thanks.



  • @tekka said:

    @Daemon-D Can you explain how you solved the issue - I'm sure other user could also profit if they face a similar problem. Thanks.

    The problem was solved by moving to the top of the sketch exactly like the to test the sketch before #include

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Enabled repeater feature for this node
    #define MY_REPEATER_FEATURE
    
    #include <SPI.h>
    #include <MySensors.h>
    

Log in to reply
 

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