Repository navigation
Show specific config flow errors for connection failures - #27
Merged
Merged
Conversation
Every failure while connecting or validating the PIN ended up as error_unknown, shown as "Failed to connect to the device". Map the failures a user can act on to their own message: - BleakNotFoundError -> error_device_not_found - BleakOutOfConnectionSlotsError -> error_no_connection_slot - BlancoUnitGattTimeoutError, still stuck after removing the device from BlueZ -> error_device_not_responding - BlancoUnitConnectionError, BleakError, OSError, TimeoutError -> error_connection error_unknown stays for anything else. Both placeholders now carry the exception type, since a TimeoutError has no message of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # tests/test_config_flow.py
parse_response raised ValueError, which the config flow maps to invalid_pin_format. The PIN format is checked before connecting, so a garbled or mismatched response from the device was shown as "PIN must be exactly 5 digits". It now raises BlancoUnitProtocolError, a BlancoUnitConnectionError, and ends up as error_connection. The not responding message pointed at the Blanco Unit, but the stuck GATT operation lives in BlueZ on the host. Suggest rebooting the host or restarting the proxy first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 6 tasks
github-actions Bot
pushed a commit
to alexhaller/blanco_unit
that referenced
this pull request
Nov 9, 2026
## [2.0.2](v2.0.1...v2.0.2) (2026-11-09) ### Bug Fixes * harden the BLE connection against leaks and stuck GATT operations ([ef3c1fa](ef3c1fa)), closes [Nailik#24](https://github.com/alexhaller/blanco_unit/issues/24) [Nailik#25](https://github.com/alexhaller/blanco_unit/issues/25) [Nailik#27](https://github.com/alexhaller/blanco_unit/issues/27) * point the documentation and issue links at this repository ([d423f16](d423f16)), closes [hacs/default#13647](hacs/default#13647) * stop reporting the filter and CO2 capacity as a battery ([5311f42](5311f42))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every failure while connecting or validating the PIN during setup, reauth or reconfigure ended up as
error_unknown("Failed to connect to the device: …"). The failures a user can act on now get their own message.BleakNotFoundError, device went away between discovery and connectingerror_device_not_found(existing)BleakOutOfConnectionSlotsErrorerror_no_connection_slot(new)BlancoUnitGattTimeoutError, still stuck after reconnecting (and removing the device from BlueZ on a local adapter)error_device_not_responding(new)BlancoUnitConnectionError(including the newBlancoUnitProtocolError),BleakError,OSError,TimeoutErrorerror_connection(new)error_unknown{error}now includes the exception type (TimeoutError,BleakError: …), since aTimeoutErrorhas no message of its own.Invalid chunk stream,Chunk message ID mismatch,Failed to parse JSON response) raisedValueErrorbefore. The config flow mapsValueErrortoinvalid_pin_format, so it was shown as "PIN must be exactly 5 digits", although the PIN format is checked before connecting.parse_responsenow raisesBlancoUnitProtocolError, aBlancoUnitConnectionError, which ends up aserror_connection.en.jsonandde.json.error_invalid_authentication.validate_pinreports it as a result, not as an exception, so nothing changes there.Besides
config_flow.py, the two translation files andtests/test_config_flow.py, onlyparse_responseinclient.py(and its tests) changes.Test plan
pytest tests: 383 passed, 68 snapshots passedvalidate_pinandparse_responseshowserror_connection, notinvalid_pin_format🤖 Generated with Claude Code