Set suggested display precision for HomeWizard Energy power sensors (#103369)

This commit is contained in:
Franck Nijhof 2023-11-04 15:40:50 +01:00 committed by GitHub
parent c561372f30
commit 07f03d9ec9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View file

@ -208,6 +208,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
native_unit_of_measurement=UnitOfPower.WATT, native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
has_fn=lambda data: data.active_power_w is not None, has_fn=lambda data: data.active_power_w is not None,
value_fn=lambda data: data.active_power_w, value_fn=lambda data: data.active_power_w,
), ),
@ -217,6 +218,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
native_unit_of_measurement=UnitOfPower.WATT, native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
has_fn=lambda data: data.active_power_l1_w is not None, has_fn=lambda data: data.active_power_l1_w is not None,
value_fn=lambda data: data.active_power_l1_w, value_fn=lambda data: data.active_power_l1_w,
), ),
@ -226,6 +228,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
native_unit_of_measurement=UnitOfPower.WATT, native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
has_fn=lambda data: data.active_power_l2_w is not None, has_fn=lambda data: data.active_power_l2_w is not None,
value_fn=lambda data: data.active_power_l2_w, value_fn=lambda data: data.active_power_l2_w,
), ),
@ -235,6 +238,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
native_unit_of_measurement=UnitOfPower.WATT, native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
has_fn=lambda data: data.active_power_l3_w is not None, has_fn=lambda data: data.active_power_l3_w is not None,
value_fn=lambda data: data.active_power_l3_w, value_fn=lambda data: data.active_power_l3_w,
), ),

View file

@ -449,6 +449,9 @@
'id': <ANY>, 'id': <ANY>,
'name': None, 'name': None,
'options': dict({ 'options': dict({
'sensor': dict({
'suggested_display_precision': 0,
}),
}), }),
'original_device_class': <SensorDeviceClass.POWER: 'power'>, 'original_device_class': <SensorDeviceClass.POWER: 'power'>,
'original_icon': None, 'original_icon': None,
@ -529,6 +532,9 @@
'id': <ANY>, 'id': <ANY>,
'name': None, 'name': None,
'options': dict({ 'options': dict({
'sensor': dict({
'suggested_display_precision': 0,
}),
}), }),
'original_device_class': <SensorDeviceClass.POWER: 'power'>, 'original_device_class': <SensorDeviceClass.POWER: 'power'>,
'original_icon': None, 'original_icon': None,
@ -609,6 +615,9 @@
'id': <ANY>, 'id': <ANY>,
'name': None, 'name': None,
'options': dict({ 'options': dict({
'sensor': dict({
'suggested_display_precision': 0,
}),
}), }),
'original_device_class': <SensorDeviceClass.POWER: 'power'>, 'original_device_class': <SensorDeviceClass.POWER: 'power'>,
'original_icon': None, 'original_icon': None,
@ -689,6 +698,9 @@
'id': <ANY>, 'id': <ANY>,
'name': None, 'name': None,
'options': dict({ 'options': dict({
'sensor': dict({
'suggested_display_precision': 0,
}),
}), }),
'original_device_class': <SensorDeviceClass.POWER: 'power'>, 'original_device_class': <SensorDeviceClass.POWER: 'power'>,
'original_icon': None, 'original_icon': None,