mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Use mV and mA as units for electrical power measurement in Matter (#133505)
This commit is contained in:
parent
99698ef95d
commit
681863f80e
@ -222,10 +222,10 @@ DISCOVERY_SCHEMAS = [
|
|||||||
platform=Platform.SENSOR,
|
platform=Platform.SENSOR,
|
||||||
entity_description=MatterSensorEntityDescription(
|
entity_description=MatterSensorEntityDescription(
|
||||||
key="PowerSourceBatVoltage",
|
key="PowerSourceBatVoltage",
|
||||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
|
||||||
|
suggested_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
measurement_to_ha=lambda x: x / 1000,
|
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
entity_class=MatterSensor,
|
entity_class=MatterSensor,
|
||||||
@ -596,10 +596,10 @@ DISCOVERY_SCHEMAS = [
|
|||||||
key="ElectricalPowerMeasurementVoltage",
|
key="ElectricalPowerMeasurementVoltage",
|
||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
|
||||||
|
suggested_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||||
suggested_display_precision=0,
|
suggested_display_precision=0,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
measurement_to_ha=lambda x: x / 1000,
|
|
||||||
),
|
),
|
||||||
entity_class=MatterSensor,
|
entity_class=MatterSensor,
|
||||||
required_attributes=(clusters.ElectricalPowerMeasurement.Attributes.Voltage,),
|
required_attributes=(clusters.ElectricalPowerMeasurement.Attributes.Voltage,),
|
||||||
@ -610,10 +610,10 @@ DISCOVERY_SCHEMAS = [
|
|||||||
key="ElectricalPowerMeasurementActiveCurrent",
|
key="ElectricalPowerMeasurementActiveCurrent",
|
||||||
device_class=SensorDeviceClass.CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
native_unit_of_measurement=UnitOfElectricCurrent.MILLIAMPERE,
|
||||||
|
suggested_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
suggested_display_precision=2,
|
suggested_display_precision=2,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
measurement_to_ha=lambda x: x / 1000,
|
|
||||||
),
|
),
|
||||||
entity_class=MatterSensor,
|
entity_class=MatterSensor,
|
||||||
required_attributes=(
|
required_attributes=(
|
||||||
|
@ -1357,6 +1357,9 @@
|
|||||||
}),
|
}),
|
||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -1627,6 +1630,9 @@
|
|||||||
'sensor': dict({
|
'sensor': dict({
|
||||||
'suggested_display_precision': 2,
|
'suggested_display_precision': 2,
|
||||||
}),
|
}),
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.CURRENT: 'current'>,
|
'original_device_class': <SensorDeviceClass.CURRENT: 'current'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -1792,6 +1798,9 @@
|
|||||||
'sensor': dict({
|
'sensor': dict({
|
||||||
'suggested_display_precision': 0,
|
'suggested_display_precision': 0,
|
||||||
}),
|
}),
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -1987,6 +1996,9 @@
|
|||||||
}),
|
}),
|
||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -2012,7 +2024,7 @@
|
|||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_reported': <ANY>,
|
'last_reported': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': '3.05',
|
'state': '3.050',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_sensors[eve_weather_sensor][sensor.eve_weather_battery-entry]
|
# name: test_sensors[eve_weather_sensor][sensor.eve_weather_battery-entry]
|
||||||
@ -2291,6 +2303,9 @@
|
|||||||
}),
|
}),
|
||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -2659,6 +2674,9 @@
|
|||||||
'sensor': dict({
|
'sensor': dict({
|
||||||
'suggested_display_precision': 2,
|
'suggested_display_precision': 2,
|
||||||
}),
|
}),
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.CURRENT: 'current'>,
|
'original_device_class': <SensorDeviceClass.CURRENT: 'current'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -2886,6 +2904,9 @@
|
|||||||
'sensor': dict({
|
'sensor': dict({
|
||||||
'suggested_display_precision': 0,
|
'suggested_display_precision': 0,
|
||||||
}),
|
}),
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -3034,6 +3055,9 @@
|
|||||||
}),
|
}),
|
||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
@ -3059,7 +3083,7 @@
|
|||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_reported': <ANY>,
|
'last_reported': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': '0.0',
|
'state': '0.000',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_sensors[temperature_sensor][sensor.mock_temperature_sensor_temperature-entry]
|
# name: test_sensors[temperature_sensor][sensor.mock_temperature_sensor_temperature-entry]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user