Skip to content

Commit

Permalink
Add GetStateData.get_relays() to get all available Relay instances
Browse files Browse the repository at this point in the history
  • Loading branch information
ylabonte committed Aug 15, 2023
1 parent 5d0f3e9 commit d201355
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "proconip"
version = "1.2.7"
version = "1.3.0"
authors = [
{ name="Yannic Labonte", email="[email protected]" },
]
Expand Down
8 changes: 6 additions & 2 deletions src/proconip/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,8 @@ def ph_plus_consumption(self) -> DataObject:

@property
def aggregated_relay_objects(self) -> list[DataObject]:
"""Returns a list of all relays."""
return self._relay_objects + self.external_relay_objects
"""Returns a list of all relay objects."""
return self._relay_objects + self._external_relay_objects

@property
def chlorine_dosage_relay(self) -> DataObject:
Expand All @@ -626,6 +626,10 @@ def get_relay(self, relay_id: int) -> Relay:
"""Returns the Relay instance for the given id."""
return Relay(self.aggregated_relay_objects[relay_id])

def get_relays(self) -> list[Relay]:
"""Returns a list of all relays as Relay instances."""
return self.relays() + self.external_relays()

def determine_overall_relay_bit_state(self) -> [int, int]:
"""Determine the overall relay bit state from the current state."""
relays = self.relays()
Expand Down
2 changes: 1 addition & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"yarl>=1.8",
]

setup(name="proconip", version="1.2.7", packages=find_packages())
setup(name="proconip", version="1.3.0", packages=find_packages())

0 comments on commit d201355

Please sign in to comment.