mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Remove zwave_js numeric sensor rounding (#107100)
This commit is contained in:
parent
0ccf8ffbc6
commit
80a616d237
@ -661,7 +661,7 @@ class ZWaveNumericSensor(ZwaveSensor):
|
|||||||
"""Return state of the sensor."""
|
"""Return state of the sensor."""
|
||||||
if self.info.primary_value.value is None:
|
if self.info.primary_value.value is None:
|
||||||
return 0
|
return 0
|
||||||
return round(float(self.info.primary_value.value), 2)
|
return float(self.info.primary_value.value)
|
||||||
|
|
||||||
|
|
||||||
class ZWaveMeterSensor(ZWaveNumericSensor):
|
class ZWaveMeterSensor(ZWaveNumericSensor):
|
||||||
|
@ -179,7 +179,7 @@ async def test_energy_sensors(
|
|||||||
state = hass.states.get(ENERGY_SENSOR)
|
state = hass.states.get(ENERGY_SENSOR)
|
||||||
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state == "0.16"
|
assert state.state == "0.164"
|
||||||
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == UnitOfEnergy.KILO_WATT_HOUR
|
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == UnitOfEnergy.KILO_WATT_HOUR
|
||||||
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.ENERGY
|
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.ENERGY
|
||||||
assert state.attributes[ATTR_STATE_CLASS] is SensorStateClass.TOTAL_INCREASING
|
assert state.attributes[ATTR_STATE_CLASS] is SensorStateClass.TOTAL_INCREASING
|
||||||
@ -187,7 +187,7 @@ async def test_energy_sensors(
|
|||||||
state = hass.states.get(VOLTAGE_SENSOR)
|
state = hass.states.get(VOLTAGE_SENSOR)
|
||||||
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state == "122.96"
|
assert state.state == "122.963"
|
||||||
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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user