mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Tone down huawei_lte logging (#26020)
* Tone down huawei_lte logging Refs https://github.com/home-assistant/home-assistant/pull/23809 * Fix import order
This commit is contained in:
parent
ca74a23cf1
commit
9dff2e188b
@ -101,8 +101,8 @@ class RouterData:
|
||||
if debugging or path in self._subscriptions:
|
||||
try:
|
||||
setattr(self, path, func())
|
||||
except ResponseErrorNotSupportedException as ex:
|
||||
_LOGGER.warning("%s not supported by device", path, exc_info=ex)
|
||||
except ResponseErrorNotSupportedException:
|
||||
_LOGGER.warning("%s not supported by device", path)
|
||||
self._subscriptions.discard(path)
|
||||
finally:
|
||||
_LOGGER.debug("%s=%s", path, getattr(self, path))
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Support for device tracking of Huawei LTE routers."""
|
||||
import logging
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import attr
|
||||
@ -9,9 +10,12 @@ from homeassistant.components.device_tracker import PLATFORM_SCHEMA, DeviceScann
|
||||
from homeassistant.const import CONF_URL
|
||||
from . import DATA_KEY, RouterData
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Optional(CONF_URL): cv.url})
|
||||
|
||||
HOSTS_PATH = "wlan_host_list.Hosts"
|
||||
HOSTS_PATH = "wlan_host_list.Hosts.Host"
|
||||
|
||||
|
||||
def get_scanner(hass, config):
|
||||
@ -32,11 +36,12 @@ class HuaweiLteScanner(DeviceScanner):
|
||||
def scan_devices(self) -> List[str]:
|
||||
"""Scan for devices."""
|
||||
self.data.update()
|
||||
self._hosts = {
|
||||
x["MacAddress"]: x
|
||||
for x in self.data[HOSTS_PATH + ".Host"]
|
||||
if x.get("MacAddress")
|
||||
}
|
||||
try:
|
||||
self._hosts = {
|
||||
x["MacAddress"]: x for x in self.data[HOSTS_PATH] if x.get("MacAddress")
|
||||
}
|
||||
except KeyError:
|
||||
_LOGGER.debug("%s not in data", HOSTS_PATH)
|
||||
return list(self._hosts)
|
||||
|
||||
def get_device_name(self, device: str) -> Optional[str]:
|
||||
|
@ -203,7 +203,7 @@ class HuaweiLteSensor(Entity):
|
||||
try:
|
||||
value = self.data[self.path]
|
||||
except KeyError:
|
||||
_LOGGER.warning("%s not in data", self.path)
|
||||
_LOGGER.debug("%s not in data", self.path)
|
||||
value = None
|
||||
|
||||
formatter = self.meta.get("formatter")
|
||||
|
Loading…
x
Reference in New Issue
Block a user