diff --git a/.strict-typing b/.strict-typing index dec244ece15..b5ae496fcf0 100644 --- a/.strict-typing +++ b/.strict-typing @@ -122,6 +122,7 @@ homeassistant.components.uptimerobot.* homeassistant.components.vacuum.* homeassistant.components.vallox.* homeassistant.components.water_heater.* +homeassistant.components.watttime.* homeassistant.components.weather.* homeassistant.components.websocket_api.* homeassistant.components.zodiac.* diff --git a/homeassistant/components/watttime/sensor.py b/homeassistant/components/watttime/sensor.py index 6a6d05701c4..50389de35c6 100644 --- a/homeassistant/components/watttime/sensor.py +++ b/homeassistant/components/watttime/sensor.py @@ -1,7 +1,7 @@ """Support for WattTime sensors.""" from __future__ import annotations -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, cast from homeassistant.components.sensor import ( STATE_CLASS_MEASUREMENT, @@ -100,4 +100,4 @@ class RealtimeEmissionsSensor(CoordinatorEntity, SensorEntity): @property def native_value(self) -> StateType: """Return the value reported by the sensor.""" - return self.coordinator.data[self.entity_description.key] + return cast(StateType, self.coordinator.data[self.entity_description.key]) diff --git a/mypy.ini b/mypy.ini index cc491043c3a..0d4ca87ac64 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1353,6 +1353,17 @@ no_implicit_optional = true warn_return_any = true warn_unreachable = true +[mypy-homeassistant.components.watttime.*] +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +no_implicit_optional = true +warn_return_any = true +warn_unreachable = true + [mypy-homeassistant.components.weather.*] check_untyped_defs = true disallow_incomplete_defs = true