mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Add units of measurement to Bring integration (#131763)
This commit is contained in:
parent
fe2bca51a4
commit
4257277086
@ -9,4 +9,3 @@ ATTR_ITEM_NAME: Final = "item"
|
|||||||
ATTR_NOTIFICATION_TYPE: Final = "message"
|
ATTR_NOTIFICATION_TYPE: Final = "message"
|
||||||
|
|
||||||
SERVICE_PUSH_NOTIFICATION = "send_message"
|
SERVICE_PUSH_NOTIFICATION = "send_message"
|
||||||
UNIT_ITEMS = "items"
|
|
||||||
|
@ -20,7 +20,6 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
|
|
||||||
from . import BringConfigEntry
|
from . import BringConfigEntry
|
||||||
from .const import UNIT_ITEMS
|
|
||||||
from .coordinator import BringData, BringDataUpdateCoordinator
|
from .coordinator import BringData, BringDataUpdateCoordinator
|
||||||
from .entity import BringBaseEntity
|
from .entity import BringBaseEntity
|
||||||
from .util import list_language, sum_attributes
|
from .util import list_language, sum_attributes
|
||||||
@ -48,19 +47,16 @@ SENSOR_DESCRIPTIONS: tuple[BringSensorEntityDescription, ...] = (
|
|||||||
key=BringSensor.URGENT,
|
key=BringSensor.URGENT,
|
||||||
translation_key=BringSensor.URGENT,
|
translation_key=BringSensor.URGENT,
|
||||||
value_fn=lambda lst, _: sum_attributes(lst, "urgent"),
|
value_fn=lambda lst, _: sum_attributes(lst, "urgent"),
|
||||||
native_unit_of_measurement=UNIT_ITEMS,
|
|
||||||
),
|
),
|
||||||
BringSensorEntityDescription(
|
BringSensorEntityDescription(
|
||||||
key=BringSensor.CONVENIENT,
|
key=BringSensor.CONVENIENT,
|
||||||
translation_key=BringSensor.CONVENIENT,
|
translation_key=BringSensor.CONVENIENT,
|
||||||
value_fn=lambda lst, _: sum_attributes(lst, "convenient"),
|
value_fn=lambda lst, _: sum_attributes(lst, "convenient"),
|
||||||
native_unit_of_measurement=UNIT_ITEMS,
|
|
||||||
),
|
),
|
||||||
BringSensorEntityDescription(
|
BringSensorEntityDescription(
|
||||||
key=BringSensor.DISCOUNTED,
|
key=BringSensor.DISCOUNTED,
|
||||||
translation_key=BringSensor.DISCOUNTED,
|
translation_key=BringSensor.DISCOUNTED,
|
||||||
value_fn=lambda lst, _: sum_attributes(lst, "discounted"),
|
value_fn=lambda lst, _: sum_attributes(lst, "discounted"),
|
||||||
native_unit_of_measurement=UNIT_ITEMS,
|
|
||||||
),
|
),
|
||||||
BringSensorEntityDescription(
|
BringSensorEntityDescription(
|
||||||
key=BringSensor.LIST_LANGUAGE,
|
key=BringSensor.LIST_LANGUAGE,
|
||||||
|
@ -29,13 +29,16 @@
|
|||||||
"entity": {
|
"entity": {
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"urgent": {
|
"urgent": {
|
||||||
"name": "Urgent"
|
"name": "Urgent",
|
||||||
|
"unit_of_measurement": "items"
|
||||||
},
|
},
|
||||||
"convenient": {
|
"convenient": {
|
||||||
"name": "On occasion"
|
"name": "On occasion",
|
||||||
|
"unit_of_measurement": "items"
|
||||||
},
|
},
|
||||||
"discounted": {
|
"discounted": {
|
||||||
"name": "Discount only"
|
"name": "Discount only",
|
||||||
|
"unit_of_measurement": "items"
|
||||||
},
|
},
|
||||||
"list_language": {
|
"list_language": {
|
||||||
"name": "Region & language",
|
"name": "Region & language",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user