Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.0.5 #23

Merged
merged 11 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/check-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Linting

on:
push:
branches: [ "master", "stable" ]
branches: [ "master", "dev" ]
paths: [
".github/workflows/check-lint.yml",
"src/**.py",
Expand All @@ -13,7 +13,7 @@ on:
]

pull_request:
branches: [ "master", "stable" ]
branches: [ "master", "dev" ]
paths: [
".github/workflows/check-lint.yml",
"src/**.py",
Expand Down Expand Up @@ -41,6 +41,7 @@ jobs:
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
check-latest: true

- name: Install dependencies
run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/check-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Testing

on:
push:
branches: [ "master", "stable" ]
branches: [ "master", "dev" ]
paths: [
".github/workflows/check-test.yml",
"src/**.py",
Expand All @@ -13,7 +13,7 @@ on:
]

pull_request:
branches: [ "master", "stable" ]
branches: [ "master", "dev" ]
paths: [
".github/workflows/check-test.yml",
"src/**.py",
Expand All @@ -35,7 +35,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
python-version: ["3.12", "3.13.0-rc.1"]

steps:
- uses: actions/[email protected]
Expand All @@ -44,6 +44,7 @@ jobs:
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
check-latest: true

- name: Install dependencies
run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/check-type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Typing

on:
push:
branches: [ "master", "stable" ]
branches: [ "master", "dev" ]
paths: [
".github/workflows/check-type.yml",
"src/**.py",
Expand All @@ -14,7 +14,7 @@ on:
]

pull_request:
branches: [ "master", "stable" ]
branches: [ "master", "dev" ]
paths: [
".github/workflows/check-type.yml",
"src/**.py",
Expand Down Expand Up @@ -43,6 +43,7 @@ jobs:
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
check-latest: true

- name: Install dependencies
run: |
Expand All @@ -51,6 +52,6 @@ jobs:
pip install -r requirements_dev.txt

- name: Check with mypy
run: mypy
run: mypy --enable-incomplete-feature=NewGenericSyntax

- run: echo "🍏 This job's status is ${{ job.status }}."
12 changes: 2 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@ exclude: (^.secrets/|^docs/)

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.6.3
hooks:
- id: ruff # linter
- id: ruff-format # formatter

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-eval
- id: python-no-log-warn

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
Expand All @@ -26,7 +18,7 @@ repos:
- id: check-toml
- id: check-yaml
- id: debug-statements
# id: end-of-file-fixer
# id: end-of-file-fixer # not for snapshots
- id: mixed-line-ending
- id: trailing-whitespace

Expand Down
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"aiohttp>=3.9.5",
"voluptuous>=0.13.1",
]
requires-python = ">=3.11"
requires-python = ">=3.12"
license = "Apache-2.0"

keywords = [
Expand Down Expand Up @@ -157,13 +157,22 @@
"B", # flake8-bugbear
"E", # pycodestyle
"F", # Pyflakes
"G", # flake8-logging-format
"I", # isort
"LOG", # flake8-logging
"PGH", # pygrep hooks
"SIM", # flake8-simplify
"S", # flake8-bandit
"UP", # pyupgrade
]
ignore = ["B011", "E501", "SIM102", "SIM114", "UP009"]
# "FBT", # flake8-boolean-trap
# "PT", # flake8-pytest-style
# "RET", # flake8-return

ignore = ["B011", "G004", "E501", "S101", "SIM102", "SIM114", "UP009"]
# B011 - Do not call assert False since python -O removes these calls
# E501 - Line too long
# G004 - Logging statement uses f-string
# SIM102 - Use a single `if` statement instead of nested `if` statements
# SIM114 - Combine `if` branches using logical `or` operator
# UP009 - UTF-8 encoding declaration is unnecessary
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# last checked/updated: 2024/06/24 (c.f. HA 2023.6.4)
# last checked/updated: 2024/08/31 (c.f. HA 2023.10.x)
#

# used by library (but not enough for CLI)
aiohttp>=3.10.5
voluptuous>=0.15.2
2 changes: 1 addition & 1 deletion requirements_cli.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# last checked/updated: 2024/06/24
# last checked/updated: 2024/08/31
#

# for using the the library via the CLI, client.py (includes requirements.txt)
Expand Down
14 changes: 8 additions & 6 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# last checked/updated: 2024/06/24
# last checked/updated: 2024/08/31
#

# for using the the library via the CLI, client.py (includes requirements.txt)
-r requirements.txt

# used for development (linting)
pre-commit>=3.8.0
ruff>=0.6.2
ruff>=0.6.3

# used for development (typing)
mypy>=1.11.1
mypy>=1.11.2
types-aiofiles>=24.1.0 # used only by CLI
types-PyYAML>=6.0.12
voluptuous>=0.15.2

# used for testing
pytest>=8.3.2
pytest-asyncio>=0.23.7
pytest-xdist>=3.6.1
pytest-asyncio>=0.24.0
pytest-snapshot>=0.9.0
pytest-sugar>=1.0.0
pytest-xdist>=3.6.1
# pytest-cov

# used for testing at runtime
debugpy >= 1.8.5
# typeguard >= 4.1.5 # optional

# used for build/deploy
hatch>=1.12.0 # is not core HA
Expand Down
2 changes: 1 addition & 1 deletion src/evohomeasync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
RequestFailed,
)

__version__ = "1.0.4"
__version__ = "1.0.5"
5 changes: 2 additions & 3 deletions src/evohomeasync/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import annotations

import logging
from datetime import datetime as dt
from http import HTTPMethod, HTTPStatus
from typing import Any, Final, Never, NewType

Expand Down Expand Up @@ -94,12 +93,11 @@ async def _populate_user_data(self) -> tuple[_UserDataT, aiohttp.ClientResponse]
self._user_data: _UserDataT = await response.json()
assert self._user_data != {}

user_id: _UserIdT = self._user_data[SZ_USER_INFO][SZ_USER_ID] # type: ignore[assignment,index]
user_id: _UserIdT = self._user_data[SZ_USER_INFO][SZ_USER_ID] # type: ignore[assignment, index]
session_id: _SessionIdT = self._user_data[SZ_SESSION_ID] # type: ignore[assignment, index]

self._user_id = user_id
self._session_id = self._headers[SZ_SESSION_ID] = session_id
self._session_renewed = dt.now()

self._logger.info(f"user_data = {self._user_data}")
return self._user_data, response # type: ignore[return-value]
Expand Down Expand Up @@ -156,6 +154,7 @@ async def _make_request(
if response_json[0]["code"] != "Unauthorized":
return response

# NOTE: I cannot recall if this is needed, or if it causes a bug
# if SZ_SESSION_ID not in self._headers: # no value trying to re-authenticate
# return response # ...because: the user credentials must be invalid

Expand Down
2 changes: 1 addition & 1 deletion src/evohomeasync2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
from .location import Location # noqa: F401
from .zone import Zone # noqa: F401

__version__ = "1.0.4"
__version__ = "1.0.5"
2 changes: 1 addition & 1 deletion src/evohomeasync2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# all _DBG_* flags should be False for published code
_DBG_DEBUG_CLI = False # for debugging of click

DEBUG_ADDR = "0.0.0.0"
DEBUG_ADDR = "0.0.0.0" # noqa: S104
DEBUG_PORT = 5679

SZ_CLEANUP: Final = "cleanup"
Expand Down
2 changes: 1 addition & 1 deletion src/evohomeasync2/hotwater.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def scheduleCapabilitiesResponse(self) -> _EvoDictT:

@property # for convenience (is not a top-level config attribute)
def allowedModes(self) -> _EvoListT:
ret: _EvoListT = self.scheduleCapabilitiesResponse[SZ_ALLOWED_MODES]
ret: _EvoListT = self.dhwStateCapabilitiesResponse[SZ_ALLOWED_MODES]
return ret

@property
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class TokenManager(AbstractTokenManager):
async def restore_access_token(self) -> None:
"""Restore the access token from the cache."""

self.access_token = "access_token" # will always be valid
self.access_token = "access_token" # noqa: S105
self.access_token_expires = dt.max
self.refresh_token = "refresh_token"
self.refresh_token = "refresh_token" # noqa: S105

async def save_access_token(self) -> None:
"""Save the access token to the cache."""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
activeFaults: &id001 []
active_faults: *id001
allowedSystemModes:
- canBePermanent: true
canBeTemporary: false
systemMode: HeatingOff
- canBePermanent: true
canBeTemporary: false
systemMode: Auto
- canBePermanent: true
canBeTemporary: false
systemMode: AutoWithReset
- canBePermanent: true
canBeTemporary: true
maxDuration: 1.00:00:00
systemMode: AutoWithEco
timingMode: Duration
timingResolution: 01:00:00
- canBePermanent: true
canBeTemporary: true
maxDuration: 99.00:00:00
systemMode: Away
timingMode: Period
timingResolution: 1.00:00:00
- canBePermanent: true
canBeTemporary: true
maxDuration: 99.00:00:00
systemMode: DayOff
timingMode: Period
timingResolution: 1.00:00:00
- canBePermanent: true
canBeTemporary: true
maxDuration: 99.00:00:00
systemMode: Custom
timingMode: Period
timingResolution: 1.00:00:00
modelType: EvoTouch
systemId: '3432522'
systemModeStatus:
isPermanent: true
mode: AutoWithEco
system_mode: AutoWithEco

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
active_faults: []
gatewayId: '2499896'
isWiFi: false
mac: 00D02DEE4E56
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
activeFaults: &id001 []
active_faults: *id001
allowedModes: &id002
- FollowSchedule
- PermanentOverride
- TemporaryOverride
dhwId: '3933910'
dhwStateCapabilitiesResponse:
allowedModes: *id002
allowedStates:
- 'On'
- 'Off'
maxDuration: 1.00:00:00
timingResolution: 00:10:00
mode: PermanentOverride
name: Domestic Hot Water
scheduleCapabilitiesResponse:
maxSwitchpointsPerDay: 6
minSwitchpointsPerDay: 1
timingResolution: 00:10:00
state: 'Off'
stateStatus:
mode: PermanentOverride
state: 'Off'
temperature: 23.0
temperatureStatus:
isAvailable: true
temperature: 23.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
country: UnitedKingdom
locationId: '2738909'
locationOwner:
firstname: David
lastname: '********'
userId: '2263181'
username: [email protected]
locationType: Residential
name: My Home
timeZone:
currentOffsetMinutes: 60
displayName: (UTC+00:00) Dublin, Edinburgh, Lisbon, London
offsetMinutes: 0
supportsDaylightSaving: true
timeZoneId: GMTStandardTime
useDaylightSaveSwitching: true
Loading