Ejemplo n.º 1
0
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': {
Ejemplo n.º 2
0
Archivo: client.py Proyecto: ahaas/smap
            acc = []
            for item in res["Contents"]:
                p = path + item + "/"
                c = self.contents(p)
                try:
                    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': [
Ejemplo n.º 3
0
            for item in res["Contents"]:
                p = path + item + "/"
                c = self.contents(p)
                try:
                    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 + 10 * 1000  # 10s from now
    jobs = [
        {
            "StartTime": start_time,
            "Name": "Job1",
Ejemplo n.º 4
0
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 = {
Ejemplo n.º 5
0
            for item in res["Contents"]:
                p = path + item + "/"
                c = self.contents(p)
                try:
                    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':