Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please refer to the product documentation or check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

SmartSDR TCP/IP Commands - Messaging

Member ✭✭

I am trying to write code for a message to pop up on SmartSDR when a client attaches. The only issue I am having is the command sequence requires the message to be enclosed in quotes. I need to put a variable in the message as it is not hard coded. I have not been able to figure out how to add the variable and it always shows up as the variable name . For example this command :

msg2 = {payload:"c16|message severity=info code=0x000010 \"${clientA} is logged on\"\r"};

shows up as

image.png

Hoping maybe Tim or someone else has an answer.

Regards

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Member, Super Elmer Moderator

    Hi Mick, try this:

    msg2 = {payload:"c16|message severity=info code=0x000010 \"" + ${clientA} + "is logged on\"\r"};

  • Member ✭✭

    Len,

    Appreciate the help. unfortunately your code copied as is throws a javascript func error in Node-Red. I substituted the beginning and end quotes for ticks and Node-Red liked it but back to same problem ...Here is the revised code and the output..

    msg2 = {payload:'c16|message severity=info code=0x000010 \"" + ${clientA} + "is logged on\"\r'};

    Output...

    image.png


  • Member ✭✭

    So I have messed with it and so far nothing seems to work...Really would like the Flex guys school me on this.. Since they send out a message with the tcp/ip address of everyone who logs in...It has to be a variable...I know the variable is there...

    image.png

    Regards...

  • Member, Super Elmer Moderator

    Sorry Mick, I forgot to ask what language... In C++, the "+" symbol can be used for string concatenation. Check to see what you do to concatenate strings in Node-Red, and do that instead of the plus signs of C++.

    Also, I noticed that you changed out the first and last double quotes with single quotes. The quote pairs no longer match up. The second quote after the / needs to be the same as the first quote. You were close before, I would start with all double quotes, just replace the plus signs with whatever Node Red uses.

    Maybe Dave, WO2X will chime in with the definitive answer...

  • Member ✭✭

    Yes I am doing it in Node-Red and the recommended syntax is 'string ${variable}' . However this does not work when connecting to the Flex on port 4992. Once again maybe Tim can chime in with words of wisdom.

  • Member, Super Elmer Moderator

    Hi Mick, I would be very surprised to see Flex jump in and try to debug user-written code. The Node Red IO group probably has folks who can get you going.

    nodered-hamradio@groups.io | Topics

  • Member ✭✭

    Dave said he is going to look at it. It really should not be this hard. Flex pushes the api but the documentation is sparse and lacking. Frustrating to see a simple issue like this taking hours instead of minutes.

    Regards

  • Member, Super Elmer Moderator

    I am in hour 8 of a power failure. When power is restored I will check into this.

    my power company is Jersey Central Power & Light or JCP&L. We call it Just **** Power & Light.

    Definitely getting a whole house generator with auto transfer switch after this …..


    73

    Dave wo2x

    Somewhere in the darkness of New Jersey

  • Member ✭✭
    edited July 2021

    With the help of Mark Hanson I was able to get the code working.... Here is the correct syntax..

    msg2 = {payload:'c16|message severity=info code=0x000010   \"' + clientA + ' is logged on\"\r'};
    

    Gives the following message on SmartSDR

    image.png


  • Member, Super Elmer Moderator

    Glad you got it working!

  • Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin

    I so need to do this

  • Member ✭✭

    A follow up note. I have the code working now that shows when clientA or clientB connects to the Flex. I got an idea to show the slice letter and ended up with this..

    image.png

    I have more testing to do before I put this into prod. It's coming along.

    Regards

  • Member ✭✭✭

    Since the other guy’s slice gives you no information about frequency or band, it might be a good idea to provide band/freq instead of pan/slice .

  • Member ✭✭

    Ted,

    Actually it does, we have a Node-Red station dashboard that show the information on both slices.. You use the drop down arrow to select the client.

    image.png


  • Member ✭✭✭
    edited July 2021

    Sorry :-) Not aware of the other things provided around this widget! I should turn one of my spare Pi’s over to Node Red and try it out.

  • Member, Super Elmer Moderator

    Ted, it is addictive!

    check out the groups.io site. That’s where we lurk.

    73 Dave wo2x

Leave a Comment