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 check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

FRStack REST API Access: Node-Red Example

Alan
Alan Member ✭✭✭
edited August 2020 in Third-Party Software
With the latest release of FRStack, Mark has added the ability for “non-local” clients to connect to his REST API.   Previously, the client had to be local to the machine running FRStack to access the REST API.   This worked well for the users of Stream Deck, but had to be "local".  Thank you very much, Mark, for this addition.

With these changes, we can now access Mark’s library of easy to use REST commands available on FRStack using Node-Red.   This compliments Mark’s UDP broadcast of Flex Meter Data.

The same could be accomplished by writing code to access the Flex API directly, but I found that mostly over my head and by using FRStack as the “in-between”, I can take advantage of the simplicity and added functionality that FRStack provides.

As an example, I wanted to add a “Tune” button to my Node-Red Dashboard for control of my Palstar LA1K amp.  I wanted to inhibit the RCA TX3 when I push the button, to prevent the amp from transmitting during the tuning process.

To do this, I added the command, “http://192.168.50.150:13522/api/radio/tune?param=1" to a Node-Red HTTP request node ("0" to stop tuning).  To provide the RCA TX3 inhibits while tuning, I used the options menu on FRStack, “Tune RCA TX Control” to inhibit TX3 when tuning.    All done…..simple.

Another example of the functionality of Node-Red, I added a “PTT Gate” to the LA1K PTT output from RCA TX3.    The gate closes if the TX power of the Flex is above 50% power.  I do this with a relay and a GPIO pin output from Node-Red.   This ensures I do not overdrive the LA1K amp.   I have an LED on my dashboard to show the power set point and if the gate is open or closed.

Here is a screenshot of my control dashboard, including the Tune Button and Flex Meter data, derived from FRStack.


I can share any portion of this as anyone requests

Alan

WA9WUD


Comments

  • K6HN
    K6HN Member ✭✭
    edited April 2020
    Hi Alan,

    Thanks for sharing your work. I use node-red for other applications and would be interested in seeing you node-red code to help me develop my own version of your dashboard.

    Gary
    K6HN

  • Alan
    Alan Member ✭✭✭
    edited April 2020
    Gary

    Flows sent to your QRZ.com e-mail.

    On the individual flows, you will see most outputs of the flows go to an MQTT Broker.  I have "satellite" Rasberry Pis which receives the outputs via MQTT to operate relays and provide inputs from various voltage, current, and temperature sensors.

    If you need those, let me know.


    Alan
  • John Orjias
    John Orjias Member ✭✭

    i must be missing something. i have installed the latest version and it still requires the hostname to be localhost, if i try to connect from a remote client and use the ip where frstack is running it just comes back with the webservice saying 400 hostname Bad Request - Invalid Hostname (clearly frstack is returning this, if i stop it i just get the browser reporting the site cant be found)

    I guess he has not set in the webservice to have the api to be the default regardless of hostname? is this only a feature for the portable version for linux? and not a feature for the windows UI version?

  • Alan
    Alan Member ✭✭✭

    Mark provides steps to allow external access to the REST commands in the Help/REST file. Click on "Help".

    In summary you must:

    • start FRStack with Admin privileges
    • change the FRStack configuration file to allow non "localhost" IPs
    • add a rule to your windows firewall for the REST port and IP address.

    Details in the Help File

    Alan

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.