FlowFuse device-agent

Is anyone running the FlowFuse device-agent on EPIC or RIO in lieu of the Node-RED environment available natively on these devices?

Iā€™ve had it running a few times in the lab to test.
There are some issues and Opto is working with the FlowFuse folks to get it sorted.
Not much of an answer I know, but you are welcome to try it yourself with a shell license.
We will have a lot more to say about running the Agent on our groov family hardware once its sorted.

3 Likes

Cool, thanks for the info.

Great to hear that youā€™re working through this with FlowFuse. Iā€™m definitely interested in this.

Mostly because Iā€™m interested in getting PCs (IT doesnā€™t favor linux) out of my factory. RIO seems like a good solution, but Iā€™m also a FlowFuse user and donā€™t really want more Node-Red without FlowFuse.

The ā€œyouā€™re welcome to try it yourselfā€ comment combined with the fact that this RIO/FlowFuse piece is in development would suggest itā€™s not quite ready yet. What types of problems are you working through that I may anticipate looking for if I try myself?

The issue Iā€™m trying to get past is that it seems that none of the authentication data/creds is sent down to the agent, thus interfacing with the groov I/O nodes fails.

Once we get past that, we can explore more of its features and see what our integration options might be.

Short version: It works!

Long version: <get coffee, its going to be long>
Turns out, I think the timing of my first rounds of testing was just the perfect storm of too soon and using the local file system to self host the FlowFuse ā€˜serverā€™ and not understanding pipelines.

In other words, I self induced a ā€˜failureā€™ that I misunderstood that got caught up in the timing of FlowFuse moving from local file system to docker to their cloud offerings.
No matter. Lets move forward.

From the EPIC (not tested on RIO yet, but will do ASAP, but wanted to assure everyone on this thread as quickly as possible that everything is working as expected), I did this as root/sudo. I need to clarify what parts need to be sudo and what parts donā€™t, but hey, life on the edge, lets become root and get it running!

npm install -g @flowfuse/device-agent

That will get the agent installed cleanly.
Then I created a 14 day free demo account on FlowFuse
Of course, if you already have an account, you can just add a device.

Once the device is added, you need to add run the command in the termial you have open to your groov EPIC:

image

Note that the screenshot was done after my first go around, so the names donā€™t match.

root@opto-04-35-a6:~# flowfuse-device-agent -o actual-perfectly-forth -u https://app.flowfuse.com
[AGENT] 11/14/2024 9:15:07 PM [info] Entering Device setup...
[AGENT] 11/14/2024 9:15:08 PM [info] Device setup was successful
[AGENT] 11/14/2024 9:15:08 PM [info] To start the Device Agent with the new configuration run the following command:
[AGENT] 11/14/2024 9:15:08 PM [info] flowfuse-device-agent
root@opto-04-35-a6:~# flowfuse-device-agent
[AGENT] 11/14/2024 9:16:25 PM [info] FlowFuse Device Agent
[AGENT] 11/14/2024 9:16:26 PM [info] ----------------------
[AGENT] 11/14/2024 9:16:26 PM [info] Agent starting...
[AGENT] 11/14/2024 9:16:26 PM [info] Version: 3.0.0
[AGENT] 11/14/2024 9:16:26 PM [info] Mode: Device Mode
[AGENT] 11/14/2024 9:16:26 PM [info] Device: zpGrWWM3rv
[AGENT] 11/14/2024 9:16:26 PM [info] ForgeURL: https://app.flowfuse.com
[AGENT] 11/14/2024 9:16:26 PM [info] Configuration :-
[AGENT] 11/14/2024 9:16:26 PM [info]   * Instance           : unknown
[AGENT] 11/14/2024 9:16:26 PM [info]   * Snapshot           : none
[AGENT] 11/14/2024 9:16:26 PM [info]   * Settings           : none
[AGENT] 11/14/2024 9:16:26 PM [info]   * Operation Mode     : autonomous
[AGENT] 11/14/2024 9:16:26 PM [info]   * Target State       : running
[AGENT] 11/14/2024 9:16:26 PM [info]   * Licensed           : unknown
[AGENT] 11/14/2024 9:16:31 PM [info] Starting MQTT heartbeat thread. Interval: 30s (Ā±5s)
[AGENT] 11/14/2024 9:16:32 PM [info] MQTT connected
[AGENT] 11/14/2024 9:16:32 PM [info] License enabled
[AGENT] 11/14/2024 9:16:32 PM [info] New application assigned
[AGENT] 11/14/2024 9:16:33 PM [info] Launching with new settings...
[AGENT] 11/14/2024 9:16:33 PM [info] Configuration :-
[AGENT] 11/14/2024 9:16:33 PM [info]   * Application        : XJ4nPZWmAP
[AGENT] 11/14/2024 9:16:33 PM [info]   * Snapshot           : none
[AGENT] 11/14/2024 9:16:33 PM [info]   * Settings           : b7d727b2788c0ebe7498c1ff09ab3816965482cc8dc41a2f8816b10ea392a623
[AGENT] 11/14/2024 9:16:33 PM [info]   * Operation Mode     : autonomous
[AGENT] 11/14/2024 9:16:33 PM [info]   * Target State       : running
[AGENT] 11/14/2024 9:16:33 PM [info]   * Licensed           : yes
[AGENT] 11/14/2024 9:16:33 PM [info] Environment :-
[AGENT] 11/14/2024 9:16:33 PM [info]   * FF_DEVICE_ID       : zpGrWWM3rv
[AGENT] 11/14/2024 9:16:33 PM [info]   * FF_DEVICE_NAME     : benEPIC4
[AGENT] 11/14/2024 9:16:33 PM [info]   * FF_DEVICE_TYPE     : Opto22 EPIC PR1
[AGENT] 11/14/2024 9:16:33 PM [info]   * FF_APPLICATION_ID  : XJ4nPZWmAP
[AGENT] 11/14/2024 9:16:33 PM [info]   * FF_APPLICATION_NAME: Ben Orchard's Application
[AGENT] 11/14/2024 9:16:33 PM [info]   * FF_SNAPSHOT_ID     : 0
[AGENT] 11/14/2024 9:16:33 PM [info]   * FF_SNAPSHOT_NAME   : None
[AGENT] 11/14/2024 9:16:33 PM [info] Updating configuration files
[AGENT] 11/14/2024 9:16:33 PM [info] Installing dependencies
[AGENT] 11/14/2024 9:17:46 PM [info] MQTT reconnecting to platform
[AGENT] 11/14/2024 9:17:47 PM [info] MQTT connected
[AGENT] 11/14/2024 9:18:25 PM [info] Updating theme files
[AGENT] 11/14/2024 9:18:25 PM [info] Starting Node-RED
[NR] 11/14/2024 9:18:30 PM [info]

