diff --git a/custom_components/dual_smart_thermostat/climate.py b/custom_components/dual_smart_thermostat/climate.py index 6cf8703..c101445 100644 --- a/custom_components/dual_smart_thermostat/climate.py +++ b/custom_components/dual_smart_thermostat/climate.py @@ -29,7 +29,7 @@ STATE_UNAVAILABLE, STATE_UNKNOWN, ) -from homeassistant.core import CoreState, HomeAssistant, ServiceCall, callback +from homeassistant.core import CoreState, Event, HomeAssistant, ServiceCall, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import ( async_dispatcher_connect, @@ -45,7 +45,7 @@ from homeassistant.helpers.reload import async_setup_reload_service from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.service import extract_entity_ids -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, EventType +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType import voluptuous as vol from custom_components.dual_smart_thermostat.hvac_action_reason.hvac_action_reason_external import ( @@ -730,9 +730,7 @@ def max_temp(self) -> float: # Get default temp from super class return super().max_temp - async def _async_sensor_changed( - self, event: EventType[EventStateChangedData] - ) -> None: + async def _async_sensor_changed(self, event: Event[EventStateChangedData]) -> None: """Handle temperature changes.""" new_state = event.data.get("new_state") _LOGGER.info("Sensor change: %s", new_state) @@ -747,7 +745,7 @@ async def _async_sensor_changed( self.async_write_ha_state() async def _async_sensor_floor_changed( - self, event: EventType[EventStateChangedData] + self, event: Event[EventStateChangedData] ) -> None: """Handle floor temperature changes.""" new_state = event.data.get("new_state") @@ -768,9 +766,7 @@ async def _check_device_initial_state(self) -> None: ) await self.hvac_device.async_turn_off() - async def _async_opening_changed( - self, event: EventType[EventStateChangedData] - ) -> None: + async def _async_opening_changed(self, event: Event[EventStateChangedData]) -> None: """Handle opening changes.""" new_state = event.data.get("new_state") _LOGGER.info("Opening changed: %s", new_state) @@ -832,7 +828,7 @@ def _async_hvac_mode_changed(self, hvac_mode) -> None: self.async_write_ha_state() @callback - def _async_switch_changed(self, event: EventType[EventStateChangedData]) -> None: + def _async_switch_changed(self, event: Event[EventStateChangedData]) -> None: """Handle heater switch state changes.""" _LOGGER.debug("Switch changed: %s", event.data) new_state = event.data.get("new_state") diff --git a/custom_components/dual_smart_thermostat/const.py b/custom_components/dual_smart_thermostat/const.py index ea6d7c6..5508e14 100644 --- a/custom_components/dual_smart_thermostat/const.py +++ b/custom_components/dual_smart_thermostat/const.py @@ -1,6 +1,7 @@ """const.""" -from homeassistant.backports.enum import StrEnum +import enum + from homeassistant.components.climate.const import ( PRESET_ACTIVITY, PRESET_AWAY, @@ -82,7 +83,7 @@ ) -class ToleranceDevice(StrEnum): +class ToleranceDevice(enum.StrEnum): """Tolerance device for climate devices.""" HEATER = "heater" diff --git a/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason.py b/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason.py index 75d9139..d3ba615 100644 --- a/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason.py +++ b/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason.py @@ -1,4 +1,4 @@ -from enum import StrEnum +import enum from itertools import chain from custom_components.dual_smart_thermostat.hvac_action_reason.hvac_action_reason_external import ( @@ -12,7 +12,7 @@ SERVICE_SET_HVAC_ACTION_REASON = "set_hvac_action_reason" -class HVACActionReason(StrEnum): +class HVACActionReason(enum.StrEnum): """HVAC Action Reason for climate devices.""" _ignore_ = "member cls" diff --git a/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason_external.py b/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason_external.py index 687052c..0603866 100644 --- a/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason_external.py +++ b/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason_external.py @@ -1,7 +1,7 @@ -from enum import StrEnum +import enum -class HVACActionReasonExternal(StrEnum): +class HVACActionReasonExternal(enum.StrEnum): """External HVAC Action Reason for climate devices.""" PRESENCE = "presence" diff --git a/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason_internal.py b/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason_internal.py index 4bac47e..5a95e5f 100644 --- a/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason_internal.py +++ b/custom_components/dual_smart_thermostat/hvac_action_reason/hvac_action_reason_internal.py @@ -1,7 +1,7 @@ -from enum import StrEnum +import enum -class HVACActionReasonInternal(StrEnum): +class HVACActionReasonInternal(enum.StrEnum): """Internal HVAC Action Reason for climate devices.""" TARGET_TEMP_NOT_REACHED = "target_temp_not_reached" diff --git a/custom_components/dual_smart_thermostat/managers/opening_manager.py b/custom_components/dual_smart_thermostat/managers/opening_manager.py index cd42d02..30eec07 100644 --- a/custom_components/dual_smart_thermostat/managers/opening_manager.py +++ b/custom_components/dual_smart_thermostat/managers/opening_manager.py @@ -1,6 +1,6 @@ """Opening Manager for Dual Smart Thermostat.""" -from enum import StrEnum +import enum from itertools import chain import logging from typing import List @@ -27,7 +27,7 @@ _LOGGER = logging.getLogger(__name__) -class OpeningHvacModeScope(StrEnum): +class OpeningHvacModeScope(enum.StrEnum): """Opening Scope Options""" _ignore_ = "member cls"