Skip to content

Commit

Permalink
Merge pull request #19 from lurgh/switchfix
Browse files Browse the repository at this point in the history
Fix switches not associated with a BoW
djtimca authored Jun 13, 2022

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
2 parents d1c4758 + ac14831 commit 46a2521
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions custom_components/omnilogic/switch.py
Original file line number Diff line number Diff line change
@@ -125,9 +125,14 @@ async def async_turn_on(self, **kwargs):
self._last_action = time.time()
self.async_write_ha_state()

""" Patch: determine case where the switch/relay is not associated with a bow """
bow_id = int(self._item_id[3])
if len(self._item_id) == 4:
bow_id = 0

await self.coordinator.api.set_relay_valve(
int(self._item_id[1]),
int(self._item_id[3]),
bow_id,
int(self._item_id[-1]),
1,
)
@@ -138,9 +143,14 @@ async def async_turn_off(self, **kwargs):
self._last_action = time.time()
self.async_write_ha_state()

""" Patch: determine case where the switch/relay is not associated with a bow """
bow_id = int(self._item_id[3])
if len(self._item_id) == 4:
bow_id = 0

await self.coordinator.api.set_relay_valve(
int(self._item_id[1]),
int(self._item_id[3]),
bow_id,
int(self._item_id[-1]),
0,
)

0 comments on commit 46a2521

Please sign in to comment.