jeremyjjr wrote:@akimball, the 3D floor layouts were done using an online tool found here http://floorplanner.com. Very simple to use, free to use and a low-cost annual fee if you want to keep your designs private or export high resolution images. Really brings a floor plan to life!
jeremyjjr wrote:FWIW, none of the pages I displayed above use iFrames. They are all built using the standard page editor in Indigo. Dynamic images are updated using the variable file name capabilities. No additional HTML exists to render these.
jeremyjjr wrote:Hope that helps.
J.
matt (support) wrote:Neat -- Status Board has a very nice looking UI. Let us know how it goes...
#! /usr/bin/env python2.5
# -*- coding: utf-8 -*-
"""
The easiest way to understand the construction of the JSON hierarchy is to look for the
'object = {"graph" : graphObject}' line below and work upwards.
Parameters:
Refresh is optional. In seconds. Default = 120, Min = 15.
Graph type must be "bar" or "line"
Graph total must be true or false. Works only with bar chart?
Colors can be 'aqua', 'blue', 'green', 'lightGray', 'mediumGray', 'orange', 'pink', 'purple', 'red', or 'yellow'.
"""
import simplejson as json
import sqlite3
jsonFilePath = "/Users/USERNAME/Dropbox/Public/temperatures.json"
sqliteFilePath = "/Library/Application Support/Perceptive Automation/Indigo 6/Logs/indigo_history.sqlite"
numOfObs = 10
conn = sqlite3.connect(sqliteFilePath)
cur = conn.cursor()
############################## Dataset 1: Main Attic ##############################
set1 = []
cur.execute("SELECT sensorvalue FROM device_history_117494737 ORDER BY id DESC LIMIT " + str(numOfObs))
for row in cur:
set1.append(int(row[0]))
set1.reverse()
# Is there a limit to the number of observations? Number of datasets?
x1 = {"title" : "1", "value" : set1[0]}
x2 = {"title" : "2", "value" : set1[1]}
x3 = {"title" : "3", "value" : set1[2]}
x4 = {"title" : "4", "value" : set1[3]}
x5 = {"title" : "5", "value" : set1[4]}
x6 = {"title" : "6", "value" : set1[5]}
x7 = {"title" : "7", "value" : set1[6]}
x8 = {"title" : "8", "value" : set1[7]}
x9 = {"title" : "9", "value" : set1[8]}
x10 = {"title" : "10", "value" : set1[9]}
xTitle = "Attic"
xColor = "Green"
xRefresh = 120
xDataPoints = [x1, x2, x3, x4, x5, x6, x7, x8, x9, x10,]
x = {"title" : xTitle, "color" : xColor, "refreshEveryNSeconds" : xRefresh, "datapoints" : xDataPoints}
########## Build the JSON Components ##########
# Add additional data sets here too
dataSequences = [x]
graphMin = min(min(set1)
graphMax = max(max(set1)
graphTitle = "Temperatures"
graphObject = {"title" : graphTitle, "yAxis" : {"minValue" : graphMin, "maxValue" : graphMax}, "total" : "true", "type" : "line", "datasequences" : dataSequences}
# The JSON hierarchy effectively starts here and works upwards.
object = {"graph" : graphObject}
# Close the database.
conn.close()
########## Write the JSON to file. ##########
try:
with open(jsonFilePath, mode='w') as graphOutput:
json.dump(object, graphOutput, indent=2)
except:
indigo.server.log(u"Something went wrong.")
#! /usr/bin/env python2.5
# -*- coding: utf-8 -*-
"""
This script creates a CSV file based on the setting of the script and appends values to the file each time it's run.
CSV table structure:
Row 1 = Chart title and column headings
Row 2 = Color
Row 3 = Observation 1
Row n = Observation n
Totals row can be added if desired. Suggest 'Totals' in column 1 of row 3.
"""
# import csv (unused, but there may be some benefit to doing it this way.)
import os.path
csvFilePath = "/Users/USERNAME/Dropbox/Public/humidity.csv"
csvHeaders = "Humidity,Outside,Attic,Inside" + "\n"
csvColors = "Colors,Blue,Green,Red" + "\n"
dateTime = str(indigo.server.getTime())
outside = (indigo.devices[1899035475].states["relativeHumidity"]).strip('%')
outside = float(outside)
outside = str(outside)
mainAttic = str(indigo.devices[1869397554].states["sensorValue"])
inside = str(indigo.devices[1700355009].states["humidityInput1"])
# Check and see if the file exists. If not, create it and write the headers.
if not os.path.isfile(csvFilePath):
csvFile = open(csvFilePath, "a")
csvFile.write(csvHeaders)
csvFile.write(csvColors)
# Write new values to the file.
csvFile = open(csvFilePath, "a")
element = dateTime + "," + outside + "," + mainAttic + "," + inside + "\n"
csvFile.write(element)
# Close the file.
csvFile.close()
jeremyjjr wrote:Every hour a scheduled job runs and reads in the saved data and creates three png images using gnuplot.
from os import system
system('gnuplot path_to_file')
kw123 wrote:you have to include the full path to gnuplot
from os import system
system('/usr/local/Cellar/gnuplot/4.6.5/bin/gnuplot /Library/Application\ Support/Perceptive\ Automation/Indigo\ 6/Scripts/temperature.gp')
kw123 wrote:you could quote the path to the file and skip the "\ "
so ("usr/...../gnuplot 'file to gnu plot file '") should work.
you can also capture the potential error message(s) by returnMessage = system(...) I believe -I am not home, this is from memory.
Karl
Users browsing this forum: No registered users and 5 guests