Skip to content

Commit 6b3465d

Browse files
committed
Fix reading of DRY_RUN env variable
1 parent a57016d commit 6b3465d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

source/inverter.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ def __init__(self):
1414
self.device = None
1515

1616
self.hostname = EnvironmentVariableGetter.get("INVERTER_HOSTNAME")
17-
1817
self.battery_capacity = EnergyAmount(float(EnvironmentVariableGetter.get("INVERTER_BATTERY_CAPACITY")))
1918

20-
self.dry_run = EnvironmentVariableGetter.get(name_of_variable="DRY_RUN", default_value=True)
21-
2219
def connect(self) -> None:
2320
"""
2421
Connects to the inverter using the configured hostname.
@@ -56,7 +53,7 @@ def set_operation_mode(self, mode: OperationMode) -> None:
5653
Raises:
5754
RuntimeError: If the operation mode could not be set successfully.
5855
"""
59-
if self.dry_run:
56+
if EnvironmentVariableGetter.get(name_of_variable="DRY_RUN", default_value=True):
6057
self.log.info(f"Would set the inverter to {mode.name} but dry run is enabled")
6158
return
6259

0 commit comments

Comments
 (0)