Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should first change these argument names to {start,end}_time before sending this out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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?

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

Expand Down Expand Up @@ -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
Expand All @@ -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 \
Expand Down
Loading