mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Enable strict typing for enphase_envoy (#107436)
This commit is contained in:
parent
5a39503acc
commit
be68feffdd
@ -155,6 +155,7 @@ homeassistant.components.emulated_hue.*
|
|||||||
homeassistant.components.energy.*
|
homeassistant.components.energy.*
|
||||||
homeassistant.components.energyzero.*
|
homeassistant.components.energyzero.*
|
||||||
homeassistant.components.enigma2.*
|
homeassistant.components.enigma2.*
|
||||||
|
homeassistant.components.enphase_envoy.*
|
||||||
homeassistant.components.esphome.*
|
homeassistant.components.esphome.*
|
||||||
homeassistant.components.event.*
|
homeassistant.components.event.*
|
||||||
homeassistant.components.evil_genius_labs.*
|
homeassistant.components.evil_genius_labs.*
|
||||||
|
@ -42,12 +42,12 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self) -> None:
|
||||||
"""Initialize an envoy flow."""
|
"""Initialize an envoy flow."""
|
||||||
self.ip_address = None
|
self.ip_address: str | None = None
|
||||||
self.username = None
|
self.username = None
|
||||||
self.protovers: str | None = None
|
self.protovers: str | None = None
|
||||||
self._reauth_entry = None
|
self._reauth_entry: config_entries.ConfigEntry | None = None
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_generate_schema(self) -> vol.Schema:
|
def _async_generate_schema(self) -> vol.Schema:
|
||||||
|
@ -169,12 +169,12 @@ class EnvoyEnpowerSwitchEntity(EnvoyBaseEntity, SwitchEntity):
|
|||||||
assert enpower is not None
|
assert enpower is not None
|
||||||
return self.entity_description.value_fn(enpower)
|
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."""
|
"""Turn on the Enpower switch."""
|
||||||
await self.entity_description.turn_on_fn(self.envoy)
|
await self.entity_description.turn_on_fn(self.envoy)
|
||||||
await self.coordinator.async_request_refresh()
|
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."""
|
"""Turn off the Enpower switch."""
|
||||||
await self.entity_description.turn_off_fn(self.envoy)
|
await self.entity_description.turn_off_fn(self.envoy)
|
||||||
await self.coordinator.async_request_refresh()
|
await self.coordinator.async_request_refresh()
|
||||||
@ -217,12 +217,12 @@ class EnvoyDryContactSwitchEntity(EnvoyBaseEntity, SwitchEntity):
|
|||||||
assert relay is not None
|
assert relay is not None
|
||||||
return self.entity_description.value_fn(relay)
|
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."""
|
"""Turn on (close) the dry contact."""
|
||||||
if await self.entity_description.turn_on_fn(self.envoy, self.relay_id):
|
if await self.entity_description.turn_on_fn(self.envoy, self.relay_id):
|
||||||
self.async_write_ha_state()
|
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."""
|
"""Turn off (open) the dry contact."""
|
||||||
if await self.entity_description.turn_off_fn(self.envoy, self.relay_id):
|
if await self.entity_description.turn_off_fn(self.envoy, self.relay_id):
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
@ -261,12 +261,12 @@ class EnvoyStorageSettingsSwitchEntity(EnvoyBaseEntity, SwitchEntity):
|
|||||||
assert self.data.tariff.storage_settings is not None
|
assert self.data.tariff.storage_settings is not None
|
||||||
return self.entity_description.value_fn(self.data.tariff.storage_settings)
|
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."""
|
"""Turn on the storage settings switch."""
|
||||||
await self.entity_description.turn_on_fn(self.envoy)
|
await self.entity_description.turn_on_fn(self.envoy)
|
||||||
await self.coordinator.async_request_refresh()
|
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."""
|
"""Turn off the storage switch."""
|
||||||
await self.entity_description.turn_off_fn(self.envoy)
|
await self.entity_description.turn_off_fn(self.envoy)
|
||||||
await self.coordinator.async_request_refresh()
|
await self.coordinator.async_request_refresh()
|
||||||
|
10
mypy.ini
10
mypy.ini
@ -1311,6 +1311,16 @@ disallow_untyped_defs = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = 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.*]
|
[mypy-homeassistant.components.esphome.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user