mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Set zwave_js voltage sensor suggested precision (#107116)
This commit is contained in:
parent
d67c8bb44f
commit
00ff93a69e
@ -128,6 +128,7 @@ ENTITY_DESCRIPTION_KEY_DEVICE_CLASS_MAP: dict[
|
|||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||||
|
suggested_display_precision=0,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ENTITY_DESC_KEY_VOLTAGE,
|
ENTITY_DESC_KEY_VOLTAGE,
|
||||||
|
@ -165,7 +165,10 @@ async def test_invalid_multilevel_sensor_scale(
|
|||||||
|
|
||||||
|
|
||||||
async def test_energy_sensors(
|
async def test_energy_sensors(
|
||||||
hass: HomeAssistant, hank_binary_switch, integration
|
hass: HomeAssistant,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
hank_binary_switch,
|
||||||
|
integration,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test power and energy sensors."""
|
"""Test power and energy sensors."""
|
||||||
state = hass.states.get(POWER_SENSOR)
|
state = hass.states.get(POWER_SENSOR)
|
||||||
@ -191,6 +194,13 @@ async def test_energy_sensors(
|
|||||||
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == UnitOfElectricPotential.VOLT
|
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == UnitOfElectricPotential.VOLT
|
||||||
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.VOLTAGE
|
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.VOLTAGE
|
||||||
|
|
||||||
|
entity_entry = entity_registry.async_get(VOLTAGE_SENSOR)
|
||||||
|
|
||||||
|
assert entity_entry is not None
|
||||||
|
sensor_options = entity_entry.options.get("sensor")
|
||||||
|
assert sensor_options is not None
|
||||||
|
assert sensor_options["suggested_display_precision"] == 0
|
||||||
|
|
||||||
state = hass.states.get(CURRENT_SENSOR)
|
state = hass.states.get(CURRENT_SENSOR)
|
||||||
|
|
||||||
assert state
|
assert state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user