home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.03k stars 29.69k forks source link

Pentair ScreenLogic integration crash when loading #86593

Closed American1337 closed 1 year ago

American1337 commented 1 year ago

The problem

Pentair ScreenLogic integration is crashing when connecting to my pentair system.

Discussed in screenlogicpy github and it there is a fix in that library that handles split messages, updates needs to be merged into home assistant.

See https://github.com/dieselrabbit/screenlogicpy/issues/30

Also include the logs

What version of Home Assistant Core has the issue?

Home Assistant 2022.12.8

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Pentair ScreenLogic

Link to integration documentation on our website

https://www.home-assistant.io/integrations/screenlogic/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-01-22 15:00:57.315 ERROR (MainThread) [homeassistant] Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/screenlogicpy/requests/utility.py", line 41, in takeMessages
    message, pos = getSome(f"{msgLength}s", data, pos)
  File "/usr/local/lib/python3.10/site-packages/screenlogicpy/requests/utility.py", line 69, in getSome
    return struct.unpack_from(fmt, buff, offset)[0], newoffset
struct.error: unpack_from requires a buffer of at least 1076 bytes for unpacking 1068 bytes at offset 8 (actual buffer size is 1024)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 868, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.10/site-packages/screenlogicpy/requests/protocol.py", line 45, in data_received
    for messageID, messageCode, message in takeMessages(data):
  File "/usr/local/lib/python3.10/site-packages/screenlogicpy/requests/utility.py", line 45, in takeMessages
    raise ScreenLogicError(
screenlogicpy.const.ScreenLogicError: Unexpected amount of data received. Data: b'\x03\x00\xf50,\x04\x00\x00d\x00\x00\x00(h(h\x00\x02\x00\xa00\x00\x00\x00\x0e\x00\x00\x00Water Features\x00\x00\x1b\x00\x00\x00\xf4\x01\x00\x00\x03\x00\x00\x00Spa\x00G\x01\x01\x01\x00\x00\x00\x01\xd0\x02\x00\x00\xf5\x01\x00\x00\x07\x00\x00\x00Cleaner\x00\x15\x05\x00\x00\x00\x00\x00\x02\xd0\x02\x00\x00\xf6\x01\x00\x00\x04\x00\x00\x00Jets-\x00\x01\x00\x00\x00\x00\x03\xd0\x02\x00\x00\xf7\x01\x00\x00\r\x00\x00\x00Water Feature\x00\x00\x00S\x00\x02\x00\x00\x00\x00\x04\xd0\x02\x00\x00\xf8\x01\x00\x00\x0b\x00\x00\x00Fiber Optic\x00\x1d\x0b\x04\x00\x00\x00\x00\x05\xd0\x02\x00\x00\xf9\x01\x00\x00\x04\x00\x00\x00Pool<\x02\x00\x01\x00\x00\x00\x06\xd0\x02\x00\x00\xfa\x01\x00\x00\x0b\x00\x00\x00Color Wheel\x00\x16\x0c\x03\x00\x00\x00\n\x07\xd0\x02\x00\x00\xfb\x01\x00\x00\x0b\x00\x00\x00Color Wheel\x00\x16\x0c\x03\x00\x00\x00\n\x08\xd0\x02\x00\x00\xfc\x01\x00\x00\x05\x00\x00\x00Aux 7\x00\x00\x00\x08\x00\x05\x00\x00\x00\x00\t\xd0\x02\x00\x00\xfd\x01\x00\x00\x05\x00\x00\x00Aux 8\x00\x00\x00\t\x00\x05\x00\x00\x00\x00\n\xd0\x02\x00\x00\xfe\x01\x00\x00\t\x00\x00\x00Spa Light\x00\x00\x00I\n\x03\x00\x00\x00\x00\x0b\xd0\x02\x00\x00\xff\x01\x00\x00\x0b\x00\x00\x00Pool Light \x00\\\t\x03\x00\x00\x00\x00\x0c\xd0\x02\x00\x00\x00\x02\x00\x00\x0b\x00\x00\x00Pool Light \x00]\t\x03\x00\x00\x00\x00\r\xd0\x02\x00\x00\x01\x02\x00\x00\x0b\x00\x00\x00Pool Light \x00^\t\x03\x00\x00\x00\x00\x0e\xd0\x02\x00\x00\x02\x02\x00\x00\x0b\x00\x00\x00Pool Light \x00_\t\x03\x00\x00\x00\x00\x0f\xd0\x02\x00\x00\x03\x02\x00\x00\x0b\x00\x00\x00Pool Light \x00`\t\x03\x00\x00\x00\x00\x10\xd0\x02\x00\x00\x04\x02\x00\x00\t\x00\x00\x00Waterfall\x00\x00\x00U\x00\x02\x00\x00\x00\x00\x11\xd0\x02\x00\x00\x05\x02\x00\x00\x05\x00\x00\x00Aux 8\x00\x00\x00\t\x00\x05\x00\x00\x00\x00\x12\xd0\x02\x00\x00\x06\x02\x00\x00\x05\x00\x00\x00Aux 9\x00\x00\x00\n\x00\x05\x00\x00\x00\x00\x13\xd0\x02\x00\x00\x07\x02\x00\x00\x06\x00\x00\x00Aux 10\x00\x00\x0b\x00\x05\x00\x00\x00\x00\x14\xd0\x02\x00\x00\x08\x02\x00\x00\x08\x00\x00\x00Upr Poola\x00\x02\x00\x00\x00\x00\x15\xd0\x02\x00\x00\t\x02\x00\x00\x0b\x00\x00\x00Upr Cleaner\x00b\x00\x00\x00\x00\x00\x00\x16\xd0\x02\x00\x00\n\x02\x00\x00\x0b\x00\x00\x00Upr Wtrfall\x00c\x00\x02\x00\x00\x00\x00\x17\xd0\x02\x00\x00\x0b\x02\x00\x00\x0b\x00\x00\x00U Pool Ligh\x00d\x07\x04\x00\x00\x00\x00\x18\xd0\x02\x00\x00\x0c\x02\x00\x00\x05\x00\x00\x00Aux 5\x00\x00\x00\x06\x00\x05\x00\x00\x00\x00\x19\xd0\x02\x00\x00\x1c\x02\x00\x00\x05\x00\x00\x00Slide\x00\x00\x00E\x00\x02\x00\x00\x00\x00)\xd0\x02\x00\x00\x1d\x02\x00\x00\r\x00\x00\x00Spa Waterfall\x00\x00\x00M\x0e\x02\x00\x00\x00\x00*\xd0\x02\x00\x00\x08\x00\x00\x00\x05\x00\x00\x00White\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\x0b\x00\x00\x00Light Green\x00\xa0\x00\x00\x00\xff\x00\x00\x00\xa0\x00\x00\x00\x05\x00\x00\x00Green\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\x00P\x00\x00\x00\x04\x00\x00\x00Cyan\x00\x00\x00\x00\xff\x00\x00\x00\xc8\x00\x00\x00\x04\x00\x00\x00Blued\x00\x00\x00\x8c\x00\x00\x00\xff\x00\x00\x00\x08\x00\x00\x00Lavender\xe6\x00\x00\x00\x82\x00\x00\x00\xff\x00\x00\x00\x07\x00\x00\x00Magenta\x00\xff\x00\x00\x00\x00\x00\x00\x00'
2023-01-22 15:01:02.280 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Pentair: 20-17-74 for screenlogic
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/screenlogicpy/requests/config.py", line 12, in async_request_pool_config
    await asyncio.wait_for(
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/screenlogic/__init__.py", line 60, in async_setup_entry
    await gateway.async_connect()
  File "/usr/local/lib/python3.10/site-packages/screenlogicpy/gateway.py", line 77, in async_connect
    await self._async_get_config()
  File "/usr/local/lib/python3.10/site-packages/screenlogicpy/gateway.py", line 176, in _async_get_config
    await async_request_pool_config(self.__protocol, self.__data)
  File "/usr/local/lib/python3.10/site-packages/screenlogicpy/requests/config.py", line 24, in async_request_pool_config
    raise ScreenLogicWarning("Timeout polling pool config")
screenlogicpy.const.ScreenLogicWarning: Timeout polling pool config

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @dieselrabbit, @bdraco, mind taking a look at this issue as it has been labeled with an integration (screenlogic) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `screenlogic` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign screenlogic` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


screenlogic documentation screenlogic source (message by IssueLinks)