Vesync Typing Improvements (#195093)

This commit is contained in:
cdnninja
2026-11-28 13:31:19 +01:00
committed by GitHub
parent 68475ac0d1
commit 4520eb857d
4 changed files with 7 additions and 5 deletions
@@ -101,7 +101,7 @@ def _setup_entities(
)
class VeSyncBinarySensor(BinarySensorEntity, VeSyncBaseEntity):
class VeSyncBinarySensor(BinarySensorEntity, VeSyncBaseEntity[VeSyncBaseDevice]):
"""Vesync binary sensor class."""
entity_description: VeSyncBinarySensorEntityDescription
+1 -1
View File
@@ -200,7 +200,7 @@ def _setup_entities(
)
class VeSyncSelectEntity(VeSyncBaseEntity, SelectEntity):
class VeSyncSelectEntity(VeSyncBaseEntity[VeSyncBaseDevice], SelectEntity):
"""A class to set numeric options on Vesync device."""
entity_description: VeSyncSelectEntityDescription
+4 -2
View File
@@ -377,7 +377,7 @@ def _setup_entities(
async_add_entities(entities, update_before_add=True)
class VeSyncSensorEntity(VeSyncBaseEntity, SensorEntity):
class VeSyncSensorEntity(VeSyncBaseEntity[VeSyncBaseDevice], SensorEntity):
"""Representation of a sensor describing a VeSync device."""
entity_description: VeSyncSensorEntityDescription
@@ -437,7 +437,9 @@ class VeSyncSensorEntity(VeSyncBaseEntity, SensorEntity):
@override
def native_unit_of_measurement(self) -> str | None:
"""Return the unit the value was reported in by the sensor."""
if self.entity_description.use_device_temperature_unit:
if self.entity_description.use_device_temperature_unit and is_air_fryer(
self.device
):
if self.device.temp_unit == TemperatureUnits.CELSIUS:
return UnitOfTemperature.CELSIUS
if self.device.temp_unit == TemperatureUnits.FAHRENHEIT:
+1 -1
View File
@@ -56,7 +56,7 @@ def _setup_entities(
)
class VeSyncDeviceUpdate(VeSyncBaseEntity, UpdateEntity):
class VeSyncDeviceUpdate(VeSyncBaseEntity[VeSyncBaseDevice], UpdateEntity):
"""Representation of a VeSync device update entity."""
_attr_device_class = UpdateDeviceClass.FIRMWARE