Skip to content

Commit 8ca3f51

Browse files
committed
Added helper
1 parent 29ef271 commit 8ca3f51

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

packages/helpermodules/update_config.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,3 +2229,20 @@ def get_new_phases_to_use(topic) -> int:
22292229
return topics
22302230
self._loop_all_received_topics(upgrade)
22312231
self.__update_topic("openWB/system/datastore_version", 83)
2232+
2233+
def upgrade_datastore_83(self) -> None:
2234+
def upgrade(topic: str, payload) -> None:
2235+
if re.search("openWB/system/device/[0-9]+", topic) is not None:
2236+
payload = decode_payload(payload)
2237+
index = get_index(topic)
2238+
if payload.get("type") == "solaredge":
2239+
for component_topic, component_payload in self.all_received_topics.items():
2240+
if re.search(f"openWB/system/device/{index}/component/[0-9]+/config",
2241+
component_topic) is not None:
2242+
config_payload = decode_payload(component_payload)
2243+
if config_payload["configuration"].get("battery_index") is None:
2244+
config_payload["configuration"].update({
2245+
"battery_index": 1,
2246+
})
2247+
self._loop_all_received_topics(upgrade)
2248+
self.__update_topic("openWB/system/datastore_version", 84)

packages/modules/devices/solaredge/solaredge/bat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_values(self) -> Tuple[float, float]:
5353
unit = self.component_config.configuration.modbus_id
5454
# Use 1 as fallback if battery_index is not set
5555
battery_index = getattr(self.component_config.configuration, "battery_index", 1)
56-
56+
5757
# Define base registers for Battery 1 in hex
5858
base_soc_reg = 0xE184 # Battery 1 SoC
5959
base_power_reg = 0xE174 # Battery 1 Power

0 commit comments

Comments
 (0)