Skip to content

Commit b4c4fde

Browse files
karwostsbramkragten
authored andcommitted
Fix Ambient Weather incorrect state classes (home-assistant#155751)
1 parent 965dd7c commit b4c4fde

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

homeassistant/components/ambient_network/sensor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
translation_key="daily_rain",
107107
native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
108108
device_class=SensorDeviceClass.PRECIPITATION,
109-
state_class=SensorStateClass.TOTAL,
109+
state_class=SensorStateClass.TOTAL_INCREASING,
110110
suggested_display_precision=2,
111111
),
112112
SensorEntityDescription(
@@ -150,7 +150,7 @@
150150
key=TYPE_LIGHTNING_PER_DAY,
151151
translation_key="lightning_strikes_per_day",
152152
native_unit_of_measurement="strikes",
153-
state_class=SensorStateClass.TOTAL,
153+
state_class=SensorStateClass.TOTAL_INCREASING,
154154
entity_registry_enabled_default=False,
155155
),
156156
SensorEntityDescription(
@@ -182,7 +182,7 @@
182182
translation_key="monthly_rain",
183183
native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
184184
device_class=SensorDeviceClass.PRECIPITATION,
185-
state_class=SensorStateClass.TOTAL,
185+
state_class=SensorStateClass.TOTAL_INCREASING,
186186
suggested_display_precision=2,
187187
entity_registry_enabled_default=False,
188188
),
@@ -229,7 +229,7 @@
229229
translation_key="weekly_rain",
230230
native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
231231
device_class=SensorDeviceClass.PRECIPITATION,
232-
state_class=SensorStateClass.TOTAL,
232+
state_class=SensorStateClass.TOTAL_INCREASING,
233233
suggested_display_precision=2,
234234
entity_registry_enabled_default=False,
235235
),
@@ -262,7 +262,7 @@
262262
translation_key="yearly_rain",
263263
native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
264264
device_class=SensorDeviceClass.PRECIPITATION,
265-
state_class=SensorStateClass.TOTAL,
265+
state_class=SensorStateClass.TOTAL_INCREASING,
266266
suggested_display_precision=2,
267267
entity_registry_enabled_default=False,
268268
),

