Skip to content

Commit e889541

Browse files
authored
Correct state/device class for water in gardena (#168637)
1 parent 85e9d3c commit e889541

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

homeassistant/components/gardena_bluetooth/sensor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,15 @@ def context(self) -> set[str]:
133133
key=FlowStatistics.overall.unique_id,
134134
translation_key="flow_statistics_overall",
135135
state_class=SensorStateClass.TOTAL_INCREASING,
136-
device_class=SensorDeviceClass.VOLUME,
136+
device_class=SensorDeviceClass.WATER,
137137
entity_category=EntityCategory.DIAGNOSTIC,
138138
native_unit_of_measurement=UnitOfVolume.LITERS,
139139
char=FlowStatistics.overall,
140140
),
141141
GardenaBluetoothSensorEntityDescription(
142142
key=FlowStatistics.current.unique_id,
143143
translation_key="flow_statistics_current",
144+
state_class=SensorStateClass.MEASUREMENT,
144145
device_class=SensorDeviceClass.VOLUME_FLOW_RATE,
145146
entity_category=EntityCategory.DIAGNOSTIC,
146147
native_unit_of_measurement=UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
@@ -150,7 +151,7 @@ def context(self) -> set[str]:
150151
key=FlowStatistics.resettable.unique_id,
151152
translation_key="flow_statistics_resettable",
152153
state_class=SensorStateClass.TOTAL_INCREASING,
153-
device_class=SensorDeviceClass.VOLUME,
154+
device_class=SensorDeviceClass.WATER,
154155
entity_category=EntityCategory.DIAGNOSTIC,
155156
native_unit_of_measurement=UnitOfVolume.LITERS,
156157
char=FlowStatistics.resettable,
@@ -166,6 +167,7 @@ def context(self) -> set[str]:
166167
GardenaBluetoothSensorEntityDescription(
167168
key=Spray.current_distance.unique_id,
168169
translation_key="spray_current_distance",
170+
state_class=SensorStateClass.MEASUREMENT,
169171
entity_category=EntityCategory.DIAGNOSTIC,
170172
native_unit_of_measurement=PERCENTAGE,
171173
char=Spray.current_distance,

tests/components/gardena_bluetooth/snapshots/test_sensor.ambr

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@
9292
None,
9393
]),
9494
'area_id': None,
95-
'capabilities': None,
95+
'capabilities': dict({
96+
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
97+
}),
9698
'config_entry_id': <ANY>,
9799
'config_subentry_id': <ANY>,
98100
'device_class': None,
@@ -127,6 +129,7 @@
127129
StateSnapshot({
128130
'attributes': ReadOnlyDict({
129131
'friendly_name': 'Mock Title Current distance',
132+
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
130133
'unit_of_measurement': '%',
131134
}),
132135
'context': <ANY>,
@@ -143,7 +146,9 @@
143146
None,
144147
]),
145148
'area_id': None,
146-
'capabilities': None,
149+
'capabilities': dict({
150+
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
151+
}),
147152
'config_entry_id': <ANY>,
148153
'config_subentry_id': <ANY>,
149154
'device_class': None,
@@ -182,6 +187,7 @@
182187
'attributes': ReadOnlyDict({
183188
'device_class': 'volume_flow_rate',
184189
'friendly_name': 'Mock Title Current flow',
190+
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
185191
'unit_of_measurement': <UnitOfVolumeFlowRate.LITERS_PER_MINUTE: 'L/min'>,
186192
}),
187193
'context': <ANY>,
@@ -399,7 +405,7 @@
399405
'suggested_display_precision': 2,
400406
}),
401407
}),
402-
'original_device_class': <SensorDeviceClass.VOLUME: 'volume'>,
408+
'original_device_class': <SensorDeviceClass.WATER: 'water'>,
403409
'original_icon': None,
404410
'original_name': 'Overall flow',
405411
'platform': 'gardena_bluetooth',
@@ -414,7 +420,7 @@
414420
# name: test_sensors[aqua_contour][sensor.mock_title_overall_flow-state]
415421
StateSnapshot({
416422
'attributes': ReadOnlyDict({
417-
'device_class': 'volume',
423+
'device_class': 'water',
418424
'friendly_name': 'Mock Title Overall flow',
419425
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
420426
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,

0 commit comments

Comments
 (0)