File tree Expand file tree Collapse file tree
modules/devices/solaredge/solaredge Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2082,3 +2082,20 @@ def upgrade(topic: str, payload) -> Optional[dict]:
20822082 break
20832083 self ._loop_all_received_topics (upgrade )
20842084 self .__update_topic ("openWB/system/datastore_version" , 79 )
2085+
2086+ def upgrade_datastore_79 (self ) -> None :
2087+ def upgrade (topic : str , payload ) -> None :
2088+ if re .search ("openWB/system/device/[0-9]+" , topic ) is not None :
2089+ payload = decode_payload (payload )
2090+ index = get_index (topic )
2091+ if payload .get ("type" ) == "solaredge" :
2092+ for component_topic , component_payload in self .all_received_topics .items ():
2093+ if re .search (f"openWB/system/device/{ index } /component/[0-9]+/config" ,
2094+ component_topic ) is not None :
2095+ config_payload = decode_payload (component_payload )
2096+ if config_payload ["configuration" ].get ("battery_index" ) is None :
2097+ config_payload ["configuration" ].update ({
2098+ "battery_index" : 1 ,
2099+ })
2100+ self ._loop_all_received_topics (upgrade )
2101+ self .__update_topic ("openWB/system/datastore_version" , 80 )
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments