mirror of
https://github.com/home-assistant/core.git
synced 2026-12-03 12:21:04 -04:00
Vesync Typing Improvements (#195093)
This commit is contained in:
@@ -101,7 +101,7 @@ def _setup_entities(
|
||||
)
|
||||
|
||||
|
||||
class VeSyncBinarySensor(BinarySensorEntity, VeSyncBaseEntity):
|
||||
class VeSyncBinarySensor(BinarySensorEntity, VeSyncBaseEntity[VeSyncBaseDevice]):
|
||||
"""Vesync binary sensor class."""
|
||||
|
||||
entity_description: VeSyncBinarySensorEntityDescription
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user