mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 17:31:15 -04:00
Add state_class to Monzo sensor descriptions (#182501)
This commit is contained in:
@@ -8,6 +8,7 @@ from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
@@ -35,6 +36,7 @@ ACCOUNT_SENSORS = (
|
||||
value_fn=lambda data: data["balance"]["balance"] / 100,
|
||||
device_class=SensorDeviceClass.MONETARY,
|
||||
suggested_display_precision=2,
|
||||
state_class=SensorStateClass.TOTAL,
|
||||
),
|
||||
MonzoSensorEntityDescription(
|
||||
key="total_balance",
|
||||
@@ -42,6 +44,7 @@ ACCOUNT_SENSORS = (
|
||||
value_fn=lambda data: data["balance"]["total_balance"] / 100,
|
||||
device_class=SensorDeviceClass.MONETARY,
|
||||
suggested_display_precision=2,
|
||||
state_class=SensorStateClass.TOTAL,
|
||||
),
|
||||
MonzoSensorEntityDescription(
|
||||
key="spend_today",
|
||||
@@ -59,6 +62,7 @@ POT_SENSORS = (
|
||||
value_fn=lambda data: data["balance"] / 100,
|
||||
device_class=SensorDeviceClass.MONETARY,
|
||||
suggested_display_precision=2,
|
||||
state_class=SensorStateClass.TOTAL,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
@@ -45,6 +47,7 @@
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by Monzo',
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'monetary',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Current Account Balance',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: 'GBP',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
@@ -117,7 +120,9 @@
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
@@ -157,6 +162,7 @@
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by Monzo',
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'monetary',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Current Account Total balance',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: 'GBP',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
@@ -173,7 +179,9 @@
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
@@ -213,6 +221,7 @@
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by Monzo',
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'monetary',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Flex Balance',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: 'EUR',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
@@ -285,7 +294,9 @@
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
@@ -325,6 +336,7 @@
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by Monzo',
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'monetary',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Flex Total balance',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: 'EUR',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
@@ -341,7 +353,9 @@
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
@@ -381,6 +395,7 @@
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by Monzo',
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'monetary',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Savings Balance',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL: 'total'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: 'USD',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
|
||||
Reference in New Issue
Block a user