Is using Firestorm the right way to go

In addition to Wizard’s link… I don’t really know my way around Node, but I’ve gotten similar messages and if you have other stuff on your system that needs that early system node (v8.10.0), you can use Node Version Manager (nvm) to quickly install a LTS (long term support) version of Node like this:

nvm install v14.15.4
# then
nvm use v14.15.4
# or
nvm alias default v14.15.4
2 Likes

Yeah finally got it to work. So thanks to Wizard and Jeff for pointing me in the right direction.
Had to remove Apache2 to get it to work.
Couldn’t use port 80 so set server to 3000 .
I now have the Firestorm server working and can access it from my main pc.
Got the 0.0.0.0:3000/discover to work. But can’t seem to change the patterns.
Its fairly late here, so I must be missing something really obvious. So going to sleep on it.

I can now change the patterns in a web browser using the GET command but for some reason I can’t get the POST command to work.
And Loxone still won’t communicate with Firestorm. But at least I am a step or two nearer.

@TechDoctor,
I didn’t see HTTP POST support in Loxone.

The GET flavor command supports the same stuff as the POST flavor command, so you don’t POST unless it is more convenient for you.

What Loxone script are you trying? It looks like a subset of C, so we might be able to help with at least that part.

Yeah got it working.
@wizard I am using the Loxone virtual outputs rather than the Pico C scripting, much easier.
So you set up a Virtual output with the ip address of the computer firestorm is running on so in my case this is http://192.168.1.101:3000
So once you have done this you then create a virtual output command for each pattern or command you wish to send.
So I have a pattern called White
So in the virtual command where is says command for on you enter
/command?command=%7B%22programName%22%3A+%22White%22%7D&ids=3601529
Set HTTP Method for ON to POST and leave everything else as is or blank.
Now you need to set up a virtual input to trigger the virtual command. Set this to push button join this to the virtual command. And that its.
So far I have only done two commands but at least it works.

This also means I can remotely control the PixelBlaze when away from the house if I want to.

1 Like

Ahhh. Just got mi RPi 4 4GB. Followed the instructions to install Firestorm. All worked OK, just had a power outage, and when the power came back on Firestorm doesn’t run. So I thought I will re-install everything. I now get this error message

env: ‘/usr/lib/node_modules/pm2/bin/pm2’: No such file or directory

The command I used was

sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi

So not too sure what to do now.
The only thing I have found out is that the node_modules directory doesn’t exist.

Hi @TechDoctor,
I think the location of pm2 moves around between versions. What do you get if you run

which pm2

If a path pops up, and is different, try replacing it in the instructions.

BTW you only need to get that once to set pm2 to run on startup. If it is running on startup, then this is the key bit that causes pm2 to load Firestorm:

Note, be sure your alias is still active before running these!

pm2 start server.js 
pm2 save

You should see an entry for Firestorm if you query pm2 for a list of services:

pm2 list
1 Like

Many thanks got there eventually. The path was incorrect. For anyone else having similar problems the path is

/usr/local/bin/pm2

so the command you use at this point will be

#run pm2 on boot
sudo env PATH=$PATH:/usr/bin /usr/local/bin/pm2 startup systemd -u pi --hp /home/pi

And note there is a space between …/bin and /usr/local…
Once I followed your instructions I rebooted the PI and then waited a few minutes to makes sure everything was up and running and it works. Will reboot later to see if it all works again.

1 Like

Looks like I spoke too soon, it has stopped working. Will try and figure out what is going on and report back.
This is what I get when the command yarn server is run

