diff --git a/homeassistant/components/streamlabswater/coordinator.py b/homeassistant/components/streamlabswater/coordinator.py index dc57ae78810..bcb2e7790d4 100644 --- a/homeassistant/components/streamlabswater/coordinator.py +++ b/homeassistant/components/streamlabswater/coordinator.py @@ -50,8 +50,8 @@ class StreamlabsCoordinator(DataUpdateCoordinator[dict[str, StreamlabsData]]): res[location_id] = StreamlabsData( is_away=location["homeAway"] == "away", name=location["name"], - daily_usage=round(water_usage["today"], 1), - monthly_usage=round(water_usage["thisMonth"], 1), - yearly_usage=round(water_usage["thisYear"], 1), + daily_usage=water_usage["today"], + monthly_usage=water_usage["thisMonth"], + yearly_usage=water_usage["thisYear"], ) return res diff --git a/homeassistant/components/streamlabswater/sensor.py b/homeassistant/components/streamlabswater/sensor.py index e49668208af..9faf3defa89 100644 --- a/homeassistant/components/streamlabswater/sensor.py +++ b/homeassistant/components/streamlabswater/sensor.py @@ -35,6 +35,7 @@ SENSORS: tuple[StreamlabsWaterSensorEntityDescription, ...] = ( translation_key="daily_usage", native_unit_of_measurement=UnitOfVolume.GALLONS, device_class=SensorDeviceClass.WATER, + suggested_display_precision=1, value_fn=lambda data: data.daily_usage, ), StreamlabsWaterSensorEntityDescription( @@ -42,6 +43,7 @@ SENSORS: tuple[StreamlabsWaterSensorEntityDescription, ...] = ( translation_key="monthly_usage", native_unit_of_measurement=UnitOfVolume.GALLONS, device_class=SensorDeviceClass.WATER, + suggested_display_precision=1, value_fn=lambda data: data.monthly_usage, ), StreamlabsWaterSensorEntityDescription( @@ -49,6 +51,7 @@ SENSORS: tuple[StreamlabsWaterSensorEntityDescription, ...] = ( translation_key="yearly_usage", native_unit_of_measurement=UnitOfVolume.GALLONS, device_class=SensorDeviceClass.WATER, + suggested_display_precision=1, value_fn=lambda data: data.yearly_usage, ), ) diff --git a/tests/components/streamlabswater/snapshots/test_sensor.ambr b/tests/components/streamlabswater/snapshots/test_sensor.ambr index 5cd2479903a..9d8ca3a99e6 100644 --- a/tests/components/streamlabswater/snapshots/test_sensor.ambr +++ b/tests/components/streamlabswater/snapshots/test_sensor.ambr @@ -18,6 +18,9 @@ 'id': , 'name': None, 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), }), 'original_device_class': , 'original_icon': None, @@ -41,7 +44,7 @@ 'entity_id': 'sensor.water_monitor_daily_usage', 'last_changed': , 'last_updated': , - 'state': '200.4', + 'state': '200.44691536', }) # --- # name: test_all_entities[sensor.water_monitor_monthly_usage-entry] @@ -63,6 +66,9 @@ 'id': , 'name': None, 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), }), 'original_device_class': , 'original_icon': None, @@ -86,7 +92,7 @@ 'entity_id': 'sensor.water_monitor_monthly_usage', 'last_changed': , 'last_updated': , - 'state': '420.5', + 'state': '420.514099294', }) # --- # name: test_all_entities[sensor.water_monitor_yearly_usage-entry] @@ -108,6 +114,9 @@ 'id': , 'name': None, 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), }), 'original_device_class': , 'original_icon': None, @@ -131,6 +140,6 @@ 'entity_id': 'sensor.water_monitor_yearly_usage', 'last_changed': , 'last_updated': , - 'state': '65432.4', + 'state': '65432.389256934', }) # ---