mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Improve naming and attrs of hostnameless Huawei LTE device tracker entities (#29281)
This commit is contained in:
parent
22225cea4d
commit
a9baa24fda
@ -145,11 +145,10 @@ class HuaweiLteScannerEntity(HuaweiLteBaseEntity, ScannerEntity):
|
|||||||
host = next((x for x in hosts if x.get("MacAddress") == self.mac), None)
|
host = next((x for x in hosts if x.get("MacAddress") == self.mac), None)
|
||||||
self._is_connected = host is not None
|
self._is_connected = host is not None
|
||||||
if self._is_connected:
|
if self._is_connected:
|
||||||
self._name = host.get("HostName", self.mac)
|
# HostName may be present with explicit None value
|
||||||
|
self._name = host.get("HostName") or self.mac
|
||||||
self._device_state_attributes = {
|
self._device_state_attributes = {
|
||||||
_better_snakecase(k): v
|
_better_snakecase(k): v for k, v in host.items() if k != "HostName"
|
||||||
for k, v in host.items()
|
|
||||||
if k not in ("MacAddress", "HostName")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user