# -*- coding: utf8 -*- from eedomus import findDevice from eedb import eeDbAPI import ROOT from datetime import datetime from dateutil.relativedelta import relativedelta def graphFromHistory(history): time = ROOT.TDatime() graph = ROOT.TGraph() for i,(to,do) in enumerate(history): time.Set(do.strftime("%Y-%m-%d %H:%M:%S")) graph.SetPoint(i,time.Convert(),ROOT.Double(float(to))) return graph api = eeDbAPI() devs = api.getPeriphList() temps = findDevice(devs,usage_name="Température") outside = temps[0].getHistory() inside = temps[3].getHistory() c1 = ROOT.TCanvas() gr = graphFromHistory(outside) gr.Draw() c2 = ROOT.TCanvas() gr2 = graphFromHistory(inside) gr2.Draw()
from eedomus import findDevice from eedb import eeDbAPI # the API entry point api = eeDbAPI() if api.authTest() == 1: print("Authentification OK") else: print("Authentification Error") # get the list of devices devs = api.getPeriphList() # pick one for the next operations dev = findDevice(devs, room_name="Salon")[4] # print infos on that device print(dev) # get value and last change print("Value:", dev.lastValue(), end=' ') print(", last changed on", dev.lastValueChange()) # get the history and print some information history = dev.getHistory() print("History size: ", len(history)) print("First entry: ", history[0]) print("Last entry:", history[-1])
from credentials import api_user,api_secret # the API entry point #api = eeDomusAPI(api_user,api_secret,"192.168.1.13") api = eeDomusAPI(api_user,api_secret) if api.authTest()==1: print "Authentification OK" else: print "Authentification Error" # get the list of devices devs = api.getPeriphList() # pick one for the next operations dev = findDevice(devs,room_name="Salon")[4] # print infos on that device print dev # get value and last change print "Value:", dev.lastValue(), print ", last changed on", dev.lastValueChange() # get the history and print some information history = dev.getHistory() print "History size: ", len(history) print "First entry: ",history[0] print "Last entry:", history[-1]
################################################################################ ################################################################################ from eedomus import findDevice from eedb import eeDbAPI # login api = eeDbAPI() devs = api.getPeriphList() # temperatures c1 = ROOT.TCanvas() graphs = [] temps = findDevice(devs, usage_name="Température") for temp in temps: history = eeHistory(temp.getHistory()) gr = history.graph() gr.SetLineColor(30 + len(graphs)) gr.SetLineWidth(3) if len(graphs): gr.Draw("same") else: gr.Draw() graphs.append(gr) # conso électricité c3 = ROOT.TCanvas() c3.Divide(2, 2) c3.cd(1)
# -*- coding: utf8 -*- from eedomus import findDevice from eedb import eeDbAPI import ROOT from datetime import datetime from dateutil.relativedelta import relativedelta def graphFromHistory(history): time = ROOT.TDatime() graph = ROOT.TGraph() for i,(to,do) in enumerate(history): time.Set(do.strftime("%Y-%m-%d %H:%M:%S")) graph.SetPoint(i,time.Convert(),ROOT.Double(float(to))) return graph api = eeDbAPI() devs = api.getPeriphList() temps = findDevice(devs,usage_name=u"Température") outside = temps[0].getHistory() inside = temps[3].getHistory() c1 = ROOT.TCanvas() gr = graphFromHistory(outside) gr.Draw() c2 = ROOT.TCanvas() gr2 = graphFromHistory(inside) gr2.Draw()
return output[:-1] ################################################################################ ################################################################################ from eedomus import findDevice from eedb import eeDbAPI # login api = eeDbAPI() devs = api.getPeriphList() # temperatures c1 = ROOT.TCanvas() graphs = [] temps = findDevice(devs,usage_name=u"Température") for temp in temps: history = eeHistory(temp.getHistory()) gr = history.graph() gr.SetLineColor(30+len(graphs)) gr.SetLineWidth(3) if len(graphs): gr.Draw("same") else: gr.Draw() graphs.append(gr) # conso électricité c3 = ROOT.TCanvas() c3.Divide(2,2) c3.cd(1)