Files
EOS/docs/akkudoktoreos/measurement.md
T
Bobby NoelteandClaude Opus 5.5 cc875f798c feat(measurement): treat long *_emr_keys meter gaps as unknown
Additional fixes:
Add timezone to loadakkudoktoradapted tests datetime generation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
2026-11-15 18:30:00 +01:00

172 lines
5.3 KiB
Markdown

% SPDX-License-Identifier: Apache-2.0
(measurement-page)=
# Measurements
Measurements are utilized to refine predictions using real data from your system, thereby enhancing
accuracy.
- Household Load Measurement
- Grid Export Measurement
- Grid Import Measurement
## Storing Measurements
EOS stores measurements in a **key-value store**, where the term `measurement key` refers to the
unique identifier used to store and retrieve specific measurement data.
Several endpoints of the EOS REST server allow for the management and retrieval of these
measurements.
The measurement data must be or is provided in one of the following formats:
### 1. DateTimeData
A dictionary with the following structure:
```json
{
"start_datetime": "2024-01-01 00:00:00",
"interval": "1 hour",
"<measurement key>": [value, value, ...],
"<measurement key>": [value, value, ...],
...
}
```
### 2. DateTimeDataFrame
A JSON string created from a [pandas](https://pandas.pydata.org/docs/index.html) dataframe with a
`DatetimeIndex`. Use [pandas.DataFrame.to_json(orient="index")](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json).
The column name of the data must be the same as the names of the `measurement key`s.
### 3. DateTimeSeries
A JSON string created from a [pandas](https://pandas.pydata.org/docs/index.html) series with a
`DatetimeIndex`. Use [pandas.Series.to_json(orient="index")](https://pandas.pydata.org/docs/reference/api/pandas.Series.to_json.html#pandas.Series.to_json).
Creates a dictionary like this:
```json
{
"data": {
"2024-01-01T00:00:00+01:00": 1,
"2024-01-02T00:00:00+01:00": 2,
"2024-01-03T00:00:00+01:00": 3,
...
},
"dtype": "float64",
"tz": "Europe/Berlin"
}
```
## Load Measurement
The EOS measurement store provides for storing energy meter readings of loads.
The associated `measurement key`s can be configured by:
```json
{
"measurement": {
"load_emr_keys": ["load0_emr", "my special load", ...]
}
}
```
Load measurements can be stored for any datetime. The values between different meter readings are
linearly approximated. Storing values between optimization intervals is generally not useful.
The EOS measurement store automatically sums all given loads to create a total load value series
for specified intervals, usually one hour. This aggregated data can be used for load predictions.
An interval that the meters do not fully cover (before the first or after the last reading, a meter
reset, or a gap longer than the meter's gap limit) has no value instead of zero load; with
several load meters, all of them must cover it. The `LoadAkkudoktorAdjusted` provider skips hours
without a value.
### Meter gaps
The energy between two readings of a `*_emr_keys` meter (load, grid import/export, PV production)
is spread evenly over the time between them. A gap longer than `measurement.emr_max_gap_seconds`
(default 10800 s, 3 hours) has no energy value instead: an outage of EOS or of the meter does not
turn into invented, even consumption or production, nights included.
```json
{
"measurement": {
"emr_max_gap_seconds": 10800
}
}
```
Set it to `null` to spread every gap evenly (the behaviour before the limit). A feeder that only
sends a reading when the meter value changes (e.g. a PV or export meter that stands still at night)
needs `null` or a value longer than its longest still period; the Home Assistant adapter reads
the meters on every energy management run and needs no change.
A single meter can get its own limit with a `channels` entry, which takes precedence:
```json
{
"measurement": {
"pv_production_emr_keys": ["pv1_emr"],
"channels": {
"pv1_emr": {
"quantity": "cumulative_energy",
"unit": "kWh",
"max_gap_seconds": 43200
}
}
}
}
```
The entry of a `*_emr_keys` meter must stay `cumulative_energy` in `kWh`.
:::{admonition} Warning
:class: warning
Only use **actual meter readings** in **kWh**, not energy consumption.
Example: `112345.77`, `112389.23`, `112412.55`, …
:::
## Grid Export/ Import Measurement
The EOS measurement store also allows for the storage of meter readings for grid import and export.
The associated `measurement key`s can be configured by:
```json
{
"measurement": {
"grid_export_emr_keys": ["grid_export_emr", ...],
"grid_import_emr_keys": ["grid_import_emr", ...],
}
}
```
:::{admonition} Todo
:class: note
Currently not used. Integrate grid meter readings into the respective predictions.
:::
## Battery/ Electric Vehicle State of Charge (SoC) Measurement
The state of charge (SoC) measurement of batteries and electric vehicle batteries can be stored.
The associated `measurement key` is pre-defined by the device configuration. It can be
determined from the device configuration by the read-only `measurement_key_soc_factor` configuration
option.
## Battery/ Electric Vehicle Power Measurement
The charge/ discharge power measurements of batteries and electric vehicle batteries can be stored.
Charging power is denoted by a negative value, discharging power by a positive value.
The associated `measurement key`s are pre-defined by the device configuration. They can be
determined from the device configuration by read-only configuration options:
- `measurement_key_power_l1_w`
- `measurement_key_power_l2_w`
- `measurement_key_power_l3_w`
- `measurement_key_power_3_phase_sym_w`