tests/components/ambient_network/snapshots/test_sensor.ambr

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
}),
6767
'area_id': None,
6868
'capabilities': dict({
69-
'state_class': <SensorStateClass.TOTAL: 'total'>,
69+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
7070
}),
7171
'config_entry_id': <ANY>,
7272
'config_subentry_id': <ANY>,
@@ -110,7 +110,7 @@
110110
'device_class': 'precipitation',
111111
'friendly_name': 'Station A Daily rain',
112112
'last_measured': HAFakeDatetime(2023, 11, 8, 12, 12, 0, 914000, tzinfo=zoneinfo.ZoneInfo(key='US/Pacific')),
113-
'state_class': <SensorStateClass.TOTAL: 'total'>,
113+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
114114
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
115115
}),
116116
'context': <ANY>,
@@ -532,7 +532,7 @@
532532
}),
533533
'area_id': None,
534534
'capabilities': dict({
535-
'state_class': <SensorStateClass.TOTAL: 'total'>,
535+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
536536
}),
537537
'config_entry_id': <ANY>,
538538
'config_subentry_id': <ANY>,
@@ -576,7 +576,7 @@
576576
'device_class': 'precipitation',
577577
'friendly_name': 'Station A Monthly rain',
578578
'last_measured': HAFakeDatetime(2023, 11, 8, 12, 12, 0, 914000, tzinfo=zoneinfo.ZoneInfo(key='US/Pacific')),
579-
'state_class': <SensorStateClass.TOTAL: 'total'>,
579+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
580580
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
581581
}),
582582
'context': <ANY>,
@@ -769,7 +769,7 @@
769769
}),
770770
'area_id': None,
771771
'capabilities': dict({
772-
'state_class': <SensorStateClass.TOTAL: 'total'>,
772+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
773773
}),
774774
'config_entry_id': <ANY>,
775775
'config_subentry_id': <ANY>,
@@ -813,7 +813,7 @@
813813
'device_class': 'precipitation',
814814
'friendly_name': 'Station A Weekly rain',
815815
'last_measured': HAFakeDatetime(2023, 11, 8, 12, 12, 0, 914000, tzinfo=zoneinfo.ZoneInfo(key='US/Pacific')),
816-
'state_class': <SensorStateClass.TOTAL: 'total'>,
816+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
817817
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
818818
}),
819819
'context': <ANY>,
@@ -1071,7 +1071,7 @@
10711071
}),
10721072
'area_id': None,
10731073
'capabilities': dict({
1074-
'state_class': <SensorStateClass.TOTAL: 'total'>,
1074+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
10751075
}),
10761076
'config_entry_id': <ANY>,
10771077
'config_subentry_id': <ANY>,
@@ -1115,7 +1115,7 @@
11151115
'device_class': 'precipitation',
11161116
'friendly_name': 'Station C Daily rain',
11171117
'last_measured': HAFakeDatetime(2024, 6, 6, 8, 28, 3, tzinfo=zoneinfo.ZoneInfo(key='US/Pacific')),
1118-
'state_class': <SensorStateClass.TOTAL: 'total'>,
1118+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
11191119
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
11201120
}),
11211121
'context': <ANY>,
@@ -1537,7 +1537,7 @@
15371537
}),
15381538
'area_id': None,
15391539
'capabilities': dict({
1540-
'state_class': <SensorStateClass.TOTAL: 'total'>,
1540+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
15411541
}),
15421542
'config_entry_id': <ANY>,
15431543
'config_subentry_id': <ANY>,
@@ -1581,7 +1581,7 @@
15811581
'device_class': 'precipitation',
15821582
'friendly_name': 'Station C Monthly rain',
15831583
'last_measured': HAFakeDatetime(2024, 6, 6, 8, 28, 3, tzinfo=zoneinfo.ZoneInfo(key='US/Pacific')),
1584-
'state_class': <SensorStateClass.TOTAL: 'total'>,
1584+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
15851585
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
15861586
}),
15871587
'context': <ANY>,
@@ -1774,7 +1774,7 @@
17741774
}),
17751775
'area_id': None,
17761776
'capabilities': dict({
1777-
'state_class': <SensorStateClass.TOTAL: 'total'>,
1777+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
17781778
}),
17791779
'config_entry_id': <ANY>,
17801780
'config_subentry_id': <ANY>,
@@ -1818,7 +1818,7 @@
18181818
'device_class': 'precipitation',
18191819
'friendly_name': 'Station C Weekly rain',
18201820
'last_measured': HAFakeDatetime(2024, 6, 6, 8, 28, 3, tzinfo=zoneinfo.ZoneInfo(key='US/Pacific')),
1821-
'state_class': <SensorStateClass.TOTAL: 'total'>,
1821+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
18221822
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
18231823
}),
18241824
'context': <ANY>,
@@ -2075,7 +2075,7 @@
20752075
}),
20762076
'area_id': None,
20772077
'capabilities': dict({
2078-
'state_class': <SensorStateClass.TOTAL: 'total'>,
2078+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
20792079
}),
20802080
'config_entry_id': <ANY>,
20812081
'config_subentry_id': <ANY>,
@@ -2118,7 +2118,7 @@
21182118
'attribution': 'Data provided by ambientnetwork.net',
21192119
'device_class': 'precipitation',
21202120
'friendly_name': 'Station D Daily rain',
2121-
'state_class': <SensorStateClass.TOTAL: 'total'>,
2121+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
21222122
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
21232123
}),
21242124
'context': <ANY>,
@@ -2483,7 +2483,7 @@
24832483
}),
24842484
'area_id': None,
24852485
'capabilities': dict({
2486-
'state_class': <SensorStateClass.TOTAL: 'total'>,
2486+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
24872487
}),
24882488
'config_entry_id': <ANY>,
24892489
'config_subentry_id': <ANY>,
@@ -2526,7 +2526,7 @@
25262526
'attribution': 'Data provided by ambientnetwork.net',
25272527
'device_class': 'precipitation',
25282528
'friendly_name': 'Station D Monthly rain',
2529-
'state_class': <SensorStateClass.TOTAL: 'total'>,
2529+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
25302530
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
25312531
}),
25322532
'context': <ANY>,
@@ -2716,7 +2716,7 @@
27162716
}),
27172717
'area_id': None,
27182718
'capabilities': dict({
2719-
'state_class': <SensorStateClass.TOTAL: 'total'>,
2719+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
27202720
}),
27212721
'config_entry_id': <ANY>,
27222722
'config_subentry_id': <ANY>,
@@ -2759,7 +2759,7 @@
27592759
'attribution': 'Data provided by ambientnetwork.net',
27602760
'device_class': 'precipitation',
27612761
'friendly_name': 'Station D Weekly rain',
2762-
'state_class': <SensorStateClass.TOTAL: 'total'>,
2762+
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
27632763
'unit_of_measurement': <UnitOfLength.MILLIMETERS: 'mm'>,
27642764
}),
27652765
'context': <ANY>,

0 commit comments

Comments
 (0)