From 59d677ba3e8575373f7f89186da4e4289c699e5d Mon Sep 17 00:00:00 2001
From: Jan Bouwhuis <jbouwh@users.noreply.github.com>
Date: Thu, 23 Jan 2025 19:21:39 +0100
Subject: [PATCH] Enable strict typing for incomfort integration (#136291)

* Enable strict typing for incomfort integration

* Comply to strict typing

* Wrap in bool
---
 .strict-typing                                      |  1 +
 homeassistant/components/incomfort/__init__.py      |  2 +-
 homeassistant/components/incomfort/binary_sensor.py |  2 +-
 homeassistant/components/incomfort/config_flow.py   |  4 ++--
 homeassistant/components/incomfort/sensor.py        |  2 +-
 mypy.ini                                            | 10 ++++++++++
 6 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/.strict-typing b/.strict-typing
index ce1ea1a6838..7034ea1f0c1 100644
--- a/.strict-typing
+++ b/.strict-typing
@@ -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.*
diff --git a/homeassistant/components/incomfort/__init__.py b/homeassistant/components/incomfort/__init__.py
index 909a4731e84..722518ba6c2 100644
--- a/homeassistant/components/incomfort/__init__.py
+++ b/homeassistant/components/incomfort/__init__.py
@@ -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)
diff --git a/homeassistant/components/incomfort/binary_sensor.py b/homeassistant/components/incomfort/binary_sensor.py
index c4a23946bb2..e4353e457a5 100644
--- a/homeassistant/components/incomfort/binary_sensor.py
+++ b/homeassistant/components/incomfort/binary_sensor.py
@@ -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:
diff --git a/homeassistant/components/incomfort/config_flow.py b/homeassistant/components/incomfort/config_flow.py
index 779b0e97777..8e4a5f72619 100644
--- a/homeassistant/components/incomfort/config_flow.py
+++ b/homeassistant/components/incomfort/config_flow.py
@@ -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()
diff --git a/homeassistant/components/incomfort/sensor.py b/homeassistant/components/incomfort/sensor.py
index e9697a0036f..e3f3fc785b2 100644
--- a/homeassistant/components/incomfort/sensor.py
+++ b/homeassistant/components/incomfort/sensor.py
@@ -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:
diff --git a/mypy.ini b/mypy.ini
index ccdc7c669d7..d0579ab8f41 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -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
-- 
GitLab