nodejs-poolController

el duderino

Well-known member
Jun 15, 2008
192
Austin, TX
Pool Size
25000
Surface
Plaster
Chlorine
Liquid Chlorine
Many here may be familiar with the amazing project of @tagyoureit for controlling the Pentair Intelli-line of products. It takes the rs485 serial information and allows it to be digested in various ways.

Not being very technical, I've struggled a bit with it on my Intelliflo, so I was hoping to maybe create a post here to keep up with troubleshooting, and getting this out there a bit more, as it seems to be a pretty niche crowd lol.

If anyone (especially @tagyoureit) has an issue with this approach, I'll gladly remove. I just find the Gitter system in general hard to manage.

 
  • Like
Reactions: MyAZPool
Ok, I will bite.

Just installed nodejs and it seems to be working. What is everyone doing to make sure that it restarts when the Pi reboots. The NodeJS folks seem to like PM2, but I cannot get that script they have posted to work.
 
Oooh, just saw this thread!
I used the /etc/init.d method which is write a startup script and drop it in that folder but I'm really thinking about switching to pm2. Where'd your script fail?

Is this the one you used? I just tried it and it failed for me too. Are you using n to install the old node.js version?

How to get PM2 installed and running poolController on RPi or Linux
  1. Install PM2 with npm sudo npm install -g pm2
  2. Quit nodejs-poolController if its running.
  3. Launch nodejs-poolController with PM2 pm2 start /home/pi/nodejs-poolController/src/index.js —name=“poolController” —watch
  4. Adding the —watch in the line above will auto restart the app if you make a change such as an update with git pull. If you don’t want that action to occur simply don’t include the watch flag.
  5. Run pm2 ls to see your app(s) running with pm2. It will show uptime of the app and reset counter.
  6. Type pm2 startup If you want pm2 to auto-start at boot (recommended). This command will give you a command based on your platform to run so pm2 starts on its own. pm2 unstartup will reverse this behavior.
  7. Finally run pm2 save to save what apps you have running so if your machine reboots or crashes, it when PM2 starts back up again it will launch your saved apps again.
 
Many here may be familiar with the amazing project of @tagyoureit for controlling the Pentair Intelli-line of products. It takes the rs485 serial information and allows it to be digested in various ways.

Not being very technical, I've struggled a bit with it on my Intelliflo, so I was hoping to maybe create a post here to keep up with troubleshooting, and getting this out there a bit more, as it seems to be a pretty niche crowd lol.

If anyone (especially @tagyoureit) has an issue with this approach, I'll gladly remove. I just find the Gitter system in general hard to manage.


If you type 'od -x < /dev/ttyUSB0' at a command prompt do you get gibberish or does nothing show up?

Also run 'node -v' and tell me what the output is?
 
Oooh, just saw this thread!
I used the /etc/init.d method which is write a startup script and drop it in that folder but I'm really thinking about switching to pm2. Where'd your script fail?

Is this the one you used? I just tried it and it failed for me too. Are you using n to install the old node.js version?

How to get PM2 installed and running poolController on RPi or Linux
  1. Install PM2 with npm sudo npm install -g pm2
  2. Quit nodejs-poolController if its running.
  3. Launch nodejs-poolController with PM2 pm2 start /home/pi/nodejs-poolController/src/index.js —name=“poolController” —watch
  4. Adding the —watch in the line above will auto restart the app if you make a change such as an update with git pull. If you don’t want that action to occur simply don’t include the watch flag.
  5. Run pm2 ls to see your app(s) running with pm2. It will show uptime of the app and reset counter.
  6. Type pm2 startup If you want pm2 to auto-start at boot (recommended). This command will give you a command based on your platform to run so pm2 starts on its own. pm2 unstartup will reverse this behavior.
  7. Finally run pm2 save to save what apps you have running so if your machine reboots or crashes, it when PM2 starts back up again it will launch your saved apps again.

So this script actually runs, but does not actually launch the pool controller. I did use n before to downgrade the node.js version. But I then decided just to re image my SD card with an older version that I know worked well. So now I am running 10.20.1.

I can launch the poolController manually, but PM2 does not seem to launch it, although when I do a PM2 status it says it is running.
 
Cliff, you make any progress with PM2?

Also do you have a copy of the script you run in Init.d? For some reason I can manually run my script but it does not work on reboot.
 
@Katodude, I use PM2 and it works. I recently added the new fork and the separate front end app, and redid the script and have them both starting at start-up. If you're still having issues, I'll send exactly what I did.
 
  • Like
Reactions: cmc0619
To launch dashPanel, compile the app (`npm run build`). Now that it's compiled you can run `pm2 start dist/app.js` from the main dP directory. PM2 will see the .js extension and run the app in node under the PM2 daemon. Then you can run `pm2 startup` and `pm2 save` to freeze the state. See PM2 - Single Page Doc.

Every time you pull a new version of dP, run the build script again and restart the pm2 process and it will pick up the new files. Don't forget to ctrl-f5 in the browser to force a reload of any new scripts that come along with the new version.
 
  • Like
Reactions: MyAZPool

Enjoying this content?

Support TFP with a donation.

Give Support
Thread Status
Hello , This thread has been inactive for over 60 days. New postings here are unlikely to be seen or responded to by other members. For better visibility, consider Starting A New Thread.