¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date

Moderated Re: Zeroing meters when rig or amp off (eg. KPA500, Flex)

 

Thanks, Alan......the left pane is the one you helped me make. It's working great when the rig is on.? I imported Dave's KPA500 and KAT500 flows, but haven't gotten the amp and tuner just yet (although the "administration" has ok'd it). Next phase for me is to figure out how to add sliders to set power out and maybe other things.

Charlie KB8CR


Moderated Re: Zeroing meters when rig or amp off (eg. KPA500, Flex)

 

Charlie

I know for sure that Dave, WO2X, is almost ready to release a new version of the VITA49 and Flex API flow that will "zero" the meters.

Alan
WA9WUD


Moderated Re: Zeroing meters when rig or amp off (eg. KPA500, Flex)

 

This is what it looks like when things are turned off:?


Moderated Zeroing meters when rig or amp off (eg. KPA500, Flex)

 

Is there a way to zero the meters/text data for the meters when the radio or amplifier is turned off?
Currently, when they are off, the meters register full scale.

Thanks,

Charlie KB8CR


Re: INA-219 Node Fixed/Updated, no longer requires downgrade to Node.js v10

 

Sorry Neal.? I should of clicked on the link before posting.? It's right there!!!!!??

LOL


Re: Parsing a string

 

Since it's fixed length (8) convert it into an array then you can access each position via an index

Object.assign([], string);

newObject?=?Object.assign([], string);

OR without conversion

const splitString = originalString.split("");
fanState = splitString[1];
anotherState?=?splitString[3];

etc.


Re: INA-219 Node Fixed/Updated, no longer requires downgrade to Node.js v10

 

Yes there is Kyle.? ?Look to the beginning of the thread.? Procedure is in the link to the bug report.? It is not hard.? I am running the workaround myself.

Neal


On Fri, Jan 29, 2021, 2:31 PM Kyle K <kylekrieg@...> wrote:
I just got my INA219 boards last week and were going to start playing around with them.? I had not installed the INA-219 node yet.? I installed my OS in 2020.

I'm assuming there isn't a procedure on how to roll back?? How do we find out what version we have installed?

Kyle
AA0Z


Re: INA-219 Node Fixed/Updated, no longer requires downgrade to Node.js v10

 

I just got my INA219 boards last week and were going to start playing around with them.? I had not installed the INA-219 node yet.? I installed my OS in 2020.

I'm assuming there isn't a procedure on how to roll back?? How do we find out what version we have installed?

Kyle
AA0Z


Re: Parsing a string

 

¿ªÔÆÌåÓý

Advantage of a 50¡± 4k TV as a monitor. Good for my tired old eyes (age 59).

?

I do like your single function solution!

?

73

Dave wo2x

?

?

?

?

From: [email protected] <[email protected]> On Behalf Of Mick - W8BE
Sent: Friday, January 29, 2021 4:07 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Thanks Dave,? I caught it... I need a bigger monitor.? Doing it on a laptop screen.? ?It would seem Michaels has a plethora?of options available to him now.

?

On Fri, Jan 29, 2021 at 4:04 PM David De Coons wo2x <RocketNJ@...> wrote:

Hi Mick,

?

Close ?

Your msg6 if/else has true & true.(typo)

?

Here¡¯s the cleaned up, cleaned up version.

?

73

Dave wo2x

?

var output = msg.payload.split("");

msg.out0 = parseInt(output[0]);

msg.out1 = parseInt(output[1]);

msg.out2 = parseInt(output[2]);

msg.out3 = parseInt(output[3]);

msg.out4 = parseInt(output[4]);

msg.out5 = parseInt(output[5]);

msg.out6 = parseInt(output[6]);

msg.out7 = parseInt(output[7]);

?

?

if (msg.out0 === 1){

msg1 = {topic: 'relay1',payload:'true'};

} else?

msg1 = {topic: 'relay1',payload:'false'};

?

if (msg.out1 === 1){

msg2 = {topic: 'relay2',payload:'true'};

} else

msg2 = {topic: 'relay2',payload:'false'};

?

if (msg.out2 === 1) {

msg3 = {topic: 'relay3',payload:'true'};

} else

msg3 = {topic: 'relay3',payload:'false'};

?

if (msg.out3 === 1) {

msg4 = {topic: 'relay4',payload:'true'};

} else

msg4 = {topic: 'relay4',payload:'false'};

?

if (msg.out4 === 1) {

msg5 = {topic: 'relay5',payload:'true'};? ??

} else

msg5 = {topic: 'relay5',payload:'false'};

?

if (msg.out5 === 1) {

msg6 = {topic: 'relay6',payload:'true'};

} else

msg6 = {topic: 'relay6',payload:'false'};

?

if (msg.out6 === 1) {

msg7 = {topic: 'relay7',payload:'true'};? ??

} else

msg7 = {topic: 'relay7',payload:'false'};

?

if (msg.out7 === 1) {

msg8 = {topic: 'relay8',payload:'true'};

} else

msg8 = {topic: 'relay8',payload:'false'};

?

node.send(msg1);

node.send(msg2);

node.send(msg3);

node.send(msg4);

node.send(msg5);

node.send(msg6);

