Skip to content

Commit

Permalink
Merge pull request #150 from daroga0002/main
Browse files Browse the repository at this point in the history
✨ Bump dependencies
  • Loading branch information
anarion80 authored Feb 5, 2025
2 parents d066b8e + e5a6f2f commit e8b27fc
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 91 deletions.
5 changes: 2 additions & 3 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mariusz-ostoja-swierczynski/tech-controllers",
"image": "mcr.microsoft.com/devcontainers/python:3.12-bookworm",
"image": "mcr.microsoft.com/devcontainers/python:3.13-bookworm",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
Expand Down Expand Up @@ -37,6 +37,5 @@
}
},
"remoteUser": "vscode",
"features": {
}
"features": {}
}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Set manifest version number
run: |
python ${{ github.workspace }}/.github/scripts/update_hacs_manifest.py --version ${{ github.ref_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
python-version: ["3.13"]

steps:
- uses: MathRobin/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.6
rev: v0.9.4
hooks:
# Run the linter.
- id: ruff
Expand All @@ -14,6 +14,6 @@ repos:
hooks:
- id: yamllint
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.43.0
rev: v0.44.0
hooks:
- id: markdownlint
22 changes: 14 additions & 8 deletions custom_components/tech/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
TYPE_VALVE,
UDID,
VALUE,
VALVE_SENSOR_CURRENT_TEMPERATURE,
VALVE_SENSOR_RETURN_TEMPERATURE,
VALVE_SENSOR_SET_TEMPERATURE,
VER,
VISIBILITY,
WINDOW_SENSORS,
WINDOW_STATE,
WORKING_STATUS,
ZONE_STATE,
VALVE_SENSOR_RETURN_TEMPERATURE,
VALVE_SENSOR_SET_TEMPERATURE,
VALVE_SENSOR_CURRENT_TEMPERATURE
)
from .coordinator import TechCoordinator
from .entity import TileEntity
Expand Down Expand Up @@ -123,12 +123,16 @@ async def async_setup_entry(
if tile[CONF_TYPE] == TYPE_VALVE:
entities.append(TileValveSensor(tile, coordinator, config_entry))
for valve_sensor in [
VALVE_SENSOR_RETURN_TEMPERATURE,
VALVE_SENSOR_SET_TEMPERATURE,
VALVE_SENSOR_CURRENT_TEMPERATURE
VALVE_SENSOR_RETURN_TEMPERATURE,
VALVE_SENSOR_SET_TEMPERATURE,
VALVE_SENSOR_CURRENT_TEMPERATURE,
]:
if tile[CONF_PARAMS].get(valve_sensor["state_key"]) is not None:
entities.append(TileValveTemperatureSensor(tile, coordinator, config_entry, valve_sensor))
entities.append(
TileValveTemperatureSensor(
tile, coordinator, config_entry, valve_sensor
)
)
if tile[CONF_TYPE] == TYPE_MIXING_VALVE:
entities.append(TileMixingValveSensor(tile, coordinator, config_entry))
if tile[CONF_TYPE] == TYPE_FUEL_SUPPLY:
Expand Down Expand Up @@ -1619,6 +1623,7 @@ def update_properties(self, device):
STATE_ON if device[CONF_PARAMS]["returnProtection"] == 1 else STATE_OFF
)


class TileValveTemperatureSensor(TileSensor, SensorEntity):
"""Representation of a Tile Valve Temperature Sensor."""

Expand All @@ -1629,7 +1634,7 @@ def __init__(self, device, coordinator, config_entry, valve_sensor):
self.native_unit_of_measurement = UnitOfTemperature.CELSIUS
self.state_class = SensorStateClass.MEASUREMENT
self._valve_number = device[CONF_PARAMS]["valveNumber"]
sensor_name = assets.get_text(valve_sensor["txt_id"])
sensor_name = assets.get_text(valve_sensor["txt_id"])
name = (
self._config_entry.title + " "
if self._config_entry.data[INCLUDE_HUB_IN_NAME]
Expand All @@ -1648,6 +1653,7 @@ def unique_id(self) -> str:
return f"{self._unique_id}_tile_valve_{self._state_key}"

def get_state(self, device):
"""Get the state of the device."""
state = device[CONF_PARAMS][self._state_key]
if self._state_key in ("returnTemp", "currentTemp"):
state /= 10
Expand Down
2 changes: 1 addition & 1 deletion devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# https://devenv.sh/languages/
languages.python = {
enable = true;
version = "3.12";
version = "3.13";
uv.enable = true;
venv.enable = true;
venv.requirements = builtins.readFile ./requirements.txt + "\n" + builtins.readFile ./requirements_test_api.txt;
Expand Down
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
colorlog==6.8.2
homeassistant==2024.10.3
pip==24.2
ruff==0.7.0
colorlog==6.9.0
homeassistant==2025.1.4
pip==25.0
ruff==0.9.4
pre-commit
zlib-ng==0.5.1
30 changes: 15 additions & 15 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
asynctest==0.13.0
aioresponses==0.7.6
aioresponses==0.7.8
codecov==2.1.13
coverage==7.6.4
jsonpickle==3.3.0
coverage==7.6.10
jsonpickle==4.0.1
mock-open==1.4.0
mypy==1.12.1
pylint==3.3.1
astroid==3.3.5
pipdeptree==2.23.4
mypy==1.15.0
pylint==3.3.4
astroid==3.3.8
pipdeptree==2.25.0
pylint-strict-informational==0.1
pytest-aiohttp==1.0.5
pytest-asyncio==0.24.0
pytest-cov==5.0.0
pytest-test-groups==1.0.3
pytest-aiohttp==1.1.0
pytest-asyncio==0.25.3
pytest-cov==6.0.0
pytest-test-groups==1.1.0
pytest-sugar==1.0.0
pytest-timeout==2.3.1
pytest-xdist==3.6.1
pytest==8.3.3
pytest==8.3.4
requests-mock==1.12.1
responses==0.25.3
responses==0.25.6
stdlib-list==0.11.0
tqdm==4.66.5
pytest-homeassistant-custom-component==0.13.174
tqdm==4.67.1
pytest-homeassistant-custom-component==0.13.205
30 changes: 15 additions & 15 deletions requirements_test_api.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
asynctest==0.13.0
aioresponses==0.7.6
aioresponses==0.7.8
codecov==2.1.13
coverage==7.6.4
jsonpickle==3.3.0
coverage==7.6.10
jsonpickle==4.0.1
mock-open==1.4.0
mypy==1.12.1
pylint==3.3.1
astroid==3.3.5
pipdeptree==2.23.4
mypy==1.15.0
pylint==3.3.4
astroid==3.3.8
pipdeptree==2.25.0
pylint-strict-informational==0.1
pytest-aiohttp==1.0.5
pytest-asyncio==0.24.0
pytest-cov==5.0.0
pytest-test-groups==1.0.3
pytest-aiohttp==1.1.0
pytest-asyncio==0.25.3
pytest-cov==6.0.0
pytest-test-groups==1.1.0
pytest-sugar==1.0.0
pytest-timeout==2.3.1
pytest-xdist==3.6.1
pytest==8.3.3
pytest==8.3.4
pytest-md==0.2.0
pytest-emoji==0.2.0
requests-mock==1.12.1
responses==0.25.3
responses==0.25.6
stdlib-list==0.11.0
tqdm==4.66.5
SQLAlchemy==2.0.31
tqdm==4.67.1
SQLAlchemy==2.0.36
4 changes: 2 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ exclude = [
line-length = 88
indent-width = 4

# Assume Python 3.12
target-version = "py312"
# Assume Python 3.13
target-version = "py313"

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
Expand Down
78 changes: 39 additions & 39 deletions tests/tests_api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ async def test_get_module_data_failure(
_LOGGER.info(response)
exception: TechError = exception_info.value
assert exception.status_code == 403, "Unexpected status code"
assert (
exception.status == '{"error":"User has no permission to module"}'
), "Unexpected error message"
assert exception.status == '{"error":"User has no permission to module"}', (
"Unexpected error message"
)

@pytest.mark.asyncio
async def test_get_module_data_auth_failure(
Expand Down Expand Up @@ -291,9 +291,9 @@ async def test_get_translations_auth_failure(
assert isinstance(lang, dict), "The module returned should be a dictionary"
assert lang["status"] == "success", "We should receive status == success"
assert "data" in lang, "The module should have key 'data'"
assert isinstance(
lang["data"], dict
), "The data returned should be a dictionary"
assert isinstance(lang["data"], dict), (
"The data returned should be a dictionary"
)

@pytest.mark.asyncio
async def test_get_module_zones(
Expand Down Expand Up @@ -326,9 +326,9 @@ async def test_get_module_zones(
zones: dict = await tech.get_module_zones(module_data["module_id"])
assert isinstance(zones, dict), "The zones returned should be a dictionary"
assert 101 in zones, "The module should have key 101"
assert isinstance(
zones[101], dict
), "The zone data returned should be a dictionary"
assert isinstance(zones[101], dict), (
"The zone data returned should be a dictionary"
)
assert "zone" in zones[101], "The zone dict should have key zone"

@pytest.mark.asyncio
Expand Down Expand Up @@ -362,9 +362,9 @@ async def test_get_module_tiles(
tiles: dict = await tech.get_module_tiles(module_data["module_id"])
assert isinstance(tiles, dict), "The tiles returned should be a dictionary"
assert 4063 in tiles, "The module should have key 101"
assert isinstance(
tiles[4063], dict
), "The tiles data returned should be a dictionary"
assert isinstance(tiles[4063], dict), (
"The tiles data returned should be a dictionary"
)
assert "id" in tiles[4063], "The tiles dict should have key tiles"

@pytest.mark.asyncio
Expand Down Expand Up @@ -395,13 +395,13 @@ async def test_module_data(
assert isinstance(data, dict), "The tiles returned should be a dictionary"
assert "last_update" in data, "The module should have key last_update"
assert "zones" in data, "The module should have key zones"
assert isinstance(
data["zones"], dict
), "The zones data returned should be a dictionary"
assert isinstance(data["zones"], dict), (
"The zones data returned should be a dictionary"
)
assert "tiles" in data, "The module should have key tiles"
assert isinstance(
data["tiles"], dict
), "The tiles data returned should be a dictionary"
assert isinstance(data["tiles"], dict), (
"The tiles data returned should be a dictionary"
)

@pytest.mark.asyncio
async def test_get_zone(
Expand Down Expand Up @@ -436,9 +436,9 @@ async def test_get_zone(
)
assert isinstance(zone, dict), "The data returned should be a dictionary"
assert "zone" in zone, "The data should have key zones"
assert isinstance(
zone["zone"], dict
), "The zone data returned should be a dictionary"
assert isinstance(zone["zone"], dict), (
"The zone data returned should be a dictionary"
)
assert "id" in zone["zone"], "The zone dict should have key id"

@pytest.mark.asyncio
Expand Down Expand Up @@ -510,18 +510,18 @@ async def test_set_const_temp(
module_data["zone_id"],
module_data["target_temp"],
)
assert isinstance(
response, data
), "The data returned should be a dictionary"
assert isinstance(response, data), (
"The data returned should be a dictionary"
)
assert "error" in response, "We should get an error key on demo account"
assert (
response["error"] == "Demo account."
), "We should get an error key on demo account"
assert response["error"] == "Demo account.", (
"We should get an error key on demo account"
)
exception: TechError = exception_info.value
assert exception.status_code == 401, "Unexpected status code"
assert (
exception.status == '{"error":"Demo account."}'
), "Unexpected error message"
assert exception.status == '{"error":"Demo account."}', (
"Unexpected error message"
)

@pytest.mark.asyncio
async def test_set_const_temp_auth_failure(
Expand Down Expand Up @@ -594,18 +594,18 @@ async def test_set_zone(
response = await tech.set_zone(
module_data["module_id"], module_data["zone_id"], True
)
assert isinstance(
response, data
), "The data returned should be a dictionary"
assert isinstance(response, data), (
"The data returned should be a dictionary"
)
assert "error" in response, "We should get an error key on demo account"
assert (
response["error"] == "Demo account."
), "We should get an error key on demo account"
assert response["error"] == "Demo account.", (
"We should get an error key on demo account"
)
exception: TechError = exception_info.value
assert exception.status_code == 401, "Unexpected status code"
assert (
exception.status == '{"error":"Demo account."}'
), "Unexpected error message"
assert exception.status == '{"error":"Demo account."}', (
"Unexpected error message"
)

@pytest.mark.asyncio
async def test_set_zone_auth_failure(
Expand Down

0 comments on commit e8b27fc

Please sign in to comment.