Skip to content

Commit

Permalink
chore: removed expectation for old HA versions
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Dec 1, 2024
1 parent dc69b7c commit 9edca33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
7 changes: 2 additions & 5 deletions custom_components/localtuya/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,8 @@ def supported_features(self):
if self._has_fan_mode:
supported_features |= ClimateEntityFeature.FAN_MODE

try: # requires HA >= 2024.2.1
supported_features |= ClimateEntityFeature.TURN_OFF
supported_features |= ClimateEntityFeature.TURN_ON
except AttributeError:
...
supported_features |= ClimateEntityFeature.TURN_OFF
supported_features |= ClimateEntityFeature.TURN_ON

return supported_features

Expand Down
9 changes: 3 additions & 6 deletions custom_components/localtuya/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,12 +1159,9 @@ async def platform_schema(
vol.Required(CONF_ENTITY_CATEGORY, default=str(default_category(platform)))
] = col_to_select(ENTITY_CATEGORY)

try: # requires HA >= 2024.3 -> Later this will be remove and update HACS version requirement.
plat_schema = await hass.async_add_import_executor_job(
flow_schema, platform, dps_strings
)
except AttributeError:
plat_schema = flow_schema(platform, dps_strings)
plat_schema = await hass.async_add_import_executor_job(
flow_schema, platform, dps_strings
)

return vol.Schema(schema).extend(plat_schema)

Expand Down
7 changes: 2 additions & 5 deletions custom_components/localtuya/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,8 @@ def supported_features(self) -> FanEntityFeature:
if self.has_config(CONF_FAN_DIRECTION):
features |= FanEntityFeature.DIRECTION

try: # requires HA >= 2024.8.0
features |= FanEntityFeature.TURN_OFF
features |= FanEntityFeature.TURN_ON
except AttributeError:
pass
features |= FanEntityFeature.TURN_OFF
features |= FanEntityFeature.TURN_ON

return features

Expand Down

0 comments on commit 9edca33

Please sign in to comment.