Remove smartthings from mypy ignore list (#64511)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/64522/head^2
epenet 2022-01-20 10:13:04 +01:00 committed by GitHub
parent f854fdb8fd
commit a1ed2a57e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 18 deletions

View File

@ -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

View File

@ -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."""

View File

@ -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):

View File

@ -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:

View File

@ -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

View File

@ -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.*",