Enable strict typing for incomfort integration (#136291)

* Enable strict typing for incomfort integration

* Comply to strict typing

* Wrap in bool
This commit is contained in:
Jan Bouwhuis 2025-01-23 19:21:39 +01:00 committed by GitHub
parent ac7b9d7639
commit 59d677ba3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 16 additions and 5 deletions

View File

@ -262,6 +262,7 @@ homeassistant.components.image_processing.*
homeassistant.components.image_upload.*
homeassistant.components.imap.*
homeassistant.components.imgw_pib.*
homeassistant.components.incomfort.*
homeassistant.components.input_button.*
homeassistant.components.input_select.*
homeassistant.components.input_text.*

View File

@ -63,6 +63,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: InComfortConfigEntry) ->
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: InComfortConfigEntry) -> bool:
"""Unload config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@ -102,7 +102,7 @@ class IncomfortBinarySensor(IncomfortBoilerEntity, BinarySensorEntity):
@property
def is_on(self) -> bool:
"""Return the status of the sensor."""
return self._heater.status[self.entity_description.value_key]
return bool(self._heater.status[self.entity_description.value_key])
@property
def extra_state_attributes(self) -> dict[str, Any] | None:

View File

@ -10,7 +10,6 @@ import voluptuous as vol
from homeassistant.config_entries import (
SOURCE_RECONFIGURE,
ConfigEntry,
ConfigEntryState,
ConfigFlow,
ConfigFlowResult,
@ -29,6 +28,7 @@ from homeassistant.helpers.selector import (
)
from homeassistant.helpers.service_info.dhcp import DhcpServiceInfo
from . import InComfortConfigEntry
from .const import CONF_LEGACY_SETPOINT_STATUS, DOMAIN
from .coordinator import async_connect_gateway
@ -103,7 +103,7 @@ class InComfortConfigFlow(ConfigFlow, domain=DOMAIN):
@staticmethod
@callback
def async_get_options_flow(
config_entry: ConfigEntry,
config_entry: InComfortConfigEntry,
) -> InComfortOptionsFlowHandler:
"""Get the options flow for this handler."""
return InComfortOptionsFlowHandler()

View File

@ -99,7 +99,7 @@ class IncomfortSensor(IncomfortBoilerEntity, SensorEntity):
@property
def native_value(self) -> StateType:
"""Return the state of the sensor."""
return self._heater.status[self.entity_description.value_key]
return self._heater.status[self.entity_description.value_key] # type: ignore [no-any-return]
@property
def extra_state_attributes(self) -> dict[str, Any] | None:

10
mypy.ini generated
View File

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