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

Mick  W8BE
Mick W8BE 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

Hoping maybe Tim or someone else has an answer.

Regards

Comments

  • KD0RC
    KD0RC Member, Super Elmer Moderator

    Hi Mick, try this:

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

  • Mick  W8BE
    Mick W8BE 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...


  • Mick  W8BE
    Mick W8BE 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...

    Regards...

  • KD0RC
    KD0RC 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...

  • Mick  W8BE
    Mick W8BE 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.

  • KD0RC
    KD0RC 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

  • Mick  W8BE
    Mick W8BE 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

  • David Decoons, wo2x
    David Decoons, wo2x 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

  • Mick  W8BE
    Mick W8BE 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


  • KD0RC
    KD0RC Member, Super Elmer Moderator

    Glad you got it working!

  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin

    I so need to do this

  • Mick  W8BE
    Mick W8BE 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..

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

    Regards

  • Ted  VE3TRQ
    Ted VE3TRQ 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 .

  • Mick  W8BE
    Mick W8BE 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.


  • Ted  VE3TRQ
    Ted VE3TRQ 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.

  • David Decoons, wo2x
    David Decoons, wo2x 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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.