Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add support for more than 16 Zones #27

Open
phiz118 opened this issue Dec 30, 2020 · 2 comments
Open

Feature request: Add support for more than 16 Zones #27

phiz118 opened this issue Dec 30, 2020 · 2 comments

Comments

@phiz118
Copy link

phiz118 commented Dec 30, 2020

I currently have 18 zones at my home. Rainbird controllers can support 22 stations. Under issue #15, the limit was 8 and they requested it updated to 16, but unsure if that change caused the limit. If so - would you mind updating the limit to 22? Here's the error I see in the logs. Home Assistant is loading the first 16 stations then I believe throwing this error that it failed due to the index out of range on self.states.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    await task
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/rainbird/switch.py", line 105, in update
    self._state = self._rainbird.get_zone_state(self._zone)
  File "/usr/local/lib/python3.8/site-packages/pyrainbird/__init__.py", line 125, in get_zone_state
    return self.zones.active(zone)
  File "/usr/local/lib/python3.8/site-packages/pyrainbird/data.py", line 104, in active
    return self.states[number - 1]
IndexError: tuple index out of range
@idoc69
Copy link

idoc69 commented Sep 25, 2022

I was just looking at this myself as our system has cray numbering and the last station is station 17 despite having only 11 zones. If you change line 223 of _ ini_.py from
lambda resp: States((mask % resp["activeStations"])[:4]), to
lambda resp: States((mask % resp["activeStations"])[:6]),
and line 92 of data.py from
def init(self, mask="0000"):
def init(self, mask="000000"):
this fixes the issue on my Home Assistant setup

@allenporter allenporter changed the title Stops at 16 Zones Feature request: Add support for more than 16 Zones Jan 7, 2023
@allenporter
Copy link
Owner

@idoc69 would you be able to enable debug logging and record the response from the server with the active stations in it? I think that would increase our confidence about ability to have tests for this case to ensure it works going forward.

allenporter added a commit that referenced this issue Jan 21, 2023
Simplify the states API by adding a new `active_set` that returns the
set of active zones. This also has cleanup preparing to better support
more zones.

Issue #27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants