Fix onewire setup with devices missing a type (#183973)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
epenet
2026-10-02 09:02:29 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent d5312c4dad
commit 4b8f976ede
2 changed files with 12 additions and 4 deletions
@@ -6,7 +6,7 @@ import logging
import os
from aio_ownet.definitions import OWServerCommonPath
from aio_ownet.exceptions import OWServerProtocolError, OWServerReturnError
from aio_ownet.exceptions import OWServerReturnError
from aio_ownet.proxy import OWServerStatelessProxy
from homeassistant.config_entries import ConfigEntry
@@ -181,7 +181,7 @@ async def _get_device_type(
"""Get device model."""
try:
device_type = (await owproxy.read(f"{device_path}type")).decode()
except OWServerProtocolError as exc:
except OWServerReturnError as exc:
_LOGGER.debug("Unable to read `%stype`: %s", device_path, exc)
return None
_LOGGER.debug("read `%stype`: %s", device_path, device_type)
+10 -2
View File
@@ -1,6 +1,6 @@
"""Constants for 1-Wire integration."""
from aio_ownet.exceptions import OWServerProtocolError
from aio_ownet.exceptions import OWServerProtocolError, OWServerReturnError
ATTR_INJECT_READS = "inject_reads"
@@ -54,7 +54,15 @@ MOCK_OWPROXY_DEVICES = {
},
"16.111111111111": {
# Test case for issue #115984, where the device type cannot be read
ATTR_INJECT_READS: {"/type": [OWServerProtocolError()]},
ATTR_INJECT_READS: {
"/type": [
OWServerReturnError(
1,
"Startup - command line parameters invalid",
"/16.111111111111/type",
)
]
},
},
"1F.111111111111": {
ATTR_INJECT_READS: {"/type": [b"DS2409"]},