mirror of
https://github.com/home-assistant/core.git
synced 2026-09-05 02:25:07 -05:00
Use UnitOfTime.DAYS instead of custom unit for LetPot number entity (#153054)
This commit is contained in:
@@ -12,7 +12,7 @@ from homeassistant.components.number import (
|
||||
NumberEntityDescription,
|
||||
NumberMode,
|
||||
)
|
||||
from homeassistant.const import PRECISION_WHOLE, EntityCategory
|
||||
from homeassistant.const import PRECISION_WHOLE, EntityCategory, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
@@ -72,6 +72,7 @@ NUMBERS: tuple[LetPotNumberEntityDescription, ...] = (
|
||||
LetPotNumberEntityDescription(
|
||||
key="plant_days",
|
||||
translation_key="plant_days",
|
||||
native_unit_of_measurement=UnitOfTime.DAYS,
|
||||
value_fn=lambda coordinator: coordinator.data.plant_days,
|
||||
set_value_fn=(
|
||||
lambda device_client, serial, value: device_client.set_plant_days(
|
||||
|
||||
@@ -54,8 +54,7 @@
|
||||
"name": "Light brightness"
|
||||
},
|
||||
"plant_days": {
|
||||
"name": "Plants age",
|
||||
"unit_of_measurement": "days"
|
||||
"name": "Plants age"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
'supported_features': 0,
|
||||
'translation_key': 'plant_days',
|
||||
'unique_id': 'a1b2c3d4e5f6a1b2c3d4e5f6_LPH63ABCD_plant_days',
|
||||
'unit_of_measurement': 'days',
|
||||
'unit_of_measurement': <UnitOfTime.DAYS: 'd'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[number.garden_plants_age-state]
|
||||
@@ -104,7 +104,7 @@
|
||||
'min': 0.0,
|
||||
'mode': <NumberMode.BOX: 'box'>,
|
||||
'step': 1,
|
||||
'unit_of_measurement': 'days',
|
||||
'unit_of_measurement': <UnitOfTime.DAYS: 'd'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.garden_plants_age',
|
||||
|
||||
Reference in New Issue
Block a user