File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2734,15 +2734,17 @@ def upgrade(topic: str, payload) -> None:
27342734 self ._append_datastore_version (108 )
27352735
27362736 def upgrade_datastore_109 (self ) -> None :
2737- def upgrade (topic : str , payload ) -> None :
2738- if re .search ("openWB/bat/[0-9]+/get/power" , topic ) is not None :
2737+ def upgrade (topic : str , payload ) -> Optional [ dict ] :
2738+ if re .search ("^ openWB/bat/[0-9]+/get/power$ " , topic ) is not None :
27392739 index = get_index (topic )
2740+ new_topics = {}
27402741 # add new topics for battery control:
27412742 # openWB/bat/[0-9]+/get/max_charge_power => 0
27422743 # openWB/bat/[0-9]+/get/max_discharge_power => 0
27432744 if f"openWB/bat/{ index } /get/max_charge_power" not in self .all_received_topics :
2744- self . __update_topic ( f"openWB/bat/{ index } /get/max_charge_power" , 0 )
2745+ new_topics [ f"openWB/bat/{ index } /get/max_charge_power" ] = 0
27452746 if f"openWB/bat/{ index } /get/max_discharge_power" not in self .all_received_topics :
2746- self .__update_topic (f"openWB/bat/{ index } /get/max_discharge_power" , 0 )
2747+ new_topics [f"openWB/bat/{ index } /get/max_discharge_power" ] = 0
2748+ return new_topics if new_topics else None
27472749 self ._loop_all_received_topics (upgrade )
27482750 self ._append_datastore_version (109 )
You can’t perform that action at this time.
0 commit comments