node.send(msg7);

node.send(msg8);

?

return;

?

?

?


Re: Parsing a string

 

¿ªÔÆÌåÓý

Hi Alan,

?

Mick¡¯s single function node is fine for processing Mike¡¯s string input. With the DLI the input is a base 10 number which equates to the binary position of the eight outlets.

A combo of both flows would be good for Miles use as it would give him visual indication and ability to control the relays.

?

Mike, if you need a hand let me know but this should get you on the right track.

?

73

Dave wo2x

?

?

From: [email protected] <[email protected]> On Behalf Of Alan Blind, WA9WUD
Sent: Friday, January 29, 2021 3:58 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Mike

I like the method Dave used in his DLI Relay Flow. ?The response is an eight-digit number, with 0 or 1 in each digit, depending on the relay status. ? Dave has a function to do a "logical and" for each digit to determine and outputs a true or false. ?Would this work for you? ? For example, if the second digit is 1, then the function "1 & 2" is true, because the binary of the second digit is 2**1 = 2 and 2 logical 2 is true. ?Likewise, for the third digit, 2**2 is 4 so the logical comparator is 4.

Alan. WA9WUD



And here is the function. ?Of course,var onmsg = { payload: msg.payload,topic:msg.topic };

var offmsg = { payload: msg.payload,topic:msg.topic };

=========================

?

var msg1 = { payload: msg.payload,topic:msg.topic };

var msg2 = { payload: msg.payload,topic:msg.topic };

var msg3 = { payload: msg.payload,topic:msg.topic };

var msg4 = { payload: msg.payload,topic:msg.topic };

var msg5 = { payload: msg.payload,topic:msg.topic };

var msg6 = { payload: msg.payload,topic:msg.topic };

var msg7 = { payload: msg.payload,topic:msg.topic };

var msg8 = { payload: msg.payload,topic:msg.topic };

?

?

//msg.payload=true;

onmsg.payload=true;

offmsg.payload=false;

?

if (msg.payload & ? 1) msg1.payload=true; else msg1.payload=false;

if (msg.payload & ? 2) msg2.payload=true; else msg2.payload=false;

if (msg.payload & ? 4) msg3.payload=true; else msg3.payload=false;

if (msg.payload & ? 8) msg4.payload=true; else msg4.payload=false;

if (msg.payload & ?16) msg5.payload=true; else msg5.payload=false;

if (msg.payload & ?32) msg6.payload=true; else msg6.payload=false;

if (msg.payload & ?64) msg7.payload=true; else msg7.payload=false;

if (msg.payload & 128) msg8.payload=true; else msg8.payload=false;

?

?

?

return [msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8];?you can download everything form the files section.


Re: Parsing a string

 

Thanks Dave,? I caught it... I need a bigger monitor.? Doing it on a laptop screen.? ?It would seem Michaels has a plethora?of options available to him now.

On Fri, Jan 29, 2021 at 4:04 PM David De Coons wo2x <RocketNJ@...> wrote:

Hi Mick,

?

Close ?

Your msg6 if/else has true & true.(typo)

?

Here¡¯s the cleaned up, cleaned up version.

?

73

Dave wo2x

?

var output = msg.payload.split("");

msg.out0 = parseInt(output[0]);

msg.out1 = parseInt(output[1]);

msg.out2 = parseInt(output[2]);

msg.out3 = parseInt(output[3]);

msg.out4 = parseInt(output[4]);

msg.out5 = parseInt(output[5]);

msg.out6 = parseInt(output[6]);

msg.out7 = parseInt(output[7]);

?

?

if (msg.out0 === 1){

msg1 = {topic: 'relay1',payload:'true'};

} else?

msg1 = {topic: 'relay1',payload:'false'};

?

if (msg.out1 === 1){

msg2 = {topic: 'relay2',payload:'true'};

} else

msg2 = {topic: 'relay2',payload:'false'};

?

if (msg.out2 === 1) {

msg3 = {topic: 'relay3',payload:'true'};

} else

msg3 = {topic: 'relay3',payload:'false'};

?

if (msg.out3 === 1) {

msg4 = {topic: 'relay4',payload:'true'};

} else

msg4 = {topic: 'relay4',payload:'false'};

?

if (msg.out4 === 1) {

msg5 = {topic: 'relay5',payload:'true'};? ??

} else

msg5 = {topic: 'relay5',payload:'false'};

?

if (msg.out5 === 1) {

msg6 = {topic: 'relay6',payload:'true'};

} else

msg6 = {topic: 'relay6',payload:'false'};

?

if (msg.out6 === 1) {

msg7 = {topic: 'relay7',payload:'true'};? ??

} else

msg7 = {topic: 'relay7',payload:'false'};

?

if (msg.out7 === 1) {

msg8 = {topic: 'relay8',payload:'true'};

} else

msg8 = {topic: 'relay8',payload:'false'};

?

node.send(msg1);

node.send(msg2);

node.send(msg3);

node.send(msg4);

node.send(msg5);

node.send(msg6);

node.send(msg7);

node.send(msg8);

?

return;

?

?

?


Re: Parsing a string

 

¿ªÔÆÌåÓý

Hi Mick,

?

Close ?

Your msg6 if/else has true & true.(typo)

?

Here¡¯s the cleaned up, cleaned up version.

?

73

Dave wo2x

?

var output = msg.payload.split("");

msg.out0 = parseInt(output[0]);

msg.out1 = parseInt(output[1]);

msg.out2 = parseInt(output[2]);

msg.out3 = parseInt(output[3]);

msg.out4 = parseInt(output[4]);

msg.out5 = parseInt(output[5]);

msg.out6 = parseInt(output[6]);

msg.out7 = parseInt(output[7]);

?

?

if (msg.out0 === 1){

msg1 = {topic: 'relay1',payload:'true'};

} else?

msg1 = {topic: 'relay1',payload:'false'};

?

if (msg.out1 === 1){

msg2 = {topic: 'relay2',payload:'true'};

} else

msg2 = {topic: 'relay2',payload:'false'};

?

if (msg.out2 === 1) {

msg3 = {topic: 'relay3',payload:'true'};

} else

msg3 = {topic: 'relay3',payload:'false'};

?

if (msg.out3 === 1) {

msg4 = {topic: 'relay4',payload:'true'};

} else

msg4 = {topic: 'relay4',payload:'false'};

?

if (msg.out4 === 1) {

msg5 = {topic: 'relay5',payload:'true'};? ??

} else

msg5 = {topic: 'relay5',payload:'false'};

?

if (msg.out5 === 1) {

msg6 = {topic: 'relay6',payload:'true'};

} else

msg6 = {topic: 'relay6',payload:'false'};

?

if (msg.out6 === 1) {

msg7 = {topic: 'relay7',payload:'true'};? ??

} else

msg7 = {topic: 'relay7',payload:'false'};

?

if (msg.out7 === 1) {

msg8 = {topic: 'relay8',payload:'true'};

} else

msg8 = {topic: 'relay8',payload:'false'};

?

node.send(msg1);

node.send(msg2);

node.send(msg3);

node.send(msg4);

node.send(msg5);

node.send(msg6);

node.send(msg7);

node.send(msg8);

?

return;

?

?

?


Re: Parsing a string

 

All,??

Last update.? ?I changed the topic to relay...? Inject of 101010



Give you:



Here is the final function:

var output = msg.payload.split("");
msg.out0 = parseInt(output[0]);
msg.out1 = parseInt(output[1]);
msg.out2 = parseInt(output[2]);
msg.out3 = parseInt(output[3]);
msg.out4 = parseInt(output[4]);
msg.out5 = parseInt(output[5]);
msg.out6 = parseInt(output[6]);
msg.out7 = parseInt(output[7]);
?
?
if (msg.out0 === 1){
msg1 = {relay: 1,payload:'true'};
} else?
msg1 = {relay: 1,payload:'false'};
?
if (msg.out1 === 1){
msg2 = {relay: 2,payload:'true'};
} else
msg2 = {relay: 2,payload:'false'};
?
if (msg.out2 === 1) {
msg3 = {relay: 3,payload:'true'};
} else
msg3 = {relay: 3,payload:'false'};
?
if (msg.out3 === 1) {
msg4 = {relay: 4,payload:'true'};
} else
msg4 = {relay: 4,payload:'false'};
?
if (msg.out4 === 1) {
msg5 = {relay: 5,payload:'true'};? ??
} else
msg5 = {relay: 5,payload:'false'};
?
if (msg.out5 === 1) {
msg6 = {relay: 6,payload:'true'};
} else
msg6 = {relay: 6,payload:'false'};
?
if (msg.out6 === 1) {
msg7 = {relay: 7,payload:'true'};? ??
} else
msg7 = {relay: 7,payload:'true'};
?
if (msg.out7 === 1) {
msg8 = {relay: 8,payload:'true'};
} else
msg8 = {relay: 8,payload:'false'};
?
node.send(msg1);
node.send(msg2);
node.send(msg3);
node.send(msg4);
node.send(msg5);
node.send(msg6);
node.send(msg7);
node.send(msg8);
?
return;
?


Re: Parsing a string

 

Mike

I like the method Dave used in his DLI Relay Flow. ?The response is an eight-digit number, with 0 or 1 in each digit, depending on the relay status. ? Dave has a function to do a "logical and" for each digit to determine and outputs a true or false. ?Would this work for you? ? For example, if the second digit is 1, then the function "1 & 2" is true, because the binary of the second digit is 2**1 = 2 and 2 logical 2 is true. ?Likewise, for the third digit, 2**2 is 4 so the logical comparator is 4.

Alan. WA9WUD



And here is the function. ?Of course,var onmsg = { payload: msg.payload,topic:msg.topic };
var offmsg = { payload: msg.payload,topic:msg.topic };

