Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
15 changes: 13 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ repos:
- id: pyupgrade
name: "Check Py upgrade"
args: [--py311-plus]
# Moved codespell configuration to setup.cfg as per 'all-files' issues not reading args
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
name: "Check spelling"
name: "Check Code Spelling"
args:
- --ignore-words-list=aiport,astroid,checkin,currenty,hass,iif,incomfort,lookin,nam,NotIn
- --skip="./.*,*.csv,*.json,*.ambr"
- --quiet-level=2
exclude_types: [csv, json]
exclude: ^userdata/|^fixtures/
- repo: https://github.com/PyCQA/bandit
rev: 1.8.3
hooks:
Expand All @@ -51,6 +55,13 @@ repos:
hooks:
- id: yamllint
name: "YAML linting"
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
name: "Shell checking"
args:
- --external-sources
- repo: https://github.com/cdce8p/python-typing-update
rev: v0.7.2
hooks:
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Home Automation",
]
Expand All @@ -24,7 +23,7 @@ maintainers = [
{ name = "bouwew"},
{ name = "CoMPaTech" }
]
requires-python = ">=3.12.0"
requires-python = ">=3.13"
dependencies = [
"aiohttp",
"defusedxml",
Expand Down Expand Up @@ -52,7 +51,7 @@ include = ["plugwise*"]
# 20241208: W0201 / attribute-defined-outside-init
# 20241208: R1702 / too-many-nested-blocks # too many nested blocks in test_init 8/5
# 20241208: R6102 / consider-using-tuple
# 20241208: Recommended disabling => "implicit-str-concat", # ISC001 - 2 occurances!
# 20241208: Recommended disabling => "implicit-str-concat", # ISC001 - 2 occurrences!
##

[tool.pylint.MAIN]
Expand Down Expand Up @@ -466,7 +465,6 @@ lint.select = [
"S317", # suspicious-xml-sax-usage
"S318", # suspicious-xml-mini-dom-usage
"S319", # suspicious-xml-pull-dom-usage
"S320", # suspicious-xmle-tree-usage
"S601", # paramiko-call
"S602", # subprocess-popen-with-shell-equals-true
"S604", # call-with-shell-equals-true
Expand Down
31 changes: 18 additions & 13 deletions scripts/complexity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@ set -eu

my_path=$(git rev-parse --show-toplevel)

# shellcheck disable=SC1091
source "${my_path}/scripts/python-venv.sh"

# shellcheck disable=SC2154
if [ -f "${my_venv}/bin/activate" ]; then
# shellcheck disable=SC1091
. "${my_venv}/bin/activate"
echo "-----------------------------"
echo "Running cyclomatic complexity"
echo "-----------------------------"
PYTHONPATH=$(pwd) radon cc plugwise/ tests/ -s -nc --no-assert
if [ -n "${VIRTUAL_ENV-}" ] && [ -f "${VIRTUAL_ENV}/bin/activate" ]; then
# shellcheck disable=SC1091 # ingesting virtualenv
. "${VIRTUAL_ENV}/bin/activate"
else
echo "Virtualenv available, bailing out"
exit 2
# other common virtualenvs
my_path=$(git rev-parse --show-toplevel)

for venv in venv .venv .; do
if [ -f "${my_path}/${venv}/bin/activate" ]; then
# shellcheck disable=SC1090 # ingesting virtualenv
. "${my_path}/${venv}/bin/activate"
break
fi
done
fi

echo "-----------------------------"
echo "Running cyclomatic complexity"
echo "-----------------------------"
PYTHONPATH=$(pwd) radon cc plugwise/ tests/ -s -nc --no-assert
176 changes: 63 additions & 113 deletions scripts/manual_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ def json_writer(manual_name: str, output: dict) -> None:
adam_multiple_devices_per_zone = base.copy()

# Change schedule to not present for "446ac08dd04d4eff8ac57489757b7314"
adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"].pop("available_schedules")
adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"].pop("select_schedule")
adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"].pop(
"available_schedules"
)
adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"].pop(
"select_schedule"
)

json_writer("m_adam_multiple_devices_per_zone", adam_multiple_devices_per_zone)

Expand Down Expand Up @@ -73,24 +77,12 @@ def json_writer(manual_name: str, output: dict) -> None:
m_adam_cooling.pop("10016900610d4c7481df78c89606ef22")

# Correct setpoint for device "ad4838d7d35c4d6ea796ee12ae5aedf8" and zone "f2bf9048bef64cc5b6d5110154e33c81"
m_adam_cooling["ad4838d7d35c4d6ea796ee12ae5aedf8"]["sensors"][
"setpoint"
] = 23.5
m_adam_cooling["ad4838d7d35c4d6ea796ee12ae5aedf8"]["sensors"][
"temperature"
] = 25.8
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"]["thermostat"][
"setpoint"
] = 23.5
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"]["sensors"][
"temperature"
] = 25.8
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"][
"select_schedule"
] = "off"
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"][
"control_state"
] = "cooling"
m_adam_cooling["ad4838d7d35c4d6ea796ee12ae5aedf8"]["sensors"]["setpoint"] = 23.5
m_adam_cooling["ad4838d7d35c4d6ea796ee12ae5aedf8"]["sensors"]["temperature"] = 25.8
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"]["thermostat"]["setpoint"] = 23.5
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"]["sensors"]["temperature"] = 25.8
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"]["select_schedule"] = "off"
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"]["control_state"] = "cooling"
m_adam_cooling["f2bf9048bef64cc5b6d5110154e33c81"]["climate_mode"] = "cool"

# Add new key available
Expand All @@ -105,39 +97,23 @@ def json_writer(manual_name: str, output: dict) -> None:
m_adam_cooling.pop("854f8a9b0e7e425db97f1f110e1ce4b3")

# Go for 1772
m_adam_cooling["1772a4ea304041adb83f357b751341ff"]["sensors"][
"temperature"
] = 21.6
m_adam_cooling["1772a4ea304041adb83f357b751341ff"]["sensors"]["temperature"] = 21.6

# Go for e2f4
m_adam_cooling["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"][
"setpoint"
] = 23.5
m_adam_cooling["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"][
"temperature"
] = 23.9
m_adam_cooling["f871b8c4d63549319221e294e4f88074"]["thermostat"][
"setpoint"
] = 25.0
m_adam_cooling["f871b8c4d63549319221e294e4f88074"]["sensors"][
"temperature"
] = 23.9
m_adam_cooling["f871b8c4d63549319221e294e4f88074"][
"control_state"
] = "cooling"
m_adam_cooling["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"]["setpoint"] = 23.5
m_adam_cooling["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"]["temperature"] = 23.9
m_adam_cooling["f871b8c4d63549319221e294e4f88074"]["thermostat"]["setpoint"] = 25.0
m_adam_cooling["f871b8c4d63549319221e294e4f88074"]["sensors"]["temperature"] = 23.9
m_adam_cooling["f871b8c4d63549319221e294e4f88074"]["control_state"] = "cooling"
m_adam_cooling["f871b8c4d63549319221e294e4f88074"]["climate_mode"] = "auto"


# Go for da22
m_adam_cooling["da224107914542988a88561b4452b0f6"][
"select_regulation_mode"
] = "cooling"
m_adam_cooling["da224107914542988a88561b4452b0f6"][
"regulation_modes"
].append("cooling")
m_adam_cooling["da224107914542988a88561b4452b0f6"]["sensors"][
"outdoor_temperature"
] = 29.65
m_adam_cooling["da224107914542988a88561b4452b0f6"]["select_regulation_mode"] = "cooling"
m_adam_cooling["da224107914542988a88561b4452b0f6"]["regulation_modes"].append("cooling")
m_adam_cooling["da224107914542988a88561b4452b0f6"]["sensors"]["outdoor_temperature"] = (
29.65
)

