mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Fix version not always available in onewire (#140260)
This commit is contained in:
parent
0abe7514b9
commit
a3e981f148
@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
import os
|
||||
@ -58,7 +59,7 @@ class OneWireHub:
|
||||
|
||||
owproxy: protocol._Proxy
|
||||
devices: list[OWDeviceDescription]
|
||||
_version: str
|
||||
_version: str | None = None
|
||||
|
||||
def __init__(self, hass: HomeAssistant, config_entry: OneWireConfigEntry) -> None:
|
||||
"""Initialize."""
|
||||
@ -74,6 +75,8 @@ class OneWireHub:
|
||||
port = self._config_entry.data[CONF_PORT]
|
||||
_LOGGER.debug("Initializing connection to %s:%s", host, port)
|
||||
self.owproxy = protocol.proxy(host, port)
|
||||
with contextlib.suppress(protocol.OwnetError):
|
||||
# Version is not available on all servers
|
||||
self._version = self.owproxy.read(protocol.PTH_VERSION).decode()
|
||||
self.devices = _discover_devices(self.owproxy)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user