=========================
?
var msg1 = { payload: msg.payload,topic:msg.topic };
var msg2 = { payload: msg.payload,topic:msg.topic };
var msg3 = { payload: msg.payload,topic:msg.topic };
var msg4 = { payload: msg.payload,topic:msg.topic };
var msg5 = { payload: msg.payload,topic:msg.topic };
var msg6 = { payload: msg.payload,topic:msg.topic };
var msg7 = { payload: msg.payload,topic:msg.topic };
var msg8 = { payload: msg.payload,topic:msg.topic };
?
?
//msg.payload=true;
onmsg.payload=true;
offmsg.payload=false;
?
if (msg.payload & ? 1) msg1.payload=true; else msg1.payload=false;
if (msg.payload & ? 2) msg2.payload=true; else msg2.payload=false;
if (msg.payload & ? 4) msg3.payload=true; else msg3.payload=false;
if (msg.payload & ? 8) msg4.payload=true; else msg4.payload=false;
if (msg.payload & ?16) msg5.payload=true; else msg5.payload=false;
if (msg.payload & ?32) msg6.payload=true; else msg6.payload=false;
if (msg.payload & ?64) msg7.payload=true; else msg7.payload=false;
if (msg.payload & 128) msg8.payload=true; else msg8.payload=false;
?
?
?
return [msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8];?you can download everything form the files section.



Re: Parsing a string

 
Edited

Here you go...I cleaned it up...? edit...apparently not enough....try this...I used an inject of 10101010

var output = msg.payload.split("");
msg.out0 = parseInt(output[0]);
msg.out1 = parseInt(output[1]);
msg.out2 = parseInt(output[2]);
msg.out3 = parseInt(output[3]);
msg.out4 = parseInt(output[4]);
msg.out5 = parseInt(output[5]);
msg.out6 = parseInt(output[6]);
msg.out7 = parseInt(output[7]);
?
?
if (msg.out0 === 1){
msg1 = {topic: 'relay1',payload:'true'};
} else?
msg1 = {topic: 'relay1',payload:'false'};
?
if (msg.out1 === 1){
msg2 = {topic: 'relay2',payload:'true'};
} else
msg2 = {topic: 'relay2',payload:'false'};
?
if (msg.out2 === 1) {
msg3 = {topic: 'relay3',payload:'true'};
} else
msg3 = {topic: 'relay3',payload:'false'};
?
if (msg.out3 === 1) {
msg4 = {topic: 'relay4',payload:'true'};
} else
msg4 = {topic: 'relay4',payload:'false'};
?
if (msg.out4 === 1) {
msg5 = {topic: 'relay5',payload:'true'};? ??
} else
msg5 = {topic: 'relay5',payload:'false'};
?
if (msg.out5 === 1) {
msg6 = {topic: 'relay6',payload:'true'};
} else
msg6 = {topic: 'relay6',payload:'false'};
?
if (msg.out6 === 1) {
msg7 = {topic: 'relay7',payload:'true'};? ??
} else
msg7 = {topic: 'relay7',payload:'true'};
?
if (msg.out7 === 1) {
msg8 = {topic: 'relay8',payload:'true'};
} else
msg8 = {topic: 'relay8',payload:'false'};
?
node.send(msg1);
node.send(msg2);
node.send(msg3);
node.send(msg4);
node.send(msg5);
node.send(msg6);
node.send(msg7);
node.send(msg8);
?
return;
?
?




Re: Parsing a string

 

¿ªÔÆÌåÓý

BTW, this can all be done in one function node using Mick¡¯s example then looking for each msg.out to either be 0 or 1 and setting msg.out to false or true. (if/else)

?

More than one way to get to the desired output.

?

Dave wo2x

?

From: [email protected] <[email protected]> On Behalf Of Mick - W8BE
Sent: Friday, January 29, 2021 3:01 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Here is a function to split the input and output a msg for each bit.? ?I used a string of 10000000 as the inject

?

?

The output gives you the msg.payload and msg.topic

?

Here is the function.

?

var output = msg.payload.split("");
msg.out0 = parseInt(output[0]);
msg.out1 = parseInt(output[1]);
msg.out2 = parseInt(output[2]);
msg.out3 = parseInt(output[3]);
msg.out4 = parseInt(output[4]);
msg.out5 = parseInt(output[5]);
msg.out6 = parseInt(output[6]);
msg.out7 = parseInt(output[6]);
msg.out8 = parseInt(output[7]);
msg.out9 = parseInt(output[8]);
msg1 = {topic: 'Bit 1',payload:msg.out0};
msg2 = {topic: 'Bit 2',payload:msg.out1};
msg3 = {topic: 'Bit 3',payload:msg.out2};
msg4 = {topic: 'Bit 4',payload:msg.out3};
msg5 = {topic: 'Bit 5',payload:msg.out4};
msg6 = {topic: 'Bit 6',payload:msg.out5};
msg7 = {topic: 'Bit 7',payload:msg.out6};
msg8 = {topci: 'Bit 8',payload:msg.out7};
msg9 = {topic: 'Bit 9',payload:msg.out8};

node.send(msg1);
node.send(msg2);
node.send(msg3);
node.send(msg4);
node.send(msg5);
node.send(msg6);
node.send(msg7);
node.send(msg8);
node.send(msg9);

return;

You could then run this into a switch node for further?processing or just modify it by creating a var instead of msg and then process it in the function.?

?

On Fri, Jan 29, 2021 at 1:53 PM David De Coons wo2x <RocketNJ@...> wrote:

Neal beat me to it.

?

Split/Switch is the way to go. Easy.

