EnergiStream is an open source Python client for interacting with EnergiStream API, from MelRok.
To install EnergiStream from source, clone the git repository to your local machine
$ git clone [email protected]:melrok/energistream-py.git
In the energistream
root directory (same one where you found this file after cloning the git repo), execute
$ sudo pip install -e .
EnergiStream has a few key dependancies:
- pandas: >= 0.14.1
- requests: >= 1.2.3
- testfixtures
All requirements are specified in the requirements.txt. One can attempt to install these alongside the EnergiStream installation via
$ sudo pip install -r requirements.txt -e .
A quick guide to some of the core EnergiStream functionality. Examples and additional documentation are available at GitHub Pages.
Note : Always refer to the doctrings for all methods for a detailed summary of functionality.
To import the energistream library :
import energistream as es
EnergiStreamClient
takes a valid username and password and establishes a unique session with temporary credentials.
stream = es.EnergiStreamClient('USER', 'PASS', include_sensors=True)
authenticate
uses the user credentials to authenticate the instantiated client in the event that authentication was not previously established or has lapsed.
stream.authenticate
The is_authenticated
method returns a simple boolean true or false when asked if the client authentication is still valid.
stream.is_authenticated
The get_weather
method returns a dataframe of hourly temperature and relative humidity data for the instantiated client's associated physical location.
Note: This data is collected from third party sources. Weather ID is an energistream unique key and not associated to any third party ID schema.
stream.get_weather(weather_id = 102, start = '12/29/2014', end = '1/29/2015')
The get_energy
method accepts a sensor ID and returns a dataframe relating active and reactive energy, current and voltage RMS, and total Energy.
stream.get_energy(3505, start = '12/29/2014', end = '1/29/2015', tz = 'local')
The search_group_tree
method accepts a keyword and searches the instantiated client for matching sensor groups returning group names, sensor group ID, and assigned sensors.
stream.search_group_tree('Engineering', case = False)
The base_group_level
column designates the grouping hierarchy by levels, with 0 being root groups.
stream.groups[stream.groups.base_group_level == 0]
The sensors
method returns a dataframe describing the individual sensors associated with the instantiated energistream client ID. This includes the sensor ID, the associated group ID, time zone, and a multiplier based on the method of measurement i.e. one, two, or three channel.
stream.sensors
The get_boards
method returns a dataframe describing the boards associated with the instantiated energistream client ID. This includes
the boards serial number, version, display name, and model.
stream.get_boards
The get_demand
method returns power data for a given sensor group(demand or generation) at multiple resolutions (1, 5, 10, 15, and 30 minutes, daily, weekly, monthly, and yearly). Start and end date may be specified as well as the timezone and desired resolution.
Note: Defaults to the last thirty days and fifteen minute resolution.
stream.get_demand(157)