Skip to content

Commit

Permalink
Add some diagnostics to trace sporadic disconnects
Browse files Browse the repository at this point in the history
  • Loading branch information
gazoodle committed Apr 5, 2022
1 parent 480c60c commit 5d0da9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ https://www.gnu.org/licenses/gpl-3.0.html
- Config change code could attempt to set result on a future that was already
set leading to an unhandled exception that could result in the partial status
update task being cancelled
- Disconnected facades now cleared out of the system correctly
- Added some more diagnostics to chase sporadic disconnects

## Done/Fixed in 0.4.4

Expand Down
9 changes: 9 additions & 0 deletions src/geckolib/async_spa.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ async def _connect(self) -> None:

version_handler = await self._protocol.get(self._get_version_handler_func)
if version_handler is None:
_LOGGER.error("Cannot get version, protocol retry count exceeded")
await self._event_handler(
GeckoSpaEvent.CONNECTION_PROTOCOL_RETRY_COUNT_EXCEEDED
)
Expand All @@ -218,6 +219,7 @@ async def _connect(self) -> None:

get_channel_handler = await self._protocol.get(self._get_channel_handler_func)
if get_channel_handler is None:
_LOGGER.error("Cannot get channel, protocol retry count exceeded")
await self._event_handler(
GeckoSpaEvent.CONNECTION_PROTOCOL_RETRY_COUNT_EXCEEDED
)
Expand All @@ -237,6 +239,7 @@ async def _connect(self) -> None:
self._get_config_file_handler_func
)
if config_file_handler is None:
_LOGGER.error("Cannot get file, protocol retry count exceeded")
await self._event_handler(
GeckoSpaEvent.CONNECTION_PROTOCOL_RETRY_COUNT_EXCEEDED
)
Expand Down Expand Up @@ -334,6 +337,7 @@ async def _connect(self) -> None:
parms=self.sendparms,
),
):
_LOGGER.error("Cannot get full struct, protocol retry count exceeded")
await self._event_handler(
GeckoSpaEvent.CONNECTION_PROTOCOL_RETRY_COUNT_EXCEEDED
)
Expand Down Expand Up @@ -523,6 +527,7 @@ async def _on_async_set_value(self, pos, length, newvalue) -> None:
)

if pack_command_handler is None:
_LOGGER.error("Cannot set value, protocol retry count exceeded")
await self._event_handler(GeckoSpaEvent.ERROR_PROTOCOL_RETRY_COUNT_EXCEEDED)

def _on_set_value(self, pos, length, newvalue) -> None:
Expand Down Expand Up @@ -554,6 +559,7 @@ async def async_press(self, keypad) -> None:
)

if pack_command_handler is None:
_LOGGER.error("Cannot press keypad, protocol retry count exceeded")
await self._event_handler(GeckoSpaEvent.ERROR_PROTOCOL_RETRY_COUNT_EXCEEDED)

def press(self, keypad) -> None:
Expand Down Expand Up @@ -586,6 +592,7 @@ async def async_get_watercare(self) -> Optional[int]:
)

if get_watercare_handler is None:
_LOGGER.error("Cannot get watercare, protocol retry count exceeded")
await self._event_handler(GeckoSpaEvent.ERROR_PROTOCOL_RETRY_COUNT_EXCEEDED)
return None

Expand All @@ -609,6 +616,7 @@ async def async_set_watercare(self, new_mode) -> None:
)

if set_watercare_handler is None:
_LOGGER.error("Cannot set version, protocol retry count exceeded")
await self._event_handler(GeckoSpaEvent.ERROR_PROTOCOL_RETRY_COUNT_EXCEEDED)

def _get_reminders_handler_func(self) -> GeckoRemindersProtocolHandler:
Expand All @@ -632,6 +640,7 @@ async def async_get_reminders(self) -> List[Tuple]:
)

if get_reminders_handler is None:
_LOGGER.error("Cannot get reminders, protocol retry count exceeded")
await self._event_handler(GeckoSpaEvent.ERROR_PROTOCOL_RETRY_COUNT_EXCEEDED)
return []

Expand Down

0 comments on commit 5d0da9d

Please sign in to comment.