?

73

Dave wo2x

?

?

From: [email protected] <[email protected]> On Behalf Of Neal Pollack
Sent: Friday, January 29, 2021 1:38 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Another way to split the outputs;

?

?

On Fri, Jan 29, 2021 at 10:24 AM Michael Walker <va3mw@...> wrote:

I have a workable solution

?

(Dave, no driving and texting)? :)

?

Take the string and convert it to csv.? I can manage the rest.??

?

But, I will like to see your idea.

?

73

?

?

On Fri, Jan 29, 2021 at 1:17 PM David De Coons wo2x <RocketNJ@...> wrote:

I¡¯ve got a solution. I should be home in 1/2 hr.

?

Dave wo2x

?

?

Sent from my waxed string and tin cans.?

?

On Jan 29, 2021, at 1:11 PM, Michael Walker <va3mw@...> wrote:

?

Hi Neal

?

Yes, that is the status of 8 relays that I need to break out so I can build an LED panel (so to speak)

?

Mike?

?

On Fri, Jan 29, 2021 at 1:09 PM Neal Pollack <nealix@...> wrote:

Mike:

?

I don't have the actual answer, but I *think* I understand how to describe what you want:

?

Given a binary string of 1's and 0's such as, for example, 10010110 , parse out each digit position, and assign?each digit to
a separate boolean variable name set to 1 or 0.? ? Is that what?you're looking for?

?

Neal

?

On Fri, Jan 29, 2021 at 9:52 AM Michael Walker <va3mw@...> wrote:

Hi All

?

I have a string I need to parse of 8 binary values being returned from a relay board

?

10000000

?

What is the best way to parse out the status of each of these relays???

?

I looked at 'string' but I can't see a method that allows me to pull the boolean out 1 at a time.

?

thoughts?

?

Mike va3mw

?


Re: Parsing a string

 

¿ªÔÆÌåÓý

Mick has an extra msg.out. Only need 0 ¨C 7.

?

Here¡¯s a flow using split/switch/function to give false (0) or true (1) for each bit. First bit is top function node and last bit is bottom. Then feed into GPIO node.

?

Dave wo2x

?

