Skip to content

Commit

Permalink
fix: cannot update multiple stations
Browse files Browse the repository at this point in the history
  • Loading branch information
EdLeckert committed Oct 12, 2024
1 parent 7098244 commit a95c8c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyopensprinkler/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ def _bit_check(self, bit_property):
return bool(bits[position])

async def _bit_set(self, bit_property, bit_update_name, value):
bits = self._controller._state["stations"][bit_property]
bit_list = self._controller._state["stations"][bit_property]
bank = math.floor(self._index / 8)
bits = list(reversed([int(x) for x in list("{0:08b}".format(bits[bank]))]))
bits = list(reversed([int(x) for x in list("{0:08b}".format(bit_list[bank]))]))
position = self._index % 8
value = int(value)
bits[position] = value
bits = list(reversed(bits))
bits = "".join(map(str, bits))
bits = int(bits, 2)
bit_list[bank] = bits
self._controller._state["stations"][bit_property] = bit_list
return await self._set_attribute(bit_update_name + str(bank), bits)

async def run(self, seconds=None):
Expand Down

0 comments on commit a95c8c2

Please sign in to comment.