Fix Netgear init error on orbi models (#59799)
* fix Netgear init error on orbi models * Update sensor.py
This commit is contained in:
parent
ac96c7bb1f
commit
3a7a4e8ffc
2 changed files with 4 additions and 2 deletions
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue