Node-Red v0.15.3???

Home Forums Conduit: AEP Model Node-Red v0.15.3???

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #30176
    bdbuysse@gmail.com
    Participant

    Are there plans to upgrade node-red on conduit gateways to a more recent version? I love that your gateways come equipped with node-red as it affords a simple way to get exposed to the LoRa stack, but was saddened when I recently purchased a MTCAP-915-041A-ND gateway and found out it is still using v0.15.3. The Node-Red community still lists Multitech as a sponsor, but it seems your gateways are stuck on a 2016 release.

    #30177
    Jason Reiss
    Keymaster

    This has been discussed many times before.
    The hardware does not support hw floating point operations, sw floating point was last supported in node.js in the installed version v0.10.48, node-red v0.15.3 is the last version available.

    https://www.multitech.net/developer/forums/topic/node-red-upgrade/

    An updated gateway will be available this year.

    #32758
    SaSa
    Participant

    Hello Jason,

    To be honest i saw your answer which is for 21 jan 2020, and I wanted to ask you pls if any upgrade has released till today for node-red ?

    thanks in advance,

    #32760
    Jason Reiss
    Keymaster

    Sabri,

    The current hardware still does not support hw float point operations required for newer versions of node-red.

    We are working on updated hardware platforms that should be available later this year.

    #32814
    SaSa
    Participant

    hello Jason,

    hope you are doing great,

    In fact I got a question, I’m running a code to aim to recive data from an API and to sort them.

    The probleme is that I can see the resulte of this function in node-red v.2.2.2 but not in 0.15.3 ?

    var data = [];
    for (var i = 0; i < msg.payload.length; i++) {
    var Pay = msg.payload[i].System_Activated;
    let Dev_eui = msg.payload[i].valve_EUI;

    if (msg.payload === null) {
    data.push({ payload: “Don’t action”, Dev_eui: Dev_eui, port : “1”, ack: “1” });
    } else {
    data.push({ payload: Pay, Dev_eui: Dev_eui, port : “1”, ack: “1” });
    }
    }
    data = JSON.stringify(data);
    console.log (msg.data);
    return {data}
    `

    #32815
    SaSa
    Participant

    I have another probleme also, when I send a payload to an end-device, but it add something that doesn’t existe in patload.

    could you please help me ?

    using this code :

    msg.eui = "XXXXXXXXXXXXX";
    msg.payload = "31";
    port = "1" ;
    ack = "1";
    return msg;
    #32816
    Jason Reiss
    Keymaster

    msg.payload = "31";

    This will send two bytes, 3 and 1 in ascii as 0x33 and 0x31 shown below.
    The downlink format is [TYPE][DEVADDR][FCNT][PORT][PAYLOAD]

    at+send hello
    018856a20005000000013331

    OK

    End of packet is
    Port: 01 Payload: 3331

    To send only one byte.
    msg.payload = new Buffer("31", "hex");

    at+send hello
    018856a2000a0000000131

    OK

    End of packet is
    Port: 01 Payload: 31

    Port is an int and ack is a bool.

    msg.port = 1 ;
    msg.ack = true;
    #32817
    Jason Reiss
    Keymaster

    For your original JS code

    How is System_Activated and value_EUI added to a payload?
    This would not come out of the network server on Conduit.

    var Pay = msg.payload[i].System_Activated;
    let Dev_eui = msg.payload[i].valve_EUI;

    Not sure why you create an array for data and push packets into it.
    Only one downlink should be created. “eui” instead of “Dev_eui” as your second example should be used.

    This doesn’t look right.
    data.push({ payload: Pay, Dev_eui: Dev_eui, port : “1″, ack: “1″ });

    Let me know if you have more questions, seems like you are making progress in the right direction?

    #32818
    SaSa
    Participant

    Thanks Jason,
    so with your help I could resolve the problem of payload and it sends correctly now.

    For the second part, we have some data which arrive from our database using a API request. the aim of this function is just to sort and analyse theses data and redirect them to our End-devices.

    data format:

    [{"ID":10132,"Humidity":53,"Date_Interpreted":"2022-07-12T04:38:42.000Z","System_Activated":null,,,"valve_EUI":"XX-XX-XX-XX-XX-XX-XX-XX"},{"ID":1970,"Humidity":61,"Date_Interpreted":"2022-06-23T09:01:33.000Z","System_Activated":null,"valve_EUI":"XX-XX-XX-XX-XX-XX-XX-XX"}]

    By using this function, we want just to send "system_activated" as "payload" to an end-device with eui : "valve-eui" in a message containing "port = 1", and "ack: true"

    Thanks in advance for your help.

    #32819
    Jason Reiss
    Keymaster

    Reviewing functionality of Node-red and returning an array should result in each message in the array being passed to the next node.
    https://nodered.org/docs/user-guide/writing-functions

    This code should queue a single byte to the node based on the System_Activated field. You can change the value as needed.

    
    downlinks = [];
    
    for (var i = 0; i < msg.payload.length; i++) {
        
        downlink = {};
        downlink.eui = msg.payload[i].valve_EUI;
    
        if (msg.payload[i].System_Activated) {
            downlink.payload = new Buffer("01", "hex");
        } else {
            downlink.payload = new Buffer("00", "hex");
        }
    
        downlink.port = 1;
        downlink.ack = true;
        downlinks.push(downlink);
    }
    
    return downlinks;
    #32831
    SaSa
    Participant

    thanks Jason,

    the code that you sent me works but doesn’t result what I want exactly, It applies just for the first array.

    thanks in advance.

    #32832
    Jason Reiss
    Keymaster

    I am not sure exactly what you are meaning to do. Hopefully there is enough example code for you to play with and get to work for your use case?

    #32834
    SaSa
    Participant

    ok, I’ll try to better explain you my issue,

    first of all this is exactly the format of data that I receive from my database using http request :

    [{"ID_Inter":1980,"lumiere":62,"Date_Inter":"2022-06-23T09:31:33.000Z","System_Activated":null,"valve_EUI":"xx-xx-xx-xx-xx-xx-xx-xx"},
    {"ID_Inter":1981,"lumiere":62,"Date_Inter":"2022-06-23T09:34:33.000Z","System_Activated":null,"valve_EUI":"xx-xx-xx-xx-xx-xx-xx-xx"},
    {"ID_Inter":1982,"lumiere":62,"Date_Inter":"2022-06-23T09:37:33.000Z","System_Activated":10,,"valve_EUI":"xx-xx-xx-xx-xx-xx-xx-xx"}]

    Using the code that you sent me, I mean this :

    downlinks = [];
    
    for (var i = 0; i < msg.payload.length; i++) {
        
        downlink = {};
        downlink.eui = msg.payload[i].valve_EUI;
    
        if (msg.payload[i].System_Activated) {
            downlink.payload = new Buffer("01", "hex");
        } else {
            downlink.payload = new Buffer("00", "hex");
        }
    
        downlink.port = 1;
        downlink.ack = true;
        downlinks.push(downlink);
    }
    
    return downlinks;

    In result, I see just a downlink sent to the first eui where ID_Inter”:1980. since it should be sent to all devices.

    could you help me please to solve this problem, I can’t really understand the logic of this version of node-red.

    thanks in advance.

    • This reply was modified 1 year, 8 months ago by SaSa.
    #32876
    SaSa
    Participant

    so I found the problem and I’ll share it here in case. so easily instead return downlinks,I put return [downlinks]. this lets me to sort them in diferentes messages.

    • This reply was modified 1 year, 8 months ago by SaSa.
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.