In [ ]:
import os, inspect, sys
import pandas as pd
In [ ]:
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = 16,8
In [ ]:
from opengrid.library.houseprint import houseprint
In [ ]:
hp = houseprint.Houseprint()
# for testing:
# hp = houseprint.Houseprint(spreadsheet='unit and integration test houseprint')
In [ ]:
hp
In [ ]:
hp.sites[:5]
In [ ]:
hp.get_devices()[:4]
In [ ]:
hp.get_sensors('water')[:3]
A Houseprint object can be saved as a pickle. It loses its tmpo session however (connections cannot be pickled)
In [ ]:
hp.save('new_houseprint.pkl')
In [ ]:
hp = houseprint.load_houseprint_from_file('new_houseprint.pkl')
The houseprint, sites, devices and sensors all have a get_data method. In order to get these working for the fluksosensors, the houseprint needs a tmpo session
In [ ]:
hp.init_tmpo()
In [ ]:
hp.sync_tmpos()
In [ ]:
hp.find_site(1)
In [ ]:
hp.find_device('FL03001552')
In [ ]:
hp.find_sensor('53b1eb0479c83dee927fff10b0cb0fe6')
In [ ]:
hp.search_sites(inhabitants=5)
In [ ]:
hp.search_sensors(type='electricity', direction='Import')
In [ ]:
head = pd.Timestamp('20150617')
tail = pd.Timestamp('20150618')
hp.get_data(sensortype='water', head=head,tail=tail).plot()
In [ ]:
site = hp.find_site(1)
site
In [ ]:
print(site.size)
print(site.inhabitants)
print(site.postcode)
print(site.construction_year)
print(site.k_level)
print(site.e_level)
print(site.epc_cert)
In [ ]:
site.devices
In [ ]:
site.get_sensors('electricity')
In [ ]:
head = pd.Timestamp('20150617')
tail = pd.Timestamp('20150618')
site.get_data(sensortype='electricity', head=head,tail=tail).plot()
In [ ]:
device = hp.find_device('FL03001552')
device
In [ ]:
device.key
In [ ]:
device.get_sensors('gas')
In [ ]:
head = pd.Timestamp('20150617')
tail = pd.Timestamp('20150618')
device.get_data(sensortype='electricity', head=head,tail=tail).plot()
In [ ]:
sensor = hp.find_sensor('53b1eb0479c83dee927fff10b0cb0fe6')
sensor
In [ ]:
sensor.key
In [ ]:
sensor.type
In [ ]:
sensor.description
In [ ]:
sensor.system
In [ ]:
sensor.unit
In [ ]:
head = pd.Timestamp('20150617')
tail = pd.Timestamp('20150618')
sensor.get_data(head,tail).plot()
In [ ]:
sensors = hp.search_sensors(type='electricity', system='solar')
print(sensors)
hp.get_data(sensors=sensors, head=head, tail=tail).plot()
In [ ]: