Skip to content

Commit c885f95

Browse files
committed
Debug
1 parent 98604ef commit c885f95

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

plugwise/smile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
DOMAIN_OBJECTS,
1717
GATEWAY_REBOOT,
1818
LOCATIONS,
19+
LOGGER,
1920
MAX_SETPOINT,
2021
MIN_SETPOINT,
2122
NONE,
@@ -236,6 +237,9 @@ async def set_select(
236237
self, key: str, loc_id: str, option: str, state: str | None
237238
) -> None:
238239
"""Set a dhw/gateway/regulation mode or the thermostat schedule option."""
240+
LOGGER.debug(
241+
"HOI set_select called with: %s, %s, %s, %s", key, loc_id, option, state
242+
)
239243
match key:
240244
case "select_dhw_mode" | "dhw_mode":
241245
state = STATE_ON if option == "comfort" else STATE_OFF
@@ -258,6 +262,9 @@ async def set_dhw_mode(
258262
if mode not in self._dhw_allowed_modes:
259263
raise PlugwiseError("Plugwise: invalid dhw mode.")
260264

265+
LOGGER.debug(
266+
"HOI set_dhw_mode called with: %s, %s, %s, %s", key, appl_id, length, mode
267+
)
261268
match length:
262269
# Devices with the domestic_hot_water_comfort switch
263270
case 2:
@@ -420,6 +427,13 @@ async def set_switch_state(
420427
For switch-locks, sets the lock state using a different data format.
421428
Return the requested state when successful, the current state otherwise.
422429
"""
430+
LOGGER.debug(
431+
"HOI set_switch_state called with: %s, %s, %s, %s",
432+
appl_id,
433+
members,
434+
model,
435+
state,
436+
)
423437
model_type = cast(SwitchType, model)
424438
try:
425439
current_state = self.gw_entities[appl_id]["switches"][model_type]
@@ -449,11 +463,13 @@ async def set_switch_state(
449463
for item in found:
450464
# multiple types of e.g. toggle_functionality present
451465
if (sw_type := item.find("type")) is not None:
466+
LOGGER.debug("HOI switch_type: %s", sw_type.text)
452467
if sw_type.text == switch.act_type:
453468
switch_id = item.get("id")
454469
break
455470
else: # actuators with a single item like relay_functionality
456471
switch_id = item.get("id")
472+
LOGGER.debug("HOI switch_id: %s", switch_id)
457473

458474
uri = f"{APPLIANCES};id={appl_id}/{switch.device};id={switch_id}"
459475
if model == "relay":

scripts/tests_and_coverage.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ set +u
5252

5353
if [ -z "${GITHUB_ACTIONS}" ] || [ "$1" == "test_and_coverage" ] ; then
5454
# Python tests (rerun with debug if failures)
55-
PYTHONPATH=$(pwd) pytest -qx tests/ --cov='.' --no-cov-on-fail --cov-report term-missing || PYTHONPATH=$(pwd) pytest -xrpP --log-level debug tests/
55+
# PYTHONPATH=$(pwd) pytest -qx tests/ --cov='.' --no-cov-on-fail --cov-report term-missing ||
56+
PYTHONPATH=$(pwd) pytest -xrpP --log-level debug tests/
5657
handle_command_error "python code testing"
5758
fi
5859

0 commit comments

Comments
 (0)