Fix Netgear init error on orbi models (#59799)

* fix Netgear init error on orbi models

* Update sensor.py
This commit is contained in:
starkillerOG 2021-11-17 11:49:12 +01:00 committed by GitHub
parent ac96c7bb1f
commit 3a7a4e8ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -172,6 +172,8 @@ class NetgearRouter:
"link_rate": None,
"signal": None,
"ip": None,
"ssid": None,
"conn_ap_mac": None,
}
await self.async_update_device_trackers()

View File

@ -65,7 +65,7 @@ class NetgearSensorEntity(NetgearDeviceEntity, SensorEntity):
self.entity_description = SENSOR_TYPES[self._attribute]
self._name = f"{self.get_device_name()} {self.entity_description.name}"
self._unique_id = f"{self._mac}-{self._attribute}"
self._state = self._device[self._attribute]
self._state = self._device.get(self._attribute)
@property
def native_value(self):
@ -77,7 +77,7 @@ class NetgearSensorEntity(NetgearDeviceEntity, SensorEntity):
"""Update the Netgear device."""
self._device = self._router.devices[self._mac]
self._active = self._device["active"]
if self._device[self._attribute] is not None:
if self._device.get(self._attribute) is not None:
self._state = self._device[self._attribute]
self.async_write_ha_state()