Skip to content

Commit

Permalink
Backwards compatibility updates
Browse files Browse the repository at this point in the history
Ensure integration loads in 2024.1.0
  • Loading branch information
jason0x43 committed Sep 3, 2024
1 parent 0435236 commit 86f3a88
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
14 changes: 12 additions & 2 deletions custom_components/hubitat/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Config flow for Hubitat integration."""

import logging
from copy import deepcopy
from typing import Any, Awaitable, Callable, cast
Expand All @@ -11,7 +12,6 @@
CONN_CLASS_LOCAL_PUSH,
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, CONF_TEMPERATURE_UNIT
Expand All @@ -20,6 +20,14 @@
from homeassistant.helpers import device_registry
from homeassistant.helpers.device_registry import DeviceEntry

try:
from homeassistant.config_entries import ConfigFlowResult # type: ignore
except Exception:
from homeassistant.config_entries import (
FlowResult as ConfigFlowResult, # type: ignore
)


from .const import (
DOMAIN,
H_CONF_APP_ID,
Expand Down Expand Up @@ -79,7 +87,9 @@ class HubitatConfigFlow(ConfigFlow, domain=DOMAIN): # type: ignore
def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlow:
return HubitatOptionsFlow(config_entry)

async def async_step_user(
# TODO: remove the 'type: ignore' when were not falling back on
# FlowResult
async def async_step_user( # type: ignore
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the user step."""
Expand Down
6 changes: 4 additions & 2 deletions custom_components/hubitat/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ def __init__(self, **kwargs: Unpack[HubitatEntityArgs]):
FanEntity.__init__(self)
self._attr_supported_features = FanEntityFeature.SET_SPEED

# Enable TURN_ON and TURN_OFF when used with a supporting version of
# HomeAssistant
if "TURN_ON" in FanEntityFeature.__members__:
self._attr_supported_features |= (
FanEntityFeature.TURN_ON | FanEntityFeature.TURN_OFF
FanEntityFeature.TURN_ON | FanEntityFeature.TURN_OFF # type: ignore
)
self._enable_turn_on_off_backwards_compatibility
self._enable_turn_on_off_backwards_compatibility # type: ignore

self._attr_unique_id = f"{super().unique_id}::fan"
self.load_state()
Expand Down
10 changes: 5 additions & 5 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ acme==2.10.0
# via hass-nabucasa
aiodns==3.2.0
# via homeassistant
aiohappyeyeballs==2.3.5
aiohappyeyeballs==2.4.0
# via aiohttp
aiohttp==3.10.1
# via aiohttp-cors
Expand Down Expand Up @@ -66,9 +66,9 @@ bluetooth-auto-recovery==1.3.0
# via habluetooth
bluetooth-data-tools==1.19.0
# via habluetooth
boto3==1.34.93
boto3==1.35.10
# via pycognito
botocore==1.34.93
botocore==1.35.10
# via boto3
# via s3transfer
btsocket==0.2.0
Expand Down Expand Up @@ -167,7 +167,7 @@ platformdirs==4.2.0
pluggy==1.4.0
# via pytest
pre-commit==2.21.0
psutil==5.9.8
psutil==6.0.0
# via psutil-home-assistant
psutil-home-assistant==0.0.1
# via homeassistant
Expand Down Expand Up @@ -221,7 +221,7 @@ requests==2.32.3
# via homeassistant
# via pycognito
ruff==0.3.0
s3transfer==0.10.1
s3transfer==0.10.2
# via boto3
setuptools==69.1.1
# via acme
Expand Down

0 comments on commit 86f3a88

Please sign in to comment.