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

This commit is contained in:
Ville Skyttä authored and Martin Hjelmare committed 2019-12-01 20:58:31 +01:00
1 parent 22225cea4d
commit a9baa24fda
1 file changed
+3 -4
@@ -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"
}