Gogogate2 Battery Sensor Should Use % Unit For Compatibility (#59434)
This commit is contained in:
parent
ab1e14204f
commit
20f0a6730b
2 changed files with 4 additions and 0 deletions
|
@ -11,6 +11,7 @@ from homeassistant.const import (
|
|||
DEVICE_CLASS_BATTERY,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
PERCENTAGE,
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -78,6 +79,7 @@ class DoorSensorBattery(DoorSensorEntity):
|
|||
super().__init__(config_entry, data_update_coordinator, door, unique_id)
|
||||
self._attr_device_class = DEVICE_CLASS_BATTERY
|
||||
self._attr_state_class = STATE_CLASS_MEASUREMENT
|
||||
self._attr_native_unit_of_measurement = PERCENTAGE
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
|
|
@ -172,6 +172,7 @@ async def test_sensor_update(gogogate2api_mock, hass: HomeAssistant) -> None:
|
|||
"friendly_name": "Door1 battery",
|
||||
"sensor_id": "ABCD",
|
||||
"state_class": "measurement",
|
||||
"unit_of_measurement": "%",
|
||||
}
|
||||
temp_attributes = {
|
||||
"device_class": "temperature",
|
||||
|
@ -248,6 +249,7 @@ async def test_availability(ismartgateapi_mock, hass: HomeAssistant) -> None:
|
|||
"friendly_name": "Door1 battery",
|
||||
"sensor_id": "ABCD",
|
||||
"state_class": "measurement",
|
||||
"unit_of_measurement": "%",
|
||||
}
|
||||
temp_attributes = {
|
||||
"device_class": "temperature",
|
||||
|
|
Loading…
Add table
Reference in a new issue