Exemplo n.º 1
0
def submit_test(C):
    try:
        sleep(1)
        out = C.query('setsn a 0 0')
        out = C.query('adc')
        print("===============================================")
        if out[0]:
            msg = out[1]['MSG']
            if msg['cmd_number'] > -1:
                data = msg['data']
            else:
                data = 'none'
            print(data)
            status = submit(data, timestamp='now', submit_to='sensoredweb.herokuapp.com', port=80, threshold=0)
            print(status)

        print("===============================================")
    except Exception as E:
        print(E.message)
Exemplo n.º 2
0
 from datetime import datetime
import insteon as I

from datastore import submit


plm = I.InsteonPLM()
plm.log.level = 50

timestamp = datetime.now()
val = []
for device in I.all_devices:        
    tmp  = plm.GetSwitchStatus(device)
    if tmp is not None:
        val.append([0, hex2str(device), tmp])
print submit(val,submit_to="192.168.1.133",port=8000,timestamp='')
plm.stop()