Welcome to Node-RED
===================

[NR] 11/14/2024 9:18:30 PM [info] Node-RED version: v4.0.5
[NR] 11/14/2024 9:18:30 PM [info] Node.js  version: v20.12.2
[NR] 11/14/2024 9:18:30 PM [info] Linux 5.15.91-rt57-fslc-fslc+g2d9e36e5f74f arm LE
[NR] 11/14/2024 9:18:33 PM [info] Loading palette nodes
[NR] 11/14/2024 9:18:35 PM [info] FlowFuse Assistant Plugin loaded
[NR] 11/14/2024 9:18:35 PM [info] FlowFuse Light Theme Plugin loaded
[NR] 11/14/2024 9:18:35 PM [info] FlowFuse Dark Theme Plugin loaded
[NR] 11/14/2024 9:18:35 PM [info] FlowFuse Team Library Plugin loaded
[NR] 11/14/2024 9:18:39 PM [info] Settings file  : /opt/flowfuse-device/project/settings.js
[NR] 11/14/2024 9:18:39 PM [info] Context store  : 'memory' [module=memory]
[NR] 11/14/2024 9:18:39 PM [info] Context store  : 'persistent' [module=localfilesystem]
[NR] 11/14/2024 9:18:39 PM [info] User directory : /opt/flowfuse-device/project
[NR] 11/14/2024 9:18:39 PM [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
[NR] 11/14/2024 9:18:39 PM [info] Flows file     : /opt/flowfuse-device/project/flows.json
[NR] 11/14/2024 9:18:39 PM [error] Unable to listen on http://127.0.0.1:1880/device-editor/
[NR] 11/14/2024 9:18:39 PM [error] Error: port in use
[AGENT] 11/14/2024 9:18:39 PM [info] Node-RED stopped unexpectedly - restarting

I then got a lot of ā€˜port in useā€™ errors till I turned off the Node-RED running on EPIC via the usual groov Manage interface.
Not sure if we will have the option to run the Agent and the local Node-RED or notā€¦ a future test / question, but for now, turn off Node-RED first and you wont get that error. Note, if your already using Node-RED on EPIC, then you will have to figure out if you can move the existing flows into FlowFuse etc. Leaving that one for you to figure out.

Once Node-RED on the EPIC is turned off, the agent is happy and we can now add our application to a Pipeline and send it to the deviceā€¦ and at that point, everything works as expected.

Right now, if you close your (in my case) PuTTY session, the agent stops.
So once I knew everything was working, after I ran the named command, rather than starting the agent and seeing the commands scroll past as I messed with developer mode etc, I simply used a nohup and & like this:

 nohup flowfuse-device-agent &

Hitting enter returns me to the terminal and I can close PuTTY etc and the agent keeps running.
Of course, you can use screen or your preferred Linux method of keeping long running processes running.
Note that if the EPIC reboots, the agent will not start, so you need to add it to crontab @reboot etc.

Thanks a ton to the FlowFuse guys for working with us and patiently explaining where my self-induced error crept in.

Really excited to demo this to the software engineers at Opto and seeing how we can clean up this process and get the agent more tightly integrated.

Please let us know if you are using the FlowFuse Agent on groov hardware and if you can share some how and why, that would be really appreciated.

5 Likes