Enable strict typing for enphase_envoy (#107436)

This commit is contained in:
Marc Mueller 2024-01-07 10:42:38 +01:00 committed by GitHub
parent 5a39503acc
commit be68feffdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 9 deletions

View File

@ -155,6 +155,7 @@ homeassistant.components.emulated_hue.*
homeassistant.components.energy.*
homeassistant.components.energyzero.*
homeassistant.components.enigma2.*
homeassistant.components.enphase_envoy.*
homeassistant.components.esphome.*
homeassistant.components.event.*
homeassistant.components.evil_genius_labs.*

View File

@ -42,12 +42,12 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
VERSION = 1
def __init__(self):
def __init__(self) -> None:
"""Initialize an envoy flow."""
self.ip_address = None
self.ip_address: str | None = None
self.username = None
self.protovers: str | None = None
self._reauth_entry = None
self._reauth_entry: config_entries.ConfigEntry | None = None
@callback
def _async_generate_schema(self) -> vol.Schema:

View File

@ -169,12 +169,12 @@ class EnvoyEnpowerSwitchEntity(EnvoyBaseEntity, SwitchEntity):
assert enpower is not None
return self.entity_description.value_fn(enpower)
async def async_turn_on(self):
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the Enpower switch."""
await self.entity_description.turn_on_fn(self.envoy)
await self.coordinator.async_request_refresh()
async def async_turn_off(self):
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the Enpower switch."""
await self.entity_description.turn_off_fn(self.envoy)
await self.coordinator.async_request_refresh()
@ -217,12 +217,12 @@ class EnvoyDryContactSwitchEntity(EnvoyBaseEntity, SwitchEntity):
assert relay is not None
return self.entity_description.value_fn(relay)
async def async_turn_on(self):
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on (close) the dry contact."""
if await self.entity_description.turn_on_fn(self.envoy, self.relay_id):
self.async_write_ha_state()
async def async_turn_off(self):
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off (open) the dry contact."""
if await self.entity_description.turn_off_fn(self.envoy, self.relay_id):
self.async_write_ha_state()
@ -261,12 +261,12 @@ class EnvoyStorageSettingsSwitchEntity(EnvoyBaseEntity, SwitchEntity):
assert self.data.tariff.storage_settings is not None
return self.entity_description.value_fn(self.data.tariff.storage_settings)
async def async_turn_on(self):
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the storage settings switch."""
await self.entity_description.turn_on_fn(self.envoy)
await self.coordinator.async_request_refresh()
async def async_turn_off(self):
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the storage switch."""
await self.entity_description.turn_off_fn(self.envoy)
await self.coordinator.async_request_refresh()

View File

@ -1311,6 +1311,16 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.enphase_envoy.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.esphome.*]
check_untyped_defs = true
disallow_incomplete_defs = true