mirror of
https://github.com/home-assistant/core.git
synced 2026-10-07 14:58:11 -04:00
Set WeatherFlow display precision from sensor resolution (#183106)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
aa7ea20b93
commit
c49527202a
@@ -78,7 +78,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
translation_key="air_density",
|
||||
native_unit_of_measurement="kg/m³",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=5,
|
||||
suggested_display_precision=3,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.magnitude,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
@@ -123,6 +123,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
device_class=SensorDeviceClass.VOLTAGE,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=3,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.magnitude,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
@@ -131,6 +132,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
device_class=SensorDeviceClass.BATTERY,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=0,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.magnitude,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
@@ -146,7 +148,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
device_class=SensorDeviceClass.DISTANCE,
|
||||
native_unit_of_measurement=UnitOfLength.KILOMETERS,
|
||||
translation_key="lightning_average_distance",
|
||||
suggested_display_precision=2,
|
||||
suggested_display_precision=0,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.magnitude,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
@@ -162,7 +164,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.DISTANCE,
|
||||
native_unit_of_measurement=UnitOfLength.KILOMETERS,
|
||||
suggested_display_precision=2,
|
||||
suggested_display_precision=0,
|
||||
event_subscriptions=[EVENT_STRIKE],
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.distance.magnitude,
|
||||
),
|
||||
@@ -194,6 +196,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
state_class=SensorStateClass.TOTAL,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
suggested_display_precision=2,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.magnitude,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
@@ -201,6 +204,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.PRECIPITATION_INTENSITY,
|
||||
native_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
|
||||
suggested_display_precision=1,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.magnitude,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
@@ -208,6 +212,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
device_class=SensorDeviceClass.HUMIDITY,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=0,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.magnitude,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
@@ -226,7 +231,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=UnitOfPressure.MBAR,
|
||||
device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=5,
|
||||
suggested_display_precision=1,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data.magnitude,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
@@ -250,6 +255,7 @@ SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
|
||||
translation_key="uv_index",
|
||||
native_unit_of_measurement=UV_INDEX,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=1,
|
||||
raw_data_conv_fn=lambda raw_data: raw_data,
|
||||
),
|
||||
WeatherFlowSensorEntityDescription(
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
'object_id_base': 'Air density',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 5,
|
||||
'suggested_display_precision': 3,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': None,
|
||||
@@ -83,7 +83,7 @@
|
||||
'object_id_base': 'Air pressure',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 5,
|
||||
'suggested_display_precision': 1,
|
||||
}),
|
||||
'sensor.private': dict({
|
||||
'suggested_unit_of_measurement': <UnitOfPressure.HPA: 'hPa'>,
|
||||
@@ -143,6 +143,9 @@
|
||||
'name': None,
|
||||
'object_id_base': 'Battery',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 0,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
@@ -199,7 +202,7 @@
|
||||
'object_id_base': 'Battery voltage',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 0,
|
||||
'suggested_display_precision': 3,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
||||
@@ -372,6 +375,9 @@
|
||||
'name': None,
|
||||
'object_id_base': 'Humidity',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 0,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.HUMIDITY: 'humidity'>,
|
||||
'original_icon': None,
|
||||
@@ -541,7 +547,7 @@
|
||||
'object_id_base': 'Lightning average distance',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
'suggested_display_precision': 0,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.DISTANCE: 'distance'>,
|
||||
@@ -653,7 +659,7 @@
|
||||
'object_id_base': 'Lightning last distance',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
'suggested_display_precision': 0,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.DISTANCE: 'distance'>,
|
||||
@@ -815,7 +821,7 @@
|
||||
'object_id_base': 'Precipitation',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 0,
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.PRECIPITATION: 'precipitation'>,
|
||||
@@ -874,7 +880,7 @@
|
||||
'object_id_base': 'Precipitation intensity',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 0,
|
||||
'suggested_display_precision': 1,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.PRECIPITATION_INTENSITY: 'precipitation_intensity'>,
|
||||
@@ -1161,6 +1167,9 @@
|
||||
'name': None,
|
||||
'object_id_base': 'UV index',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 1,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
|
||||
Reference in New Issue
Block a user