#!/usr/bin/python # # Script to be run to save # sensor data on server VM 199.188.100.82 # and then cause plots to be generated there import os import update_server path = "/home/pi/house_monitor_files" os.chdir( path ) update_server.upload( "t1.txt", "data/t1.txt") update_server.upload( "t2.txt", "data/t2.txt") update_server.shell( "bin/plot.py" )
#!/usr/bin/python # # Update Raspi to blueVM communication status # file on blueVM # # import paramiko import sys import time import update_server sample_time = time.localtime(time.time()) t = time.strftime( "%Y-%m-%d %H:%M:%S", sample_time) command = "echo \"Last contacted by home monitor on " + t + "\"|cat >data/link.txt" #print "Sending command to vps: " + command rtn = update_server.shell( command ) #print "Return from command: " + str(rtn)
#!/usr/bin/python # # Script run by cron to take and save # photo in /home/pi/house_monitor_files/images/current_image.jpg # and send to VPS server under name composed with date string. import os import time import update_server sample_time = time.localtime(time.time()) remotefilename = "image_" + time.strftime( "%Y-%m-%d_%H:%M:%S", sample_time) + ".jpg" remotepathname = "images/" + remotefilename #print "Filename: " + remotefilename localpathname = "/home/pi/house_monitor_files/images/current_image.jpg" os.system("raspistill -vf -hf -w 300 -h 300 -o " + localpathname) # print "Uploading file: " + localpathname + " to VPS as " + remotepathname update_server.upload( localpathname, remotepathname) # Link this image to current_image update_server.shell( "rm images/current_image.jpg;ln -s " + remotefilename + " images/current_image.jpg")