minimal validation before return data from coordinator
This commit is contained in:
@@ -60,7 +60,11 @@ class FplEntity(CoordinatorEntity, SensorEntity):
|
|||||||
|
|
||||||
def getData(self, field):
|
def getData(self, field):
|
||||||
"""call this method to retrieve sensor data"""
|
"""call this method to retrieve sensor data"""
|
||||||
return self.coordinator.data.get(self.account).get(field, None)
|
if self.coordinator.data is not None:
|
||||||
|
account = self.coordinator.data.get(self.account)
|
||||||
|
if account is not None:
|
||||||
|
return account.get(field, None)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class FplEnergyEntity(FplEntity):
|
class FplEnergyEntity(FplEntity):
|
||||||
|
|||||||
Reference in New Issue
Block a user