diff --git a/gw_spaceheat/actors/atomic_ally.py b/gw_spaceheat/actors/atomic_ally.py index 929c2581..98afd45d 100644 --- a/gw_spaceheat/actors/atomic_ally.py +++ b/gw_spaceheat/actors/atomic_ally.py @@ -21,7 +21,7 @@ from actors.scada_actor import ScadaActor from actors.scada_data import ScadaData from actors.synth_generator import WeatherForecast -from named_types import RemainingElec +from named_types import RemainingElec, ScadaInit class AtomicAllyState(GwStrEnum): @@ -315,6 +315,7 @@ def check_and_update_state(self) -> None: async def main(self): await asyncio.sleep(2) + self._send_to(self.primary_scada, ScadaInit(FromGNodeAlias=self.layout.atn_g_node_alias)) # SynthGenerator gets weather ASAP on boot, including various fallbacks # if the request does not work. So wait a bit if if self.weather is None: diff --git a/gw_spaceheat/actors/scada.py b/gw_spaceheat/actors/scada.py index 574f6105..0a59de99 100644 --- a/gw_spaceheat/actors/scada.py +++ b/gw_spaceheat/actors/scada.py @@ -756,10 +756,7 @@ def update_env_variable(self, variable, new_value) -> None: with open(dotenv_filepath, 'w') as file: line_exists = False for line in lines: - if (line.startswith(f"{variable}=") - or line.startswith(f"{variable}= ") - or line.startswith(f"{variable} =") - or line.startswith(f"{variable} = ")): + if line.strip().startswith(f"{variable}="): file.write(f"{variable}={new_value}\n") line_exists = True else: diff --git a/gw_spaceheat/actors/synth_generator.py b/gw_spaceheat/actors/synth_generator.py index 66dbf2e1..e5b0f28a 100644 --- a/gw_spaceheat/actors/synth_generator.py +++ b/gw_spaceheat/actors/synth_generator.py @@ -16,7 +16,7 @@ from actors.scada_actor import ScadaActor from data_classes.house_0_names import H0CN -from named_types import EnergyInstruction, Ha1Params, RemainingElec, ScadaInit +from named_types import EnergyInstruction, Ha1Params, RemainingElec from pydantic import Field # -------------- TODO: move to named_types ------------- @@ -130,7 +130,6 @@ async def main(self): async def main_loop(self, session: aiohttp.ClientSession) -> None: await self.get_weather(session) await asyncio.sleep(2) - self._send_to(self.primary_scada, ScadaInit(FromGNodeAlias=self.layout.atn_g_node_alias)) while not self._stop_requested: self._send(PatInternalWatchdogMessage(src=self.name))