mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add unit and device class to ZHA RSSI sensor (#85390)
* Add unit device class to ZHA RSSI sensor * Remove unit and device class for LQI * mypy * isort * mypy2 * Update sensor.py
This commit is contained in:
parent
b03677db1c
commit
29e3d06a42
@ -21,6 +21,7 @@ from homeassistant.const import (
|
|||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
|
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
Platform,
|
Platform,
|
||||||
UnitOfApparentPower,
|
UnitOfApparentPower,
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
@ -834,6 +835,8 @@ class RSSISensor(Sensor, id_suffix="rssi"):
|
|||||||
"""RSSI sensor for a device."""
|
"""RSSI sensor for a device."""
|
||||||
|
|
||||||
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT
|
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT
|
||||||
|
_attr_device_class: SensorDeviceClass | None = SensorDeviceClass.SIGNAL_STRENGTH
|
||||||
|
_attr_native_unit_of_measurement: str | None = SIGNAL_STRENGTH_DECIBELS_MILLIWATT
|
||||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||||
_attr_entity_registry_enabled_default = False
|
_attr_entity_registry_enabled_default = False
|
||||||
_attr_should_poll = True # BaseZhaEntity defaults to False
|
_attr_should_poll = True # BaseZhaEntity defaults to False
|
||||||
@ -868,6 +871,8 @@ class LQISensor(RSSISensor, id_suffix="lqi"):
|
|||||||
"""LQI sensor for a device."""
|
"""LQI sensor for a device."""
|
||||||
|
|
||||||
_attr_name: str = "LQI"
|
_attr_name: str = "LQI"
|
||||||
|
_attr_device_class = None
|
||||||
|
_attr_native_unit_of_measurement = None
|
||||||
|
|
||||||
|
|
||||||
@MULTI_MATCH(
|
@MULTI_MATCH(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user