# Go for 056e
m_adam_cooling["056ee145a816487eaa69243c3280f8bf"]["binary_sensors"][
Expand All @@ -146,12 +122,12 @@ def json_writer(manual_name: str, output: dict) -> None:
m_adam_cooling["056ee145a816487eaa69243c3280f8bf"]["binary_sensors"][
"heating_state"
] = False
m_adam_cooling["056ee145a816487eaa69243c3280f8bf"]["binary_sensors"][
"flame_state"
] = False
m_adam_cooling["056ee145a816487eaa69243c3280f8bf"]["sensors"][
"water_temperature"
] = 19.0
m_adam_cooling["056ee145a816487eaa69243c3280f8bf"]["binary_sensors"]["flame_state"] = (
False
)
m_adam_cooling["056ee145a816487eaa69243c3280f8bf"]["sensors"]["water_temperature"] = (
19.0
)
m_adam_cooling["056ee145a816487eaa69243c3280f8bf"]["sensors"][
"intended_boiler_temperature"
] = 17.5
Expand All @@ -163,56 +139,30 @@ def json_writer(manual_name: str, output: dict) -> None:
m_adam_heating = m_adam_cooling.copy()

# Correct setpoint for "ad4838d7d35c4d6ea796ee12ae5aedf8"
m_adam_heating["f2bf9048bef64cc5b6d5110154e33c81"]["thermostat"][
"setpoint"
] = 20.0
m_adam_heating["ad4838d7d35c4d6ea796ee12ae5aedf8"]["sensors"][
"setpoint"
] = 20.0
m_adam_heating["f2bf9048bef64cc5b6d5110154e33c81"]["sensors"][
"temperature"
] = 19.1
m_adam_heating["ad4838d7d35c4d6ea796ee12ae5aedf8"]["sensors"][
"temperature"
] = 19.1
m_adam_heating["f2bf9048bef64cc5b6d5110154e33c81"]["thermostat"]["setpoint"] = 20.0
m_adam_heating["ad4838d7d35c4d6ea796ee12ae5aedf8"]["sensors"]["setpoint"] = 20.0
m_adam_heating["f2bf9048bef64cc5b6d5110154e33c81"]["sensors"]["temperature"] = 19.1
m_adam_heating["ad4838d7d35c4d6ea796ee12ae5aedf8"]["sensors"]["temperature"] = 19.1

m_adam_heating["f2bf9048bef64cc5b6d5110154e33c81"][
"control_state"
] = "preheating"
m_adam_heating["f2bf9048bef64cc5b6d5110154e33c81"]["control_state"] = "preheating"
m_adam_heating["f2bf9048bef64cc5b6d5110154e33c81"]["climate_mode"] = "heat"

# Go for 1772
m_adam_heating["1772a4ea304041adb83f357b751341ff"]["sensors"][
"temperature"
] = 18.6
m_adam_heating["1772a4ea304041adb83f357b751341ff"]["sensors"]["temperature"] = 18.6
# Related zone temperature is set below

# Go for e2f4
m_adam_heating["f871b8c4d63549319221e294e4f88074"]["thermostat"][
"setpoint"
] = 15.0
m_adam_heating["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"][
"setpoint"
] = 15.0
m_adam_heating["f871b8c4d63549319221e294e4f88074"]["sensors"][
"temperature"
] = 17.9
m_adam_heating["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"][
"temperature"
] = 17.9
m_adam_heating["f871b8c4d63549319221e294e4f88074"]["thermostat"]["setpoint"] = 15.0
m_adam_heating["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"]["setpoint"] = 15.0
m_adam_heating["f871b8c4d63549319221e294e4f88074"]["sensors"]["temperature"] = 17.9
m_adam_heating["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"]["temperature"] = 17.9

m_adam_heating["f871b8c4d63549319221e294e4f88074"]["climate_mode"] = "auto"
m_adam_heating["f871b8c4d63549319221e294e4f88074"][
"control_state"
] = "idle"
m_adam_heating["f871b8c4d63549319221e294e4f88074"]["control_state"] = "idle"

# Go for da22
m_adam_heating["da224107914542988a88561b4452b0f6"][
"select_regulation_mode"
] = "heating"
m_adam_heating["da224107914542988a88561b4452b0f6"][
"regulation_modes"
].remove("cooling")
m_adam_heating["da224107914542988a88561b4452b0f6"]["select_regulation_mode"] = "heating"
m_adam_heating["da224107914542988a88561b4452b0f6"]["regulation_modes"].remove("cooling")
m_adam_heating["da224107914542988a88561b4452b0f6"]["sensors"][
"outdoor_temperature"
] = -1.25
Expand All @@ -224,12 +174,12 @@ def json_writer(manual_name: str, output: dict) -> None:
m_adam_heating["056ee145a816487eaa69243c3280f8bf"]["binary_sensors"][
"heating_state"
] = True
m_adam_heating["056ee145a816487eaa69243c3280f8bf"]["binary_sensors"][
"flame_state"
] = False
m_adam_heating["056ee145a816487eaa69243c3280f8bf"]["sensors"][
"water_temperature"
] = 37.0
m_adam_heating["056ee145a816487eaa69243c3280f8bf"]["binary_sensors"]["flame_state"] = (
False
)
m_adam_heating["056ee145a816487eaa69243c3280f8bf"]["sensors"]["water_temperature"] = (
37.0
)
m_adam_heating["056ee145a816487eaa69243c3280f8bf"]["sensors"][
"intended_boiler_temperature"
] = 38.1
Expand All @@ -252,18 +202,18 @@ def json_writer(manual_name: str, output: dict) -> None:
m_anna_heatpump_cooling = base.copy()

# Go for 1cbf
m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"][
"model"
] = "Generic heater/cooler"
m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"][
"binary_sensors"
]["cooling_enabled"] = True
m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"][
"binary_sensors"
]["heating_state"] = False
m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"][
"binary_sensors"
]["cooling_state"] = True
m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"]["model"] = (
"Generic heater/cooler"
)
m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"]["binary_sensors"][
"cooling_enabled"
] = True
m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"]["binary_sensors"][
"heating_state"
] = False
m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"]["binary_sensors"][
"cooling_state"
] = True

m_anna_heatpump_cooling["1cbf783bb11e4a7c8a6843dee3a86927"]["sensors"][
"water_temperature"
Expand Down Expand Up @@ -344,9 +294,9 @@ def json_writer(manual_name: str, output: dict) -> None:

# Go for 3cb7
m_anna_heatpump_idle["3cb70739631c4d17a86b8b12e8a5161b"]["control_state"] = "idle"
m_anna_heatpump_idle["3cb70739631c4d17a86b8b12e8a5161b"]["sensors"][
"temperature"
] = 23.0
m_anna_heatpump_idle["3cb70739631c4d17a86b8b12e8a5161b"]["sensors"]["temperature"] = (
23.0
)
m_anna_heatpump_idle["3cb70739631c4d17a86b8b12e8a5161b"]["sensors"][
"cooling_activation_outdoor_temperature"
] = 25.0
Expand Down
27 changes: 0 additions & 27 deletions scripts/python-venv.sh

This file was deleted.

Loading
Loading