SaSa
Forum Replies Created
-
AuthorPosts
-
SaSaParticipantSaSaParticipantSaSaParticipant
dear @david-heitzmanmultitech-com
We are trying to find a way to Pair/Unpair end-devices with an API via
DeviceHQ
,
Could you please to help us if it’s doable at first ? if yes do you have some examples ?Thanks,
SaSa- This reply was modified 1 year, 11 months ago by SaSa.
SaSaParticipantThanks @skovarik for your complete answer. I’ll base my researches on model that you proposed us, and let me please to ask you if I had another question,
SaSaParticipant@jason fortunately I found something which helped me to command the end-device, I’m not at all sure if it’s logic or not but it works literally and by now : `downlinks = [];
for (var i = 0; i < msg.payload.length; i++) {
downlink = {};
var pay = msg.payload[i].System_Activated;
// let rx_wnd = 1;if (pay === null ) {
//downlink.payload = new Buffer(“00”, “hex”);
} else {
downlink.payload = new Buffer( “21”+pay, “hex”);
downlink.eui = msg.payload[i].valve_EUI;
downlink.port = 2;
downlink.ack = true;
downlink.delay = 1;
}downlinks.push(downlink);
}return [downlinks];`
I think this line of code
downlink.delay = 1;
changesRX window
value to 1SaSaParticipantthanks Jason, I’ll try to get by with Mqtt method since I know it’s not so easy.
- This reply was modified 2 years, 2 months ago by SaSa.
SaSaParticipantYes of course. Because in a downlink sent by my function,
Rx value is 0
by default (which I try to change) and my valve doesn’t apply command. since when I sent manually exactly the same payload, port, eui, ack butRx = 1
the valve act exactly what it should.SaSaParticipantThanks Jason,
I check the MQTT method explained in the link but I didn’t get really how I should to adapt this node with a function node. Can I ask you please to propose me an alternative way that I could change it in function ?
SaSaParticipantThanks Jaosn as always. I tested rx_wnd but it didn’t change.
SaSaParticipanthi Nada, I don’t think that you could reach it in 0.15.3 version. generally I couldn’t install any node to node-red deployed on gateway.
Cordially.
SaSaParticipantdo you know please how I should put
Rx Window = 1
in a downlink message ?SaSaParticipantso I found the problem and I’ll share it here in case. so easily instead
return downlinks
,I putreturn [downlinks]
. this lets me to sort them in diferentes messages.- This reply was modified 2 years, 2 months ago by SaSa.
SaSaParticipantok, 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 2 years, 2 months ago by SaSa.
SaSaParticipantthanks 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.
SaSaParticipantThanks 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.
SaSaParticipantI 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;
SaSaParticipanthello 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}`SaSaParticipantHello 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,
SaSaParticipantthanks @Miha, I solved this problem. Actually I have another issue. simply I Registered an end-device and we are receiving payloads from correctly. so I tried to add an 2nd end-device. the problem is that I can see both end-device in whitelist and also in config page but any payload in packets.
thank in advance for your help.
SaSaParticipanthello Jason Reiss,
I have exactly the same issue. I see end-device s in whitelist and also in config part. I did a restart in LoRa network server but I only have packets from one end-device since I have 3.
Can I ask you what could be the main problem ?
Thanks in advance.
SaSaParticipant@jason Reiss, Thank you so much for your help. I’m receving datas now
SaSaParticipantHello @JasonReiss
I wanted ask you pls to help me, to be honest I’m doing exactly the same thing as Tom, but I could not get data using MQTT in node-red. my question is that we should put which server in mqtt ?
thank you in advance for your answer.
SaSaParticipanthello all,
I have literally the same problem as you. but I know that my sensor has not a On/Off button. so I put my server identifiers in “payload broker” (as shown in the screenshot).
first of all I wanted to know if the identifiers are in the pertinent place? wjat could be exactly the problem in our case
thank you in advance for your supports and your helps
-
AuthorPosts