Files
EOS/docs/_generated/configadapter.md
Bobby Noelte 6498c7dc32 Add database support for measurements and historic prediction data. (#848)
The database supports backend selection, compression, incremental data load,
automatic data saving to storage, automatic vaccum and compaction.

Make SQLite3 and LMDB database backends available.

Update tests for new interface conventions regarding data sequences,
data containers, data providers. This includes the measurements provider and
the prediction providers.

Add database documentation.

The fix includes several bug fixes that are not directly related to the database
implementation but are necessary to keep EOS running properly and to test and
document the changes.

* fix: config eos test setup

  Make the config_eos fixture generate a new instance of the config_eos singleton.
  Use correct env names to setup data folder path.

* fix: startup with no config

  Make cache and measurements complain about missing data path configuration but
  do not bail out.

* fix: soc data preparation and usage for genetic optimization.

  Search for soc measurments 48 hours around the optimization start time.
  Only clamp soc to maximum in battery device simulation.

* fix: dashboard bailout on zero value solution display

  Do not use zero values to calculate the chart values adjustment for display.

* fix: openapi generation script

  Make the script also replace data_folder_path and data_output_path to hide
  real (test) environment pathes.

* feat: add make repeated task function

  make_repeated_task allows to wrap a function to be repeated cyclically.

* chore: removed index based data sequence access

  Index based data sequence access does not make sense as the sequence can be backed
  by the database. The sequence is now purely time series data.

* chore: refactor eos startup to avoid module import startup

  Avoid module import initialisation expecially of the EOS configuration.
  Config mutation, singleton initialization, logging setup, argparse parsing,
  background task definitions depending on config and environment-dependent behavior
  is now done at function startup.

* chore: introduce retention manager

  A single long-running background task that owns the scheduling of all periodic
  server-maintenance jobs (cache cleanup, DB autosave, …)

* chore: canonicalize timezone name for UTC

  Timezone names that are semantically identical to UTC are canonicalized to UTC.

* chore: extend config file migration for default value handling

  Extend the config file migration handling values None or nonexisting values
  that will invoke a default value generation in the new config file. Also
  adapt test to handle this situation.

* chore: extend datetime util test cases

* chore: make version test check for untracked files

  Check for files that are not tracked by git. Version calculation will be
  wrong if these files will not be commited.

* chore: bump pandas to 3.0.0

  Pandas 3.0 now performs inference on the appropriate resolution (a.k.a. unit)
  for the output dtype which may become datetime64[us] (before it was ns). Also
  numeric dtype detection is now more strict which needs a different detection for
  numerics.

* chore: bump pydantic-settings to 2.12.0

  pydantic-settings 2.12.0 under pytest creates a different behaviour. The tests
  were adapted and a workaround was introduced. Also ConfigEOS was adapted
  to allow for fine grain initialization control to be able to switch
  off certain settings such as file settings during test.

* chore: remove sci learn kit from dependencies

  The sci learn kit is not strictly necessary as long as we have scipy.

* chore: add documentation mode guarding for sphinx autosummary

  Sphinx autosummary excecutes functions. Prevent exceptions in case of pure doc
  mode.

* chore: adapt docker-build CI workflow to stricter GitHub handling

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2026-02-22 14:12:42 +01:00

8.6 KiB
Raw Blame History

Adapter Configuration

:::{table} adapter :widths: 10 20 10 5 5 30 :align: left

Name Environment Variable Type Read-Only Default Description
homeassistant EOS_ADAPTER__HOMEASSISTANT HomeAssistantAdapterCommonSettings rw required Home Assistant adapter settings.
nodered EOS_ADAPTER__NODERED NodeREDAdapterCommonSettings rw required NodeRED adapter settings.
provider EOS_ADAPTER__PROVIDER Optional[list[str]] rw None List of adapter provider id(s) of provider(s) to be used.
providers list[str] ro N/A Available adapter provider ids.
:::

Example Input

   {
       "adapter": {
           "provider": [
               "HomeAssistant"
           ],
           "homeassistant": {
               "config_entity_ids": null,
               "load_emr_entity_ids": null,
               "grid_export_emr_entity_ids": null,
               "grid_import_emr_entity_ids": null,
               "pv_production_emr_entity_ids": null,
               "device_measurement_entity_ids": null,
               "device_instruction_entity_ids": null,
               "solution_entity_ids": null
           },
           "nodered": {
               "host": "127.0.0.1",
               "port": 1880
           }
       }
   }

Example Output

   {
       "adapter": {
           "provider": [
               "HomeAssistant"
           ],
           "homeassistant": {
               "config_entity_ids": null,
               "load_emr_entity_ids": null,
               "grid_export_emr_entity_ids": null,
               "grid_import_emr_entity_ids": null,
               "pv_production_emr_entity_ids": null,
               "device_measurement_entity_ids": null,
               "device_instruction_entity_ids": null,
               "solution_entity_ids": null,
               "homeassistant_entity_ids": [],
               "eos_solution_entity_ids": [],
               "eos_device_instruction_entity_ids": []
           },
           "nodered": {
               "host": "127.0.0.1",
               "port": 1880
           },
           "providers": [
               "HomeAssistant",
               "NodeRED"
           ]
       }
   }

Common settings for the NodeRED adapter

The Node-RED adapter sends to HTTP IN nodes.

This is the example flow:

[HTTP In \<URL\>] -> [Function (parse payload)] -> [Debug] -> [HTTP Response]

There are two URLs that are used:

  • GET /eos/data_aquisition The GET is issued before the optimization.
  • POST /eos/control_dispatch The POST is issued after the optimization.

:::{table} adapter::nodered :widths: 10 10 5 5 30 :align: left

Name Type Read-Only Default Description
host Optional[str] rw 127.0.0.1 Node-RED server IP address. Defaults to 127.0.0.1.
port Optional[int] rw 1880 Node-RED server IP port number. Defaults to 1880.
:::

Example Input/Output

   {
       "adapter": {
           "nodered": {
               "host": "127.0.0.1",
               "port": 1880
           }
       }
   }

Common settings for the home assistant adapter

:::{table} adapter::homeassistant :widths: 10 10 5 5 30 :align: left

Name Type Read-Only Default Description
config_entity_ids Optional[dict[str, str]] rw None Mapping of EOS config keys to Home Assistant entity IDs.
The config key has to be given by a /-separated path
e.g. devices/batteries/0/capacity_wh
device_instruction_entity_ids Optional[list[str]] rw None Entity IDs for device (resource) instructions to be updated by EOS.
The device ids (resource ids) have to be prepended by 'sensor.eos_' to build the entity_id.
E.g. The instruction for device id 'battery1' becomes the entity_id 'sensor.eos_battery1'.
device_measurement_entity_ids Optional[dict[str, str]] rw None Mapping of EOS measurement keys used by device (resource) simulations to Home Assistant entity IDs.
eos_device_instruction_entity_ids list[str] ro N/A Entity IDs for energy management instructions available at EOS.
eos_solution_entity_ids list[str] ro N/A Entity IDs for optimization solution available at EOS.
grid_export_emr_entity_ids Optional[list[str]] rw None Entity ID(s) of export to grid energy meter readings [kWh]
grid_import_emr_entity_ids Optional[list[str]] rw None Entity ID(s) of import from grid energy meter readings [kWh]
homeassistant_entity_ids list[str] ro N/A Entity IDs available at Home Assistant.
load_emr_entity_ids Optional[list[str]] rw None Entity ID(s) of load energy meter readings [kWh]
pv_production_emr_entity_ids Optional[list[str]] rw None Entity ID(s) of PV production energy meter readings [kWh]
solution_entity_ids Optional[list[str]] rw None Entity IDs for optimization solution keys to be updated by EOS.
The solution keys have to be prepended by 'sensor.eos_' to build the entity_id.
E.g. solution key 'battery1_idle_op_mode' becomes the entity_id 'sensor.eos_battery1_idle_op_mode'.
:::

Example Input

   {
       "adapter": {
           "homeassistant": {
               "config_entity_ids": {
                   "devices/batteries/0/capacity_wh": "sensor.battery1_capacity"
               },
               "load_emr_entity_ids": [
                   "sensor.load_energy_total_kwh"
               ],
               "grid_export_emr_entity_ids": [
                   "sensor.grid_export_energy_total_kwh"
               ],
               "grid_import_emr_entity_ids": [
                   "sensor.grid_import_energy_total_kwh"
               ],
               "pv_production_emr_entity_ids": [
                   "sensor.pv_energy_total_kwh"
               ],
               "device_measurement_entity_ids": {
                   "ev11_soc_factor": "sensor.ev11_soc_factor",
                   "battery1_soc_factor": "sensor.battery1_soc_factor"
               },
               "device_instruction_entity_ids": [
                   "sensor.eos_battery1"
               ],
               "solution_entity_ids": [
                   "sensor.eos_battery1_idle_mode_mode"
               ]
           }
       }
   }

Example Output

   {
       "adapter": {
           "homeassistant": {
               "config_entity_ids": {
                   "devices/batteries/0/capacity_wh": "sensor.battery1_capacity"
               },
               "load_emr_entity_ids": [
                   "sensor.load_energy_total_kwh"
               ],
               "grid_export_emr_entity_ids": [
                   "sensor.grid_export_energy_total_kwh"
               ],
               "grid_import_emr_entity_ids": [
                   "sensor.grid_import_energy_total_kwh"
               ],
               "pv_production_emr_entity_ids": [
                   "sensor.pv_energy_total_kwh"
               ],
               "device_measurement_entity_ids": {
                   "ev11_soc_factor": "sensor.ev11_soc_factor",
                   "battery1_soc_factor": "sensor.battery1_soc_factor"
               },
               "device_instruction_entity_ids": [
                   "sensor.eos_battery1"
               ],
               "solution_entity_ids": [
                   "sensor.eos_battery1_idle_mode_mode"
               ],
               "homeassistant_entity_ids": [],
               "eos_solution_entity_ids": [],
               "eos_device_instruction_entity_ids": []
           }
       }
   }