-
Couldn't load subscription status.
- Fork 13
Add sensor request to readme #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ Please also refer to [examples](https://github.com/frequenz-floss/frequenz-clien | |
|
|
||
| ```bash | ||
| # Choose the version you want to install | ||
| VERSION=0.12.0 | ||
| VERSION=0.16.0 | ||
| pip install frequenz-client-reporting==$VERSION | ||
| ``` | ||
|
|
||
|
|
@@ -70,6 +70,22 @@ data = [ | |
| ] | ||
| ``` | ||
|
|
||
| ### Query metrics for a single microgrid and sensor: | ||
|
|
||
| ```python | ||
| data = [ | ||
| sample async for sample in | ||
| client.receive_single_sensor_data( | ||
| microgrid_id=1, | ||
| sensor_id=100, | ||
| metrics=[Metric.SENSOR_IRRADIANCE], | ||
| start_dt=datetime.fromisoformat("2024-05-01T00:00:00"), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should first change these argument names to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be with the next release tough. Should I just change it for sensors & in this PR and then make a new release? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, let's get this in, then change the arguments and make a new release with this and the receiver changes soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in #178 |
||
| end_dt=datetime.fromisoformat("2024-05-02T00:00:00"), | ||
| resampling_period=timedelta(seconds=1), | ||
| ) | ||
| ] | ||
| ``` | ||
|
|
||
|
|
||
| ### Query metrics for multiple microgrids and components | ||
|
|
||
|
|
@@ -99,6 +115,33 @@ data = [ | |
| ] | ||
| ``` | ||
|
|
||
| ### Query metrics for multiple microgrids and sensors | ||
|
|
||
| ```python | ||
| # Set the microgrid ID and the sensor IDs that belong to the microgrid | ||
| # Multiple microgrids and sensors can be queried at once | ||
| microgrid_id1 = 1 | ||
| sensor_ids1 = [100, 101, 102] | ||
| microgrid_id2 = 2 | ||
| sensor_ids2 = [200, 201, 202] | ||
| microgrid_sensors = [ | ||
| (microgrid_id1, sensor_ids1), | ||
| (microgrid_id2, sensor_ids2), | ||
| ] | ||
|
|
||
| data = [ | ||
| sample async for sample in | ||
| client.receive_microgrid_sensors_data( | ||
| microgrid_sensors=microgrid_sensors, | ||
| metrics=[Metric.SENSOR_IRRADIANCE], | ||
| start_dt=datetime.fromisoformat("2024-05-01T00:00:00"), | ||
| end_dt=datetime.fromisoformat("2024-05-02T00:00:00"), | ||
| resampling_period=timedelta(seconds=1), | ||
| include_states=False, # Set to True to include state data | ||
| ) | ||
| ] | ||
| ``` | ||
|
|
||
| ### Optionally convert the data to a pandas DataFrame | ||
|
|
||
| ```python | ||
|
|
@@ -109,7 +152,8 @@ print(df) | |
|
|
||
| ## Command line client tool | ||
|
|
||
| The package contains a command-line tool that can be used to request data from the reporting API. | ||
| The package contains a command-line tool that can be used to request | ||
| microgrid component data from the reporting API. | ||
| ```bash | ||
| reporting-cli \ | ||
| --url localhost:4711 \ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.