[

??? {

??????? "id": "4e7a77e9.defc48",

??????? "type": "tab",

??????? "label": "Flow 2",

??????? "disabled": false,

??????? "info": ""

??? },

??? {

??????? "id": "cd5a6a57.fb77d8",

??????? "type": "inject",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "props": [

??????????? {

??????????????? "p": "payload"

??????????? }

??????? ],

??????? "repeat": "",

??????? "crontab": "",

??????? "once": false,

??????? "onceDelay": 0.1,

??????? "topic": "",

??????? "payload": "01010101",

??????? "payloadType": "str",

??????? "x": 300,

??????? "y": 220,

??????? "wires": [

??????????? [

??????????????? "fe4dc4d6.037c98"

??????????? ]

??????? ]

??? },

??? {

??????? "id": "dd5611e4.15976",

??????? "type": "function",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "func": "if (msg.payload == \"1\") {\n??? msg.payload = \"true\";\n} else msg.payload = \"false\";\n\nreturn msg;",

??????? "outputs": 1,

??????? "noerr": 0,

??????? "initialize": "",

??????? "finalize": "",

??????? "x": 760,

??????? "y": 160,

??????? "wires": [

??????????? []

??????? ]

??? },

??? {

??????? "id": "3ed35afa.0a1936",

??????? "type": "switch",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "property": "parts.index",

??????? "propertyType": "msg",

??????? "rules": [

??????????? {

??????????????? "t": "eq",

??????????????? "v": "0",

??????????????? "vt": "num"

??????????? },

??????????? {

??????????????? "t": "eq",

??????????????? "v": "1",

??????????????? "vt": "num"

??????????? },

??????????? {

??????????????? "t": "eq",

??????????????? "v": "2",

??????????????? "vt": "num"

??????????? },

??????????? {

??????????????? "t": "eq",

???????? ???????"v": "3",

??????????????? "vt": "num"

??????????? },

??????????? {

??????????????? "t": "eq",

??????????????? "v": "4",

??????????????? "vt": "num"

??????????? },

??????????? {

??????????????? "t": "eq",

??????????????? "v": "5",

??????????????? "vt": "num"

??????????? },

??????????? {

??????????????? "t": "eq",

??????????????? "v": "6",

??????????????? "vt": "num"

??????????? },

??????????? {

??????????????? "t": "eq",

??????????????? "v": "7",

??????????????? "vt": "num"

??????????? }

??????? ],

??????? "checkall": "true",

??????? "repair": false,

??????? "outputs": 8,

??????? "x": 600,

??????? "y": 280,

??????? "wires": [

??????????? [

??????????????? "dd5611e4.15976"

??????????? ],

?????????? ?[

??????????????? "b656e3bc.3661f"

??????????? ],

??????????? [

??????????????? "b3ccafd3.6efc2"

??????????? ],

??????????? [

??????????????? "65512697.166d98"

??????????? ],

??????????? [

??????????????? "e6171e3d.e5f4d"

??????????? ],

??????????? [

??????????????? "96d14c2b.9798e"

??????????? ],

??????????? [

??????????????? "ccbba3c4.d57db"

??????????? ],

??????????? [

??????????????? "4916a72a.09bbc8"

??????????? ]

??????? ]

??? },

??? {

??????? "id": "fe4dc4d6.037c98",

??????? "type": "split",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "splt": "1",

??????? "spltType": "len",

??????? "arraySplt": 1,

??????? "arraySpltType": "len",

??????? "stream": false,

??????? "addname": "",

??????? "x": 450,

??????? "y": 220,

???? ???"wires": [

??????????? [

??????????????? "3ed35afa.0a1936"

??????????? ]

??????? ]

??? },

??? {

??????? "id": "b656e3bc.3661f",

??????? "type": "function",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "func": "if (msg.payload == \"1\") {\n??? msg.payload = \"true\";\n} else msg.payload = \"false\";\n\nreturn msg;",

??????? "outputs": 1,

??????? "noerr": 0,

??????? "initialize": "",

??????? "finalize": "",

??????? "x": 760,

??????? "y": 200,

??? ????"wires": [

??????????? []

??????? ]

??? },

??? {

??????? "id": "b3ccafd3.6efc2",

??????? "type": "function",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "func": "if (msg.payload == \"1\") {\n??? msg.payload = \"true\";\n} else msg.payload = \"false\";\n\nreturn msg;",

??????? "outputs": 1,

??????? "noerr": 0,

??????? "initialize": "",

??????? "finalize": "",

??????? "x": 760,

??????? "y": 240,

??????? "wires": [

??????????? []

??????? ]

??? },

??? {

??????? "id": "65512697.166d98",

??????? "type": "function",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "func": "if (msg.payload == \"1\") {\n??? msg.payload = \"true\";\n} else msg.payload = \"false\";\n\nreturn msg;",

??????? "outputs": 1,

??????? "noerr": 0,

??????? "initialize": "",

??????? "finalize": "",

??????? "x": 760,

??????? "y": 280,

??????? "wires": [

??????????? []

??????? ]

??? },

??? {

??????? "id": "e6171e3d.e5f4d",

??????? "type": "function",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "func": "if (msg.payload == \"1\") {\n??? msg.payload = \"true\";\n} else msg.payload = \"false\";\n\nreturn msg;",

??????? "outputs": 1,

??????? "noerr": 0,

??????? "initialize": "",

??????? "finalize": "",

??????? "x": 760,

??????? "y": 320,

??????? "wires": [

??????????? []

??????? ]

??? },

??? {

??????? "id": "96d14c2b.9798e",

??????? "type": "function",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "func": "if (msg.payload == \"1\") {\n??? msg.payload = \"true\";\n} else msg.payload = \"false\";\n\nreturn msg;",

??????? "outputs": 1,

??????? "noerr": 0,

??????? "initialize": "",

??????? "finalize": "",

??????? "x": 760,

??????? "y": 360,

??????? "wires": [

??????????? []

??????? ]

??? },

??? {

??????? "id": "ccbba3c4.d57db",

??????? "type": "function",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "func": "if (msg.payload == \"1\") {\n??? msg.payload = \"true\";\n} else msg.payload = \"false\";\n\nreturn msg;",

??????? "outputs": 1,

??????? "noerr": 0,

??????? "initialize": "",

??????? "finalize": "",

??????? "x": 760,

??????? "y": 400,

??? ????"wires": [

??????????? []

??????? ]

??? },

??? {

??????? "id": "4916a72a.09bbc8",

??????? "type": "function",

??????? "z": "4e7a77e9.defc48",

??????? "name": "",

??????? "func": "if (msg.payload == \"1\") {\n??? msg.payload = \"true\";\n} else msg.payload = \"false\";\n\nreturn msg;",

??????? "outputs": 1,

??????? "noerr": 0,

??????? "initialize": "",

??????? "finalize": "",

??????? "x": 760,

??????? "y": 440,

??????? "wires": [

??????????? []

??????? ]

??? }

]

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

From: [email protected] <[email protected]> On Behalf Of Mick - W8BE
Sent: Friday, January 29, 2021 3:01 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Here is a function to split the input and output a msg for each bit.? ?I used a string of 10000000 as the inject

?

?

The output gives you the msg.payload and msg.topic

?

Here is the function.

?

var output = msg.payload.split("");
msg.out0 = parseInt(output[0]);
msg.out1 = parseInt(output[1]);
msg.out2 = parseInt(output[2]);
msg.out3 = parseInt(output[3]);
msg.out4 = parseInt(output[4]);
msg.out5 = parseInt(output[5]);
msg.out6 = parseInt(output[6]);
msg.out7 = parseInt(output[6]);
msg.out8 = parseInt(output[7]);
msg.out9 = parseInt(output[8]);
msg1 = {topic: 'Bit 1',payload:msg.out0};
msg2 = {topic: 'Bit 2',payload:msg.out1};
msg3 = {topic: 'Bit 3',payload:msg.out2};
msg4 = {topic: 'Bit 4',payload:msg.out3};
msg5 = {topic: 'Bit 5',payload:msg.out4};
msg6 = {topic: 'Bit 6',payload:msg.out5};
msg7 = {topic: 'Bit 7',payload:msg.out6};
msg8 = {topci: 'Bit 8',payload:msg.out7};
msg9 = {topic: 'Bit 9',payload:msg.out8};

