Skip to content

Commit

Permalink
fix: ensures supported features is never zero
Browse files Browse the repository at this point in the history
Fixes #312
  • Loading branch information
= authored and swingerman committed Dec 6, 2024
1 parent babefe9 commit b55fdd7
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dual Smart THermostat Integration",
"image": "mcr.microsoft.com/devcontainers/python:dev-3.12-bookworm",
"image": "mcr.microsoft.com/devcontainers/python:dev-3.13-bookworm",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.13
cache: "pip"

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
python-version: [3.13]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.12
language_version: python3.13
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def __init__(
) -> None:
self.hass = hass
self.environment = environment
self._supported_features = 0
self._cooler_entity_id = config.get(CONF_COOLER)
self._heater_entity_id = config.get(CONF_HEATER)
self._ac_mode = config.get(CONF_AC_MODE)
Expand All @@ -72,6 +71,8 @@ def __init__(
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
)

self._supported_features = self._default_support_flags

self._hvac_power_levels = config.get(CONF_HVAC_POWER_LEVELS)
self._hvac_power_tolerance = config.get(CONF_HVAC_POWER_TOLERANCE)

Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements.txt
pip>=24.1.2,<24.4
pytest-homeassistant-custom-component==0.13.162
pytest-homeassistant-custom-component==0.13.190
pre-commit
isort
black
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ known_first_party = custom_components.schedule_state, tests
combine_as_imports = true

[mypy]
python_version = 3.12
python_version = 3.13
ignore_errors = true
follow_imports = silent
ignore_missing_imports = true
Expand Down
24 changes: 24 additions & 0 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,30 @@ async def async_set_temperature(
)


async def async_set_temperature_range(
hass,
entity_id=ENTITY_MATCH_ALL,
target_temp_high=None,
target_temp_low=None,
hvac_mode=None,
) -> None:
"""Set new target temperature."""
kwargs = {
key: value
for key, value in [
(ATTR_TARGET_TEMP_HIGH, target_temp_high),
(ATTR_TARGET_TEMP_LOW, target_temp_low),
(ATTR_ENTITY_ID, entity_id),
(ATTR_HVAC_MODE, hvac_mode),
]
if value is not None
}
_LOGGER.debug("set_temperature start data=%s", kwargs)
await hass.services.async_call(
DOMAIN, SERVICE_SET_TEMPERATURE, kwargs, blocking=True
)


async def async_set_humidity(
hass,
humidity=None,
Expand Down
Loading

0 comments on commit b55fdd7

Please sign in to comment.