Skip to content

Commit

Permalink
Fix changes in sensors linting
Browse files Browse the repository at this point in the history
  • Loading branch information
maslyankov committed Jan 3, 2025
1 parent 18bf1f2 commit 226b772
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sunsynk/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Sensor:
factor: float = 1
bitmask: int = 0
absolute: bool = False
zero_export_absolute: bool = False # New parameter to force positive values in zero export mode
zero_export_absolute: bool = False
_load_limit: int | None = attrs.field(default=None, init=False)

@property
def id(self) -> str:
Expand Down Expand Up @@ -68,9 +69,8 @@ def masked(self, regs: RegType) -> RegType:
def dependencies(self) -> list[Sensor]:
"""Dependencies."""
if self.zero_export_absolute:
# Find and return the Load Limit sensor
from sunsynk.definitions.three_phase_common import SENSORS
load_limit = next((s for s in SENSORS.all if s.name == "Load Limit"), None)
load_limit = next((s for s in SENSORS.all if isinstance(s, Sensor) and s.name == "Load Limit"), None)
return [load_limit] if load_limit else []
return []

Expand Down

0 comments on commit 226b772

Please sign in to comment.