listening on 80
Pixelblaze Discovery Server listening on 0.0.0.0: 1889
events.js:174
throw er; // Unhandled ‘error’ event
^

Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (net.js:1263:19)
at listenInCluster (net.js:1328:12)
at Server.listen (net.js:1415:7)
at Function.listen (/home/pi/Firestorm/node_modules/express/lib/application.js:618:24)
at Object. (/home/pi/Firestorm/server.js:24:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Emitted ‘error’ event at:
at emitErrorNT (net.js:1307:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

When I do the

pm2 list

I get

pm2 list

Thats it for now

I am back to using my ubuntu install on my laptop, to see if there is anything funny going on. But Firestorm runs perfectly.
But when I do **pm2 list ** the fields are empty
But it is working . I am at a loss as to what to do now.

@TechDoctor,
pm2 is a tool for running nodejs services in the background. Running yarn server runs Firestorm in your terminal but pm2 is already running it for you in the background.

You do not need to run yarn server anymore. Once pm2 is set up to run Firestorm on startup (and this appears to be the case now), you wont be able to run another copy on the same port and you will see errors like above. If you reboot your Pi, you should be able to get to Firestorm via browser by pointing it at your Pi’s IP address.

It is possible to get pm2 to run Firestorm without permission to use port 80, which is what all of the alias and authbind stuff is about in the instructions. On most Linux/unix systems port 80 (and all ports below 1024) are restricted to authorized users on the system. The authbind stuff is what allows the pi user to run Firestorm on port 80.

You can see the console output (and more) of Firestorm when it is running via pm2 by running this:

pm2 logs server --lines 1000 --nostream

This will show the last 1000 lines of both the error and stdout streams.

If you see something like “Error: listen EACCES: permission denied 0.0.0.0:80” in the pm2 log, then permissions aren’t set up properly to allow pm2 to use port 80. It is critical that pm2 be run via authbind, like so:

authbind --deep pm2

Which is what the alias command in the instructions is all about. I make note if this in the instructions here:

alias pm2='authbind --deep pm2'

#...

#I believe the pm2 alias with authbind is critical here
#alternatively `authbind --deep pm2 start server.js` might work
pm2 start server.js 
pm2 save

Try rebooting fresh, once online, can you access Firestorm at the Pi’s IP on port 80? If not, try running these 3 commands above (in the Firestorm directory) again.

You can also verify that the authbind config for port 80 exists, and is owned by pi by running

ls -l /etc/authbind/byport/80
1 Like

Now I did see this in the log file, so re did the alias command and then
pm2 start server.js
I get the message

[PM2][ERROR] Script already launched, add -f option to force re-execution

Then did the pm save command.
Which appears to be successful.
Doing the
ls -l /etc/authbind/byport/80
I get -rwxr-xr-x 1 pi root 0 Feb 9 19:51 /etc/authbind/byport/80

I feel I am doing something really silly for it not to work. But I did follow the original instructions to the letter and then where needed changed directory paths.
So still not working.
Ah just had a thought I do have XRDP running on the Pi so I can remote login from my windows pc would that cause any problems.

Update.
XRDP uses 0.0.0.0 so just deleted it.
Installed Putty on my Windows PC
Still can’t get it to work after re-installing on the PI.
I think I will start again with a fresh Pi OS install, and redo it. Fingers crossed.

I hate to ask and don’t mean to be pedantic, but did you use the -f option? Otherwise I imagine the command didn’t do anything.

If it still didn’t work with -f you can delete the entry and that should allow you to re-add it.

pm2 delete server

Do you have another webserver using port 80? If so, then yes there is a conflict. Firestorm also needs port 1889, but that is much less common.

What do you get when you run this?

sudo netstat -ltnp | grep 80 

You can run Firestorm’s webserver on a different port using the PORT environment variable. I think modifying the start command with something like this should work as pm2 docs say they pick up the environment, though I haven’t tested it:

PORT=3000 pm2 start server.js

I also recommend that you run pm2 flush to clear out the logs so you can more easily see if a change produces no errors.

pm2 list 2.0

I take it there should only be one Server running.

I think I am going to re-install the Pi OS. Will be quicker for everyone and safer on my sanity I think.
Thanks for all your help its been amazing.

Ah, it seems the -f option doesn’t replace, but force-adds. Hopefully some pm2 delete server commands would clear that up, as would a full reinstall!

One full re-install later.
Port 80 doesn’t work so this is what I did.

pm2 delete server

Then did

pm2 list

to make sure server wasn’t running
Then as per your suggestion did

PORT=3000 pm2 start server.js

Then this is the important bit or else when you reboot it goes back to port 80, you need to do

pm2 save

A quick read of the pm2 docs pointed me to this. I noticed the startup file used the command pm2 resurrect . Which brings back previously saved processes (via pm2 save).

Rebooted and it all works on port 3000

So once again many thanks and got there in the end.

The website for pm2 docs is https://pm2.keymetrics.io/docs/usage/quick-start/

2 Likes

A year later and this info has not been added to the readme doc. It would be extremely helpful if the instructions for installing firestorm on raspberry pi could be updated to include this info. Pixel Blaze was recommended to me by a friend specifically because of the firestorm functionality and I was shocked at how little documentation there was for this particular feature. Especially considering how amazing the and thorough the docs are for the rest of the product.

I just had the exact same problems with a freshly flashed image of raspbian and following the instructions to a tee. After finding this thread, the steps documented here have gotten everything working! It seems like it would be a very small amount of editing to correct the readme, but would really help new customers! If the details for how to access the UI could be added to the appropriate section, that would also be awesome!

@daderaide - Hey! Thanks for joining the forum.

I’ve never used an RPi, but I just ordered one so I can try it out. I’m sure the Firestorm docs used to be correct, but I assume they got stale over time as the default packages that ship with a RPi changed.

Have you ever tried submitting a pull request before? If not, I can understand why it’s a little daunting. The pull request process (PR) is how anyone can fix the documentation for everyone else.

Anyway, without a relatively virgin Raspberry Pi myself, I’d be scared to update the docs and assume I can insert the specific commands in the thread above into the existing docs and have it be correct for most people. The RPi I just ordered will be for this purpose. I’ll try to see what I can do to also add the other sections you mention, like how to access a Firestorm UI.

1 Like

Thanks for that great info and the warm welcome! I had no idea I was aloud to update the doc myself. I assumed the developer had special permission to do that. I have never submitted a pull request, but I will google it and learn about it. I would be more than happy to make those few small updates! I have a RPi 3B, 3B+ and 4 that I can try everything on. If you get to it first, then that works too! I’m not a developer, just an enthusiast, but I’m very good at following instructions and reading forums, and I usually find a solution eventually.

1 Like

My Raspberry Pi 4 came yesterday, so I tested things out and added steps that are confirmed working for fresh installs of both of the most recent Raspbian distros (buster and bullseye). I also added how to access the UI and a screenshot.

If anyone else has further clarifications they think would help, PRs are welcome!

1 Like

Thank you Jeff! Really appreciate the update and testing!