In [ ]:
from opengrid.library import houseprint

Create your own sharable houseprint objects

So you want to create your own Houseprint object which you can save to a file and share with your project partners? Follow this guide:

Create an empty Houseprint Object


In [ ]:
# use the `empty_init` flag to create an empty object
hp = houseprint.Houseprint(empty_init=True)

In [ ]:
hp

Create sites, devices and sensors

There is a strong hierarchy, which you must follow!


In [ ]:
site1 = houseprint.Site(key="Your house name")

In [ ]:
# consult the docs to see what fields are available!
# houseprint.Site??
# houseprint.Fluksometer??
# houseprint.Fluksosensor??

In [ ]:
device1 = houseprint.Fluksometer(key='fluksoname')

In [ ]:
sensor1 = houseprint.Fluksosensor(key='keykeykey', token="blabla", type='electricity')

Add everything together


In [ ]:
device1.add_sensor(sensor1)

In [ ]:
site1.add_device(device1)

In [ ]:
hp.add_site(site1)

In [ ]:
hp

Save Houseprint to file


In [ ]:
hp.save('sharable_houseprint.pkl')

Share this file with your friends!

How to load in and use the houseprint file you've received


In [ ]:
hp2 = houseprint.load_houseprint_from_file('sharable_houseprint.pkl')

In [ ]:
hp2

In [ ]:
hp2.init_tmpo()

In [ ]:
hp2.get_data()

In [ ]: