from flask import Flask, render_template, jsonify, url_for, request import json import traceback import requests import time from smap.client import SmapClient from bosswave import BossWave from twisted.internet import reactor, task fanstate = 0 tempsensors = [0] * 4 currenttick = -1 c_url = 'http://128.32.37.43:8080/data' c = SmapClient('http://128.32.37.43:8080') print c.contents() other_url = 'http://128.32.37.43:8081/data' otherclient = SmapClient('http://128.32.37.43:8081') print otherclient.contents() acts = { 'spaceheater': c_url + '/Raritan/outlet2/state_act', 'tasklight': c_url + '/TCPLighting/216544666156982628/state_act', 'buildinglight': c_url + '/hue/workbench/state/on_act', 'heatspt': c_url + '/imt550c0/temp_heat_act', 'coolspt': c_url + '/imt550c0/temp_cool_act', } objects = { 'spaceheater': {
acc = acc + c except TypeError: acc.append(c) return acc if __name__=='__main__': # Example for use with example driver from smap.client import SmapClient import time c = SmapClient("http://127.0.0.1:8080") path = '/instrument0/sensor0' print 'Tags:', c.tags(path), '\n' print 'Current reading:', c.get_state(path), '\n' print 'Contents:', c.contents(), '\n' path = '/binary/point0' print 'Setting state succeeds:', c.set_state(path, 0), '\n' path = '/binary/point0' start_time = time.time() * 1000 + 20 * 1000 # 20s from now jobs = [{ 'StartTime': start_time, 'Name': 'Job1', 'Actions': [ {'State': 0, 'Path': path}, {'State': 1, 'Path': path}, {'State': 0, 'Path': path}, {'State': 1, 'Path': path} ]
except TypeError: acc.append(c) return acc if __name__ == "__main__": # Example for use with example driver from smap.client import SmapClient import time c = SmapClient("http://127.0.0.1:8080") path = "/instrument0/sensor0" print "Tags:", c.tags(path), "\n" print "Current reading:", c.get_state(path), "\n" print "Contents:", c.contents(), "\n" path = "/binary/point0" print "Setting state succeeds:", c.set_state(path, 0), "\n" path = "/binary/point0" start_time = time.time() * 1000 + 10 * 1000 # 10s from now jobs = [ { "StartTime": start_time, "Name": "Job1", "Actions": [ {"State": 0, "Path": path}, {"State": 1, "Path": path}, {"State": 0, "Path": path}, {"State": 1, "Path": path},
import json import traceback import requests import time from smap.client import SmapClient from bosswave import BossWave from twisted.internet import reactor, task fanstate = 0 tempsensors = [0] * 4 currenttick = -1 c_url = "http://128.32.37.43:8080/data" c = SmapClient("http://128.32.37.43:8080") print c.contents() other_url = "http://128.32.37.43:8081/data" otherclient = SmapClient("http://128.32.37.43:8081") print otherclient.contents() acts = { "spaceheater": c_url + "/Raritan/outlet2/state_act", "tasklight": c_url + "/TCPLighting/216544666156982628/state_act", "buildinglight": c_url + "/hue/workbench/state/on_act", "heatspt": c_url + "/imt550c0/temp_heat_act", "coolspt": c_url + "/imt550c0/temp_cool_act", } objects = { "spaceheater": {
except TypeError: acc.append(c) return acc if __name__ == '__main__': # Example for use with example driver from smap.client import SmapClient import time c = SmapClient("http://127.0.0.1:8080") path = '/instrument0/sensor0' print 'Tags:', c.tags(path), '\n' print 'Current reading:', c.get_state(path), '\n' print 'Contents:', c.contents(), '\n' path = '/binary/point0' print 'Setting state succeeds:', c.set_state(path, 0), '\n' path = '/binary/point0' start_time = time.time() * 1000 + 20 * 1000 # 20s from now jobs = [{ 'StartTime': start_time, 'Name': 'Job1', 'Actions': [{ 'State': 0, 'Path': path }, {