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

Fix bug in decoding RetrieveScheduleResponse #363

Merged
merged 1 commit into from
Feb 17, 2024
Merged

Fix bug in decoding RetrieveScheduleResponse #363

merged 1 commit into from
Feb 17, 2024

Conversation

allenporter
Copy link
Owner

Fixes a bug decoding an integer in the wrong base. Currently able to reproduce when using a rain delay above 10:

Unexpected error fetching x.x.x.x Schedule data: invalid literal for int() with base 10: '0E'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/rainbird/coordinator.py", line 150, in _async_update_data
    return await self._controller.get_schedule()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyrainbird/async_client.py", line 428, in get_schedule
    result = await self._process_command(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyrainbird/async_client.py", line 489, in _process_command
    decoded = rainbird.decode(decrypted_data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyrainbird/rainbird.py", line 187, in decode
    return {TYPE: cmd_template[TYPE], **decoder(data, cmd_template)}
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyrainbird/rainbird.py", line 45, in decode_schedule
    "rainDelay": int(rest[4:6]),
                 ^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '0E'

@allenporter allenporter merged commit ef314a1 into main Feb 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant