We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd1803c commit a47672cCopy full SHA for a47672c
custom_components/monta/sensor.py
@@ -342,8 +342,11 @@ def __init__(
342
@property
343
def native_value(self) -> StateType:
344
"""Return the state."""
345
+ transactions = self.coordinator.data.get(ATTR_TRANSACTIONS, [])
346
+ if not transactions:
347
+ return None
348
return self.entity_description.value_fn(
- self.coordinator.data[ATTR_TRANSACTIONS][0]["state"]
349
+ transactions[0]["state"]
350
)
351
352
0 commit comments