Add Matter BatVoltage attribute from PowerSource cluster (#125503)

* Add BatVoltage Attribute from PowerSource Cluster

* Update sensor.py

Remove comment

* Update homeassistant/components/matter/sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Ludovic BOUÉ 2024-09-09 14:50:01 +02:00 committed by GitHub
parent d7caaceb64
commit 8fff0075ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -163,6 +163,19 @@ DISCOVERY_SCHEMAS = [
entity_class=MatterSensor,
required_attributes=(clusters.PowerSource.Attributes.BatPercentRemaining,),
),
MatterDiscoverySchema(
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="PowerSourceBatVoltage",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
measurement_to_ha=lambda x: x / 1000,
state_class=SensorStateClass.MEASUREMENT,
),
entity_class=MatterSensor,
required_attributes=(clusters.PowerSource.Attributes.BatVoltage,),
),
MatterDiscoverySchema(
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(