diff --git a/homeassistant/components/smartthings/climate.py b/homeassistant/components/smartthings/climate.py index 56a5494eeaa..edc0688b5f7 100644 --- a/homeassistant/components/smartthings/climate.py +++ b/homeassistant/components/smartthings/climate.py @@ -100,7 +100,7 @@ async def async_setup_entry( ] broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id] - entities = [] + entities: list[ClimateEntity] = [] for device in broker.devices.values(): if not broker.any_assigned(device.device_id, CLIMATE_DOMAIN): continue diff --git a/homeassistant/components/smartthings/fan.py b/homeassistant/components/smartthings/fan.py index 62850d5b002..81171ecf554 100644 --- a/homeassistant/components/smartthings/fan.py +++ b/homeassistant/components/smartthings/fan.py @@ -44,12 +44,13 @@ def get_capabilities(capabilities: Sequence[str]) -> Sequence[str] | None: # Must have switch and fan_speed if all(capability in capabilities for capability in supported): return supported + return None class SmartThingsFan(SmartThingsEntity, FanEntity): """Define a SmartThings Fan.""" - async def async_set_percentage(self, percentage: int) -> None: + async def async_set_percentage(self, percentage: int | None) -> None: """Set the speed percentage of the fan.""" if percentage is None: await self._device.switch_on(set_status=True) @@ -64,9 +65,9 @@ class SmartThingsFan(SmartThingsEntity, FanEntity): async def async_turn_on( self, - speed: str = None, - percentage: int = None, - preset_mode: str = None, + speed: str | None = None, + percentage: int | None = None, + preset_mode: str | None = None, **kwargs, ) -> None: """Turn the fan on.""" diff --git a/homeassistant/components/smartthings/light.py b/homeassistant/components/smartthings/light.py index be3315594a8..794a902e941 100644 --- a/homeassistant/components/smartthings/light.py +++ b/homeassistant/components/smartthings/light.py @@ -162,7 +162,7 @@ class SmartThingsLight(SmartThingsEntity, LightEntity): async def async_set_color_temp(self, value: float): """Set the color temperature of the device.""" kelvin = color_util.color_temperature_mired_to_kelvin(value) - kelvin = max(min(kelvin, 30000.0), 1.0) + kelvin = max(min(kelvin, 30000), 1) await self._device.set_color_temperature(kelvin, set_status=True) async def async_set_level(self, brightness: int, transition: int): diff --git a/homeassistant/components/smartthings/sensor.py b/homeassistant/components/smartthings/sensor.py index 6a4c6ba7586..bd591625c18 100644 --- a/homeassistant/components/smartthings/sensor.py +++ b/homeassistant/components/smartthings/sensor.py @@ -35,10 +35,10 @@ from . import SmartThingsEntity from .const import DATA_BROKERS, DOMAIN Map = namedtuple( - "map", "attribute name default_unit device_class state_class entity_category" + "Map", "attribute name default_unit device_class state_class entity_category" ) -CAPABILITY_TO_SENSORS = { +CAPABILITY_TO_SENSORS: dict[str, list[Map]] = { Capability.activity_lighting_mode: [ Map( Attribute.lighting_mode, @@ -555,18 +555,18 @@ async def async_setup_entry( ) -> None: """Add binary sensors for a config entry.""" broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id] - sensors = [] + entities: list[SensorEntity] = [] for device in broker.devices.values(): for capability in broker.get_assigned(device.device_id, "sensor"): if capability == Capability.three_axis: - sensors.extend( + entities.extend( [ SmartThingsThreeAxisSensor(device, index) for index in range(len(THREE_AXIS_NAMES)) ] ) elif capability == Capability.power_consumption_report: - sensors.extend( + entities.extend( [ SmartThingsPowerConsumptionSensor(device, report_name) for report_name in POWER_CONSUMPTION_REPORT_NAMES @@ -574,7 +574,7 @@ async def async_setup_entry( ) else: maps = CAPABILITY_TO_SENSORS[capability] - sensors.extend( + entities.extend( [ SmartThingsSensor( device, @@ -592,7 +592,7 @@ async def async_setup_entry( if broker.any_assigned(device.device_id, "switch"): for capability in (Capability.energy_meter, Capability.power_meter): maps = CAPABILITY_TO_SENSORS[capability] - sensors.extend( + entities.extend( [ SmartThingsSensor( device, @@ -607,7 +607,7 @@ async def async_setup_entry( ] ) - async_add_entities(sensors) + async_add_entities(entities) def get_capabilities(capabilities: Sequence[str]) -> Sequence[str] | None: diff --git a/mypy.ini b/mypy.ini index 581ff48e6ba..4349373afca 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2167,9 +2167,6 @@ ignore_errors = true [mypy-homeassistant.components.ring.*] ignore_errors = true -[mypy-homeassistant.components.smartthings.*] -ignore_errors = true - [mypy-homeassistant.components.solaredge.*] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index cc11d0f97e5..9a965ae63cd 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -64,7 +64,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.plugwise.*", "homeassistant.components.profiler.*", "homeassistant.components.ring.*", - "homeassistant.components.smartthings.*", "homeassistant.components.solaredge.*", "homeassistant.components.sonos.*", "homeassistant.components.spotify.*",