How to update sensor relay from serial gateway



  • i can't update my relay trhough serial ...

    My gateway is on : /dev/ttyUSB0
    My relay sensor is on : /dev/ttyUSB1

    both sketch are from mysensors sample code except i force sensor node to 1 for my sensor relay.

    This is what i read from gateway serial :

    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;14;Gateway startup complete.
    0;0;3;0;9;read: 1-1-0 s=255,c=0,t=18,pt=0,l=3,sg=0:1.5
    1;255;0;0;18;1.5
    0;0;3;0;9;read: 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    1;255;3;0;6;0
    0;0;3;0;9;read: 1-1-0 s=255,c=3,t=11,pt=0,l=5,sg=0:Relay
    1;255;3;0;11;Relay
    0;0;3;0;9;read: 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
    1;255;3;0;12;1.0
    0;0;3;0;9;read: 1-1-0 s=1,c=0,t=3,pt=0,l=0,sg=0:
    1;1;0;0;3;
    0;0;3;0;9;read: 1-1-0 s=255,c=0,t=18,pt=0,l=3,sg=0:1.5
    1;255;0;0;18;1.5
    0;0;3;0;9;read: 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    1;255;3;0;6;0
    0;0;3;0;9;read: 1-1-0 s=255,c=3,t=11,pt=0,l=5,sg=0:Relay
    1;255;3;0;11;Relay
    0;0;3;0;9;read: 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
    1;255;3;0;12;1.0
    0;0;3;0;9;read: 1-1-0 s=1,c=0,t=3,pt=0,l=0,sg=0:
    1;1;0;0;3;
    

    And on my relay sensor :

    send: 1-1-0-0 s=255,c=0,t=18,pt=0,l=3,sg=0,st=ok:1.5
    send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    repeater started, id=1, parent=0, distance=1
    send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=5,sg=0,st=ok:Relay
    send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
    send: 1-1-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
    

    What can i do to update my relay status ?
    i try :
    bash> echo "1;1;1;0;1;\n" >> /dev/ttyUSB0

    tx led blink but i have nothing in my serial 😞


  • Admin

    Is \n interpreted correctly as newline in echo? (I think echo adds newline automatically...)

    "1;1;1;0;2;1" should do the trick



  • tried :

    echo "1;1;1;0;2;1" >> /dev/ttyUSB0

    without success 😞



  • I also tried using node.js ...

    I check if i receive serial data on my gateway using :

    bash> picocom /dev/ttyUSB1 -b 115200 -r -l --omap lfcrlf --imap lfcrlf --emap lfcrlf
    Terminal ready
    send: 1-1-0-0 s=255,c=0,t=18,pt=0,l=3,sg=0,st=ok:1.5
    send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    repeater started, id=1, parent=0, distance=1
    send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=5,sg=0,st=ok:Relay
    send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
    send: 1-1-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
    
    

    Here is my node.js script :

    
    const gwType = 'Serial';
    //const gwPort = 'COM4';
    const gwPort = '/dev/ttyUSB0';
    const gwBaud = 115200;
    
    //var SerialPort = require('/home/bxl/node-v0.12.0-linux-x64/lib/node_modules/serialport');
    var serialport = require('/home/bxl/node-v0.12.0-linux-x64/lib/node_modules/serialport');
    var SerialPort = serialport.SerialPort;
    
    
    gw = new SerialPort(gwPort,
            { baudrate: gwBaud
              ,parser: serialport.parsers.readline("\n")
    });
    
                gw.on('open', function() {
                            console.log('connected to serial gateway at ' + gwPort);
                            gw.write('1;1;1;0;2;1');
                            console.log('Write done.');
                    }).on('end', function() {
                            console.log('disconnected from gateway');
                    }).on('error', function() {
                            console.log('connection error - trying to reconnect');
                            gw.open();
                    });
    

    but nothing move on my serial gateway 😞


  • Admin

    @beanl said:

    gw.write('1;1;1;0;2;1');

    Does not att newline (I think?)...



  • I also try to put my gateway on a widows machine and on arduino ide :

    2015-08-06_115823.png

    I send : 1;1;1;0;2;1

    But on my node :

    bash>  picocom /dev/ttyUSB1 -b 115200 -r -l --omap lfcrlf --imap lfcrlf --emap lfcrlf
    picocom v1.7
    
    port is        : /dev/ttyUSB1
    flowcontrol    : none
    baudrate is    : 115200
    parity is      : none
    databits are   : 8
    escape is      : C-a
    local echo is  : no
    noinit is      : no
    noreset is     : yes
    nolock is      : yes
    send_cmd is    : sz -vv
    receive_cmd is : rz -vv
    imap is        : lfcrlf,
    omap is        : lfcrlf,
    emap is        : lfcrlf,
    
    Terminal ready
    send: 1-1-0-0 s=255,c=0,t=18,pt=0,l=3,sg=0,st=ok:1.5
    send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    repeater started, id=1, parent=0, distance=1
    send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=5,sg=0,st=fail:Relay
    send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
    send: 1-1-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
    
    

  • Admin

    What does "Pas de fun de ligne" mean?


  • Hero Member

    @hek acording to google translate "No end of line"



  • yep it's the french version of arduino IDE 🙂


  • Admin

    Choose the option where it sends newlines then...



  • i try with the option without success.

    I also try to reset EEPROM & assigning Node ID with "MYScontroller" :
    2015-08-06_140028.png

    On my node :

    Terminal ready
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    repeater started, id=255, parent=0, distance=1
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    

    I think my gateway don't really send message ...
    Any idea why ?



  • I used a mini pro whith FTDI :

    IMG_0781.JPG

    It wasn't working the serial gateway don't send data.

    I test with a nano and all is ok now ...

    1.png

    And on my relay sensor :

    Terminal ready
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    read: 0-0-255 s=255,c=3,t=4,pt=0,l=1,sg=0:1
    send: 1-1-0-0 s=255,c=0,t=18,pt=0,l=3,sg=0,st=ok:1.5
    send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    read: 0-0-1 s=255,c=3,t=6,pt=0,l=1,sg=0:M
    id=1
    send: 1-1-0-0 s=255,c=0,t=18,pt=0,l=3,sg=0,st=ok:1.5
    send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    read: 0-0-1 s=255,c=3,t=6,pt=0,l=1,sg=0:M
    repeater started, id=1, parent=0, distance=1
    send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=5,sg=0,st=ok:Relay
    send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
    send: 1-1-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
    

Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts