Skip to content

Commit

Permalink
Remove zwave_js numeric sensor rounding (#107100)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinHjelmare authored Jan 4, 2024
1 parent 0ccf8ff commit 80a616d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/zwave_js/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def native_value(self) -> float:
"""Return state of the sensor."""
if self.info.primary_value.value is None:
return 0
return round(float(self.info.primary_value.value), 2)
return float(self.info.primary_value.value)


class ZWaveMeterSensor(ZWaveNumericSensor):
Expand Down
4 changes: 2 additions & 2 deletions tests/components/zwave_js/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ async def test_energy_sensors(
state = hass.states.get(ENERGY_SENSOR)

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_DEVICE_CLASS] == SensorDeviceClass.ENERGY
assert state.attributes[ATTR_STATE_CLASS] is SensorStateClass.TOTAL_INCREASING

state = hass.states.get(VOLTAGE_SENSOR)

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_DEVICE_CLASS] == SensorDeviceClass.VOLTAGE

Expand Down

0 comments on commit 80a616d

Please sign in to comment.