Name: PFC
Owner: Common Garden
Description: Personal food computer driver.
Created: 2017-12-07 20:08:41.0
Updated: 2017-12-08 16:10:08.0
Pushed: 2017-12-11 19:07:59.0
Homepage: null
Size: 8
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Personal food computer driver. A work in progress.
Install the latest version of Node. Todo this, either search for an article to help walk you through it or run the following:
https://nodejs.org/dist/v8.9.1/node-v8.9.1-linux-armv7l.tar.xz
-xvf node-v8.9.1-linux-armv7l.tar.xz
ode-v8.9.1-linux-armv7l
Then copy to /usr/local
:
cp -R * /usr/local/
Test that's it's working with node -v
.
Once node.js is working, you're ready for the rest:
apt-get update
apt-get install wiringpi usbrelay git i2c-tools
clone https://github.com/CommonGarden/PFC
FC
install
node pfc.js
By default, the example driver connects to https://grow.commongarden.org.
To change this see the bottom of the example-device.js
file. It currently reads.
owHub.connect({
host: 'grow.commongarden.org',
port: 443,
ssl: true
;
For development it's easier to simply connect to you local computer. Find your computer's IP address and change the host
, port
, and ssl
options:
owHub.connect({
host: '10.0.0.198', // The ip address of the host
port: 3000, // The port you are running Grow-IoT on
ssl: false
;
Once you're happy with your driver you'll want to start it on boot in case your device looses power.
Install forever globally.
npm install forever -g
Then create a new text file in/etc/init.d/
:
nano /etc/init.d/grow
Paste in the follow (note this assumes you installed Grow-Hub in the home
folder for a user named pi
):
in/bash
c/init.d/grow
rt PATH=$PATH:/usr/local/bin
rt NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules
"$1" in
t)
sudo forever --sourceDir=/home/pi/PFC -p /home/pi/PFC pfc.js
)
sudo forever stop --sourceDir=/home/pi/PFC pfc.js
"Usage: /etc/init.d/grow {start|stop}"
1
0
Make it executable with the following command:
d 755 /etc/init.d/grow
Feel free to test it:
etc/init.d/grow start/stop
If all goes well, make it bootable:
update-rc.d grow defaults
To remove it from boot:
update-rc.d -f grow remove
One last step, edit the /etc/rc.local file.
nano /etc/rc.local
Insert the following line before exit 0
:
etc/init.d/grow start
Reboot and your pi should start into the Grow-Hub driver.