mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Remove precision in streamlabs water (#107096)
This commit is contained in:
parent
11170c6345
commit
eee6693855
@ -50,8 +50,8 @@ class StreamlabsCoordinator(DataUpdateCoordinator[dict[str, StreamlabsData]]):
|
|||||||
res[location_id] = StreamlabsData(
|
res[location_id] = StreamlabsData(
|
||||||
is_away=location["homeAway"] == "away",
|
is_away=location["homeAway"] == "away",
|
||||||
name=location["name"],
|
name=location["name"],
|
||||||
daily_usage=round(water_usage["today"], 1),
|
daily_usage=water_usage["today"],
|
||||||
monthly_usage=round(water_usage["thisMonth"], 1),
|
monthly_usage=water_usage["thisMonth"],
|
||||||
yearly_usage=round(water_usage["thisYear"], 1),
|
yearly_usage=water_usage["thisYear"],
|
||||||
)
|
)
|
||||||
return res
|
return res
|
||||||
|
@ -35,6 +35,7 @@ SENSORS: tuple[StreamlabsWaterSensorEntityDescription, ...] = (
|
|||||||
translation_key="daily_usage",
|
translation_key="daily_usage",
|
||||||
native_unit_of_measurement=UnitOfVolume.GALLONS,
|
native_unit_of_measurement=UnitOfVolume.GALLONS,
|
||||||
device_class=SensorDeviceClass.WATER,
|
device_class=SensorDeviceClass.WATER,
|
||||||
|
suggested_display_precision=1,
|
||||||
value_fn=lambda data: data.daily_usage,
|
value_fn=lambda data: data.daily_usage,
|
||||||
),
|
),
|
||||||
StreamlabsWaterSensorEntityDescription(
|
StreamlabsWaterSensorEntityDescription(
|
||||||
@ -42,6 +43,7 @@ SENSORS: tuple[StreamlabsWaterSensorEntityDescription, ...] = (
|
|||||||
translation_key="monthly_usage",
|
translation_key="monthly_usage",
|
||||||
native_unit_of_measurement=UnitOfVolume.GALLONS,
|
native_unit_of_measurement=UnitOfVolume.GALLONS,
|
||||||
device_class=SensorDeviceClass.WATER,
|
device_class=SensorDeviceClass.WATER,
|
||||||
|
suggested_display_precision=1,
|
||||||
value_fn=lambda data: data.monthly_usage,
|
value_fn=lambda data: data.monthly_usage,
|
||||||
),
|
),
|
||||||
StreamlabsWaterSensorEntityDescription(
|
StreamlabsWaterSensorEntityDescription(
|
||||||
@ -49,6 +51,7 @@ SENSORS: tuple[StreamlabsWaterSensorEntityDescription, ...] = (
|
|||||||
translation_key="yearly_usage",
|
translation_key="yearly_usage",
|
||||||
native_unit_of_measurement=UnitOfVolume.GALLONS,
|
native_unit_of_measurement=UnitOfVolume.GALLONS,
|
||||||
device_class=SensorDeviceClass.WATER,
|
device_class=SensorDeviceClass.WATER,
|
||||||
|
suggested_display_precision=1,
|
||||||
value_fn=lambda data: data.yearly_usage,
|
value_fn=lambda data: data.yearly_usage,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
'id': <ANY>,
|
'id': <ANY>,
|
||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
|
'sensor': dict({
|
||||||
|
'suggested_display_precision': 1,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.WATER: 'water'>,
|
'original_device_class': <SensorDeviceClass.WATER: 'water'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -41,7 +44,7 @@
|
|||||||
'entity_id': 'sensor.water_monitor_daily_usage',
|
'entity_id': 'sensor.water_monitor_daily_usage',
|
||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': '200.4',
|
'state': '200.44691536',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_all_entities[sensor.water_monitor_monthly_usage-entry]
|
# name: test_all_entities[sensor.water_monitor_monthly_usage-entry]
|
||||||
@ -63,6 +66,9 @@
|
|||||||
'id': <ANY>,
|
'id': <ANY>,
|
||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
|
'sensor': dict({
|
||||||
|
'suggested_display_precision': 1,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.WATER: 'water'>,
|
'original_device_class': <SensorDeviceClass.WATER: 'water'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -86,7 +92,7 @@
|
|||||||
'entity_id': 'sensor.water_monitor_monthly_usage',
|
'entity_id': 'sensor.water_monitor_monthly_usage',
|
||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': '420.5',
|
'state': '420.514099294',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_all_entities[sensor.water_monitor_yearly_usage-entry]
|
# name: test_all_entities[sensor.water_monitor_yearly_usage-entry]
|
||||||
@ -108,6 +114,9 @@
|
|||||||
'id': <ANY>,
|
'id': <ANY>,
|
||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
|
'sensor': dict({
|
||||||
|
'suggested_display_precision': 1,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.WATER: 'water'>,
|
'original_device_class': <SensorDeviceClass.WATER: 'water'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -131,6 +140,6 @@
|
|||||||
'entity_id': 'sensor.water_monitor_yearly_usage',
|
'entity_id': 'sensor.water_monitor_yearly_usage',
|
||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': '65432.4',
|
'state': '65432.389256934',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
Loading…
x
Reference in New Issue
Block a user