Correcting issue where sensor is not available and goes offline instead of reporting 0
This commit is contained in:
@@ -110,7 +110,10 @@ class FplDailyDeliveredKWHSensor(FplEntity):
|
|||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
data = self.getData("daily_usage")
|
data = self.getData("daily_usage")
|
||||||
return data[-1]["netDeliveredKwh"]
|
try:
|
||||||
|
return data[-1]["netDeliveredKwh"]
|
||||||
|
except:
|
||||||
|
return 0
|
||||||
|
|
||||||
def defineAttributes(self):
|
def defineAttributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
|
|||||||
Reference in New Issue
Block a user