mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-13 09:13:30 +01:00
fix(homeassistant): apply 0 and off from config entities, never add settings
The configuration sync of the Home Assistant adapter skipped every value that is false in Python, so an entity state of 0 or off never reached the configuration. It also set any path it was given: the documented example devices/batteries/0/capacity_wh named a device "0" that does not exist, so EOS silently added a new battery with a random device id. Apply every value except an unavailable or unknown entity, and only update settings that exist; report other paths as an error. The example now addresses the battery by its device_id. Signed-off-by: SchaafAlexander <86607129+SchaafAlexander@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Bobby Noelte
co-authored by
Claude Opus 5.5
parent
1fda5f9201
commit
62cbf4cf2a
@@ -136,7 +136,8 @@ There are two URLs that are used:
|
||||
| ---- | ---- | --------- | ------- | ----------- |
|
||||
| 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 |
|
||||
e.g. devices/batteries/battery1/capacity_wh
|
||||
Devices are addressed by their device_id. The setting must exist. |
|
||||
| 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'. |
|
||||
@@ -164,7 +165,7 @@ E.g. solution key 'battery1_idle_op_mode' becomes the entity_id 'sensor.eos_batt
|
||||
"adapter": {
|
||||
"homeassistant": {
|
||||
"config_entity_ids": {
|
||||
"devices/batteries/0/capacity_wh": "sensor.battery1_capacity"
|
||||
"devices/batteries/battery1/capacity_wh": "sensor.battery1_capacity"
|
||||
},
|
||||
"load_emr_entity_ids": [
|
||||
"sensor.load_energy_total_kwh"
|
||||
@@ -204,7 +205,7 @@ E.g. solution key 'battery1_idle_op_mode' becomes the entity_id 'sensor.eos_batt
|
||||
"adapter": {
|
||||
"homeassistant": {
|
||||
"config_entity_ids": {
|
||||
"devices/batteries/0/capacity_wh": "sensor.battery1_capacity"
|
||||
"devices/batteries/battery1/capacity_wh": "sensor.battery1_capacity"
|
||||
},
|
||||
"load_emr_entity_ids": [
|
||||
"sensor.load_energy_total_kwh"
|
||||
|
||||
Reference in New Issue
Block a user