97538ebb7035b4becf1eec64a8a36f8f6ab2d35b
MySQL and SQLite working * commit '667f6540773b6a556171c20a16996b32d334fc05': Able to switch back and forth between MySQL and SQLite Moved location to /root/tagserver MySQL working, need to retro SQLite Converted to CoffeeScript, data in MySQL Added connect statement to connect to db before trying to INSERT reading tags from mysql and writing values to mysql added Tag classes for MySQL and SQLite Updated gitIgnore
POCloud Tag Server
Written by Patrick McDonagh, Henry Pump
Prerequisites
- NodeJS
- Pyton 2.7
- npm
- Either SQLite or MySQL (not completely developed)
- Bower
npm install -g bower
- forever (if intending to run continuously)
npm install -g forever
Installation
-
Clone this repository using either HTTPS:
git clone https://patrickjmcd@bitbucket.org/patrickjmcd/tagserver.gitor SSH:
git clone git@bitbucket.org:patrickjmcd/tagserver.git -
Create the necessary database file:
for MySQL run mysql -u root -p < www/dbcreate_MySQL.sqlor
for SQLite run sqlite3 /mnt/usb/data.db < www/dbcreate_SQLite.sql -
Install necessary npm packages
npm install -
Install necessary bower packages
bower install -
Create init.d scripts
INFO HERE COMING SOON -
Test Web Server functionality
node www/app.jsProceed to http://:3000 to test the web server and set up tags.
-
Enter tag information in web server.
-
Set IP of PLC in web server. Without configuration, the program will default to looking for the PLC at 192.168.1.10.
-
Test the Python datalogger functiality.
python python/tagserver_<dbtype>.pyThe program should return messages saying it has stored values. If errors occur, check the PLC ip address. If errors persist, contact Henry Pump.
-
Start the init.d scripts so the programs run in the background.
/etc/int.d/tagserver startand
/etc/init.d/website start OR forever www/app.js
API Documentation
app.post('/json/tag/add', fns.createTag); // Adds a tag to the scan list
app.post('/json/tag/update/', fns.updateTag); // Updates tag data
app.get('/json/tag/delete/:tag', fns.deleteTag); // Removes a tag from the scan list
app.get('/json/tag/:id', fns.getTag); // Gets a specific tag in the scan list
app.get('/json/tag', fns.getAllTags); // Lists all tags in the scan list
app.get('/json/val/:tag', fns.latestValueSingleTag); // Gets the latest value of a single tag
app.get('/json/series/:tag/:hours', fns.seriesTagValues); // Gets all the values of a tag for the last X hours
app.get('/json/valBetween/:tag/:startDatetime/:endDatetime', fns.seriesTagValuesBetween); // Gets the values of a tag between the start time and end time
app.get('/json/CSV/all', fns.allDataCSV); // Gets a CSV of all values stored
app.get('/json/CSV/:tag/:startDatetime/:endDatetime', fns.seriesCSVBetween); // Gets a CSV of the values of a tag between the start time and end time
app.get('/json/CSV/:tag/:hours', fns.seriesCSV); // Gets a CSV of the values of a tag for the last x hours
app.get('/json/all', fns.latestValueAllTags); // Gets the latest values of all tags in the scan list
app.get('/json/config', fns.getSetup); // Gets the contents of the config table
app.post('/json/config', fns.updateSetup); // Adds a new parameter to the config table
app.get('/json/logger/status', fns.checkLoggerStatus); // Gets the status of the data logger
app.get('/json/logger/restart', fns.restartLogger); // Restarts the data logger
Description
Languages
Python
84.4%
C
8%
JavaScript
5%
HTML
2%
CSS
0.3%
Other
0.2%