node.send(msg1);
node.send(msg2);
node.send(msg3);
node.send(msg4);
node.send(msg5);
node.send(msg6);
node.send(msg7);
node.send(msg8);
node.send(msg9);

return;

You could then run this into a switch node for further?processing or just modify it by creating a var instead of msg and then process it in the function.?

?

On Fri, Jan 29, 2021 at 1:53 PM David De Coons wo2x <RocketNJ@...> wrote:

Neal beat me to it.

?

Split/Switch is the way to go. Easy.

?

73

Dave wo2x

?

?

From: [email protected] <[email protected]> On Behalf Of Neal Pollack
Sent: Friday, January 29, 2021 1:38 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Another way to split the outputs;

?

?

On Fri, Jan 29, 2021 at 10:24 AM Michael Walker <va3mw@...> wrote:

I have a workable solution

?

(Dave, no driving and texting)? :)

?

Take the string and convert it to csv.? I can manage the rest.??

?

But, I will like to see your idea.

?

73

?

?

On Fri, Jan 29, 2021 at 1:17 PM David De Coons wo2x <RocketNJ@...> wrote:

I¡¯ve got a solution. I should be home in 1/2 hr.

?

Dave wo2x

?

?

Sent from my waxed string and tin cans.?

?

On Jan 29, 2021, at 1:11 PM, Michael Walker <va3mw@...> wrote:

?

Hi Neal

?

Yes, that is the status of 8 relays that I need to break out so I can build an LED panel (so to speak)

?

Mike?

?

On Fri, Jan 29, 2021 at 1:09 PM Neal Pollack <nealix@...> wrote:

Mike:

?

I don't have the actual answer, but I *think* I understand how to describe what you want:

?

Given a binary string of 1's and 0's such as, for example, 10010110 , parse out each digit position, and assign?each digit to
a separate boolean variable name set to 1 or 0.? ? Is that what?you're looking for?

?

Neal

?

On Fri, Jan 29, 2021 at 9:52 AM Michael Walker <va3mw@...> wrote:

Hi All

?

I have a string I need to parse of 8 binary values being returned from a relay board

?

10000000

?

What is the best way to parse out the status of each of these relays???

?

I looked at 'string' but I can't see a method that allows me to pull the boolean out 1 at a time.

?

thoughts?

?

Mike va3mw

?


Re: Parsing a string

 

Here is a function to split the input and output a msg for each bit.? ?I used a string of 10000000 as the inject

image.png

The output gives you the msg.payload and msg.topic
image.png

Here is the function.

var output = msg.payload.split("");
msg.out0 = parseInt(output[0]);
msg.out1 = parseInt(output[1]);
msg.out2 = parseInt(output[2]);
msg.out3 = parseInt(output[3]);
msg.out4 = parseInt(output[4]);
msg.out5 = parseInt(output[5]);
msg.out6 = parseInt(output[6]);
msg.out7 = parseInt(output[6]);
msg.out8 = parseInt(output[7]);
msg.out9 = parseInt(output[8]);
msg1 = {topic: 'Bit 1',payload:msg.out0};
msg2 = {topic: 'Bit 2',payload:msg.out1};
msg3 = {topic: 'Bit 3',payload:msg.out2};
msg4 = {topic: 'Bit 4',payload:msg.out3};
msg5 = {topic: 'Bit 5',payload:msg.out4};
msg6 = {topic: 'Bit 6',payload:msg.out5};
msg7 = {topic: 'Bit 7',payload:msg.out6};
msg8 = {topci: 'Bit 8',payload:msg.out7};
msg9 = {topic: 'Bit 9',payload:msg.out8};

node.send(msg1);
node.send(msg2);
node.send(msg3);
node.send(msg4);
node.send(msg5);
node.send(msg6);
node.send(msg7);
node.send(msg8);
node.send(msg9);

return;

You could then run this into a switch node for further?processing or just modify it by creating a var instead of msg and then process it in the function.?

On Fri, Jan 29, 2021 at 1:53 PM David De Coons wo2x <RocketNJ@...> wrote:

Neal beat me to it.

?

Split/Switch is the way to go. Easy.

?

73

Dave wo2x

?

?

From: [email protected] <[email protected]> On Behalf Of Neal Pollack
Sent: Friday, January 29, 2021 1:38 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Another way to split the outputs;

?

?

On Fri, Jan 29, 2021 at 10:24 AM Michael Walker <va3mw@...> wrote:

I have a workable solution

?

(Dave, no driving and texting)? :)

?

Take the string and convert it to csv.? I can manage the rest.??

?

But, I will like to see your idea.

?

73

?

?

On Fri, Jan 29, 2021 at 1:17 PM David De Coons wo2x <RocketNJ@...> wrote:

I¡¯ve got a solution. I should be home in 1/2 hr.

?

Dave wo2x

?

?

Sent from my waxed string and tin cans.?



On Jan 29, 2021, at 1:11 PM, Michael Walker <va3mw@...> wrote:

