Skip to content

Commit a267e23

Browse files
Add sensor request to readme
Signed-off-by: Flora <[email protected]>
1 parent a12e2b6 commit a267e23

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Please also refer to [examples](https://github.com/frequenz-floss/frequenz-clien
3030

3131
```bash
3232
# Choose the version you want to install
33-
VERSION=0.12.0
33+
VERSION=0.16.0
3434
pip install frequenz-client-reporting==$VERSION
3535
```
3636

@@ -70,6 +70,22 @@ data = [
7070
]
7171
```
7272

73+
### Query metrics for a single microgrid and sensor:
74+
75+
```python
76+
data = [
77+
sample async for sample in
78+
client.receive_single_sensor_data(
79+
microgrid_id=1,
80+
sensor_id=100,
81+
metrics=[Metric.SENSOR_IRRADIANCE],
82+
start_dt=datetime.fromisoformat("2024-05-01T00:00:00"),
83+
end_dt=datetime.fromisoformat("2024-05-02T00:00:00"),
84+
resampling_period=timedelta(seconds=1),
85+
)
86+
]
87+
```
88+
7389

7490
### Query metrics for multiple microgrids and components
7591

@@ -99,6 +115,33 @@ data = [
99115
]
100116
```
101117

118+
### Query metrics for multiple microgrids and sensors
119+
120+
```python
121+
# Set the microgrid ID and the sensor IDs that belong to the microgrid
122+
# Multiple microgrids and sensors can be queried at once
123+
microgrid_id1 = 1
124+
sensor_ids1 = [100, 101, 102]
125+
microgrid_id2 = 2
126+
sensor_ids2 = [200, 201, 202]
127+
microgrid_sensors = [
128+
(microgrid_id1, sensor_ids1),
129+
(microgrid_id2, sensor_ids2),
130+
]
131+
132+
data = [
133+
sample async for sample in
134+
client.receive_microgrid_sensors_data(
135+
microgrid_sensors=microgrid_sensors,
136+
metrics=[Metric.SENSOR_IRRADIANCE],
137+
start_dt=datetime.fromisoformat("2024-05-01T00:00:00"),
138+
end_dt=datetime.fromisoformat("2024-05-02T00:00:00"),
139+
resampling_period=timedelta(seconds=1),
140+
include_states=False, # Set to True to include state data
141+
)
142+
]
143+
```
144+
102145
### Optionally convert the data to a pandas DataFrame
103146

104147
```python
@@ -109,7 +152,8 @@ print(df)
109152

110153
## Command line client tool
111154

112-
The package contains a command-line tool that can be used to request data from the reporting API.
155+
The package contains a command-line tool that can be used to request
156+
microgrid component data from the reporting API.
113157
```bash
114158
reporting-cli \
115159
--url localhost:4711 \

0 commit comments

Comments
 (0)