QuickCPM FTP variables explained

Forums:

I thought I would take a moment and explain the settings required for FTP using quickCPM.

Note that the FTP does not upload the gauge.min.js file. You will need to upload it to the same location before starting ftp uploads or the gauges will not work. There is an issue with uploading this file due to line characters which you can read about in the forum so I have excluded it.

If you have fixed the "no line feed" problem in the js file you can turn on the js upload by unremming the line containing: #ftp.storlines("STOR " + "gauge.min.js", open("gauge.min.js",'rb',1024))
This will upload the initial js file. As to not upload every time since it does not change you should remark it out once you have the js file uploaded. There is no sense in uploading something that does not change.

For FTP quickCPM.py now includes the ftp library called ftplib. This should be in your standard install of Raspian.
import ftplib

Next are the ftp configuration variables which need to be set for your program.
If you do not wish to use FTP, simply set the ftpOn variable to "false"

This is the loop variable and it should not be changed.
ftpLp=0
Each time it processes the CPM and Temp it increments this loop counter and used by the timer to determine if it should ftp the html files.
On first pass (zero) or if it reaches the limit (ftpLimit) , it will ftp the files and then reset the counter to 1.

ftpLimit=10
This is how many pass it will wait before uploading the html files. The lower you set this the more times it
will upload the html files. Ten means that it will upload the first time and then after 10 loops it will upload again
and start the counter over again.

workDir = r"/home/pi/bin/quickcpm" #set location of quickCPM.py
workDir is the location of the python script. It is required so that the ftpLibrary knows where the html files are that
you will be uploading. It should be the full path your quickCPM is running from.

ftpPath = r"/"
ftpPath is the complete path your ftp starts at on the host server where you want the html files to end up.
This is based off of the root where your initial ftp connection leaves you.
It must be a path however that is accessible (browsable) from your website.
An example is to create a CPM directory that is viewable on your website.
Then you would change this to "/CPM" and make sure it is viewable at http://yoursite.com/CPM/gauges.html

ftpU="ftpusername" #set ftp username
FTP username
ftpP="ftppassword" #set ftp password
FTP Password

ftpHost="ftphostname" #set ftp host
This is the FTP host server you are connecting to.
ftplib uses the standard ftp port 23 so you should not need to change it unless you have changed your ftp port or your hosting provider
uses a different ftp port.

ftpOn=true #use ftp
This is the on off switch for using ftp. Set to true to enable ftp uploads or false to disable it.