?

Hi Neal

?

Yes, that is the status of 8 relays that I need to break out so I can build an LED panel (so to speak)

?

Mike?

?

On Fri, Jan 29, 2021 at 1:09 PM Neal Pollack <nealix@...> wrote:

Mike:

?

I don't have the actual answer, but I *think* I understand how to describe what you want:

?

Given a binary string of 1's and 0's such as, for example, 10010110 , parse out each digit position, and assign?each digit to
a separate boolean variable name set to 1 or 0.? ? Is that what?you're looking for?

?

Neal

?

On Fri, Jan 29, 2021 at 9:52 AM Michael Walker <va3mw@...> wrote:

Hi All

?

I have a string I need to parse of 8 binary values being returned from a relay board

?

10000000

?

What is the best way to parse out the status of each of these relays???

?

I looked at 'string' but I can't see a method that allows me to pull the boolean out 1 at a time.

?

thoughts?

?

Mike va3mw

?


Re: Parsing a string

 

Dave, Neal

I'm close, but if I follow web instructions, I am having an issue turning that into a true or false.? ??

I'm getting 'undefined' on the exit of the switch node.

Mike?

image.png


On Fri, Jan 29, 2021 at 1:53 PM David De Coons wo2x <RocketNJ@...> wrote:

Neal beat me to it.

?

Split/Switch is the way to go. Easy.

?

73

Dave wo2x

?

?

From: [email protected] <[email protected]> On Behalf Of Neal Pollack
Sent: Friday, January 29, 2021 1:38 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Another way to split the outputs;

?

?

On Fri, Jan 29, 2021 at 10:24 AM Michael Walker <va3mw@...> wrote:

I have a workable solution

?

(Dave, no driving and texting)? :)

?

Take the string and convert it to csv.? I can manage the rest.??

?

But, I will like to see your idea.

?

73

?

?

On Fri, Jan 29, 2021 at 1:17 PM David De Coons wo2x <RocketNJ@...> wrote:

I¡¯ve got a solution. I should be home in 1/2 hr.

?

Dave wo2x

?

?

Sent from my waxed string and tin cans.?



On Jan 29, 2021, at 1:11 PM, Michael Walker <va3mw@...> wrote:

?

Hi Neal

?

Yes, that is the status of 8 relays that I need to break out so I can build an LED panel (so to speak)

?

Mike?

?

On Fri, Jan 29, 2021 at 1:09 PM Neal Pollack <nealix@...> wrote:

Mike:

?

I don't have the actual answer, but I *think* I understand how to describe what you want:

?

Given a binary string of 1's and 0's such as, for example, 10010110 , parse out each digit position, and assign?each digit to
a separate boolean variable name set to 1 or 0.? ? Is that what?you're looking for?

?

Neal

?

On Fri, Jan 29, 2021 at 9:52 AM Michael Walker <va3mw@...> wrote:

Hi All

?

I have a string I need to parse of 8 binary values being returned from a relay board

?

10000000

?

What is the best way to parse out the status of each of these relays???

?

I looked at 'string' but I can't see a method that allows me to pull the boolean out 1 at a time.

?

thoughts?

?

Mike va3mw

?


Re: Parsing a string

 

¿ªÔÆÌåÓý

Neal beat me to it.

?

Split/Switch is the way to go. Easy.

?

73

Dave wo2x

?

?

From: [email protected] <[email protected]> On Behalf Of Neal Pollack
Sent: Friday, January 29, 2021 1:38 PM
To: [email protected]
Subject: Re: [nodered-hamradio] Parsing a string

?

Another way to split the outputs;

?

?

On Fri, Jan 29, 2021 at 10:24 AM Michael Walker <va3mw@...> wrote:

I have a workable solution

?

(Dave, no driving and texting)? :)

?

Take the string and convert it to csv.? I can manage the rest.??

?

But, I will like to see your idea.

?

73

?

?

On Fri, Jan 29, 2021 at 1:17 PM David De Coons wo2x <RocketNJ@...> wrote:

I¡¯ve got a solution. I should be home in 1/2 hr.

?

Dave wo2x

?

?

Sent from my waxed string and tin cans.?



On Jan 29, 2021, at 1:11 PM, Michael Walker <va3mw@...> wrote:

?

Hi Neal

?

Yes, that is the status of 8 relays that I need to break out so I can build an LED panel (so to speak)

?

Mike?

?

On Fri, Jan 29, 2021 at 1:09 PM Neal Pollack <nealix@...> wrote:

Mike:

?

I don't have the actual answer, but I *think* I understand how to describe what you want:

?

Given a binary string of 1's and 0's such as, for example, 10010110 , parse out each digit position, and assign?each digit to
a separate boolean variable name set to 1 or 0.? ? Is that what?you're looking for?

?

Neal

?

On Fri, Jan 29, 2021 at 9:52 AM Michael Walker <va3mw@...> wrote:

Hi All

?

I have a string I need to parse of 8 binary values being returned from a relay board

?

10000000

?

What is the best way to parse out the status of each of these relays???

?

I looked at 'string' but I can't see a method that allows me to pull the boolean out 1 at a time.

?

thoughts?

?

Mike va3mw

?