Enable strict typing for ecowitt (#107861)

This commit is contained in:
Marc Mueller 2024-01-12 12:57:19 +01:00 committed by GitHub
parent b1f1ecb40a
commit 93dc0b9029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 5 deletions

View File

@ -149,6 +149,7 @@ homeassistant.components.dsmr.*
homeassistant.components.dunehd.*
homeassistant.components.duotecno.*
homeassistant.components.easyenergy.*
homeassistant.components.ecowitt.*
homeassistant.components.efergy.*
homeassistant.components.electrasmart.*
homeassistant.components.electric_kiwi.*

View File

@ -31,7 +31,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
)
@callback
def _stop_ecowitt(_: Event):
def _stop_ecowitt(_: Event) -> None:
"""Stop the Ecowitt listener."""
webhook.async_unregister(hass, entry.data[CONF_WEBHOOK_ID])

View File

@ -31,15 +31,15 @@ class EcowittEntity(Entity):
sw_version=sensor.station.version,
)
async def async_added_to_hass(self):
async def async_added_to_hass(self) -> None:
"""Install listener for updates later."""
def _update_state():
def _update_state() -> None:
"""Update the state on callback."""
self.async_write_ha_state()
self.ecowitt.update_cb.append(_update_state)
self.async_on_remove(lambda: self.ecowitt.update_cb.remove(_update_state))
self.ecowitt.update_cb.append(_update_state) # type: ignore[arg-type] # upstream bug
self.async_on_remove(lambda: self.ecowitt.update_cb.remove(_update_state)) # type: ignore[arg-type] # upstream bug
@property
def available(self) -> bool:

View File

@ -1251,6 +1251,16 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.ecowitt.*]
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.efergy.*]
check_untyped_defs = true
disallow_incomplete_defs = true