Improve naming and attrs of hostnameless Huawei LTE device tracker entities (#29281)

This commit is contained in:
Ville Skyttä 2019-12-02 03:58:31 +08:00 committed by Martin Hjelmare
parent 22225cea4d
commit a9baa24fda

View File

@ -145,11 +145,10 @@ class HuaweiLteScannerEntity(HuaweiLteBaseEntity, ScannerEntity):
host = next((x for x in hosts if x.get("MacAddress") == self.mac), None)
self._is_connected = host is not None
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 = {
_better_snakecase(k): v
for k, v in host.items()
if k not in ("MacAddress", "HostName")
_better_snakecase(k): v for k, v in host.items() if k != "HostName"
}