Skip to content

Commit de8162a

Browse files
committed
Debug
1 parent 144391d commit de8162a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

plugwise_usb/messages/properties.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
import binascii
44
from datetime import UTC, date, datetime, time, timedelta
5+
import logging
56
import struct
67
from typing import Any
78

89
from ..constants import LOGADDR_OFFSET, PLUGWISE_EPOCH, UTF8
910
from ..exceptions import MessageError
1011
from ..helpers.util import int_to_uint
1112

13+
_LOGGER = logging.getLogger(__name__)
1214

1315
class BaseType:
1416
"""Generic single instance property."""
@@ -227,6 +229,7 @@ def __init__(self, year: int = 0, month: int = 1, minutes: int = 0) -> None:
227229

228230
def deserialize(self, val: bytes) -> None:
229231
"""Convert data into datetime based on timestamp with offset to Y2k."""
232+
_LOGGER.debug("HOI val: %s", val)
230233
if val == b"FFFFFFFF":
231234
self._value = None
232235
else:

plugwise_usb/messages/responses.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from datetime import datetime
66
from enum import Enum
7+
import logging
78
from typing import Any, Final
89

910
from ..api import NodeType
@@ -41,6 +42,8 @@
4142
SWITCH_GROUP_RESPONSE_SEQ_ID,
4243
)
4344

45+
_LOGGER = logging.getLogger(__name__)
46+
4447

4548
class StickResponseType(bytes, Enum):
4649
"""Response message types for stick."""
@@ -190,6 +193,7 @@ def deserialize(self, response: bytes, has_footer: bool = True) -> None:
190193
self._mac = response[:16]
191194
response = response[16:]
192195
if len(response) > 0:
196+
_LOGGER.debug("HOI response: %s", response)
193197
try:
194198
response = self._parse_params(response)
195199
except ValueError as ve:
@@ -203,8 +207,12 @@ def deserialize(self, response: bytes, has_footer: bool = True) -> None:
203207
def _parse_params(self, response: bytes) -> bytes:
204208
for param in self._params:
205209
my_val = response[: len(param)]
210+
_LOGGER.debug("HOI param: %s", param)
211+
_LOGGER.debug("HOI my_val: %s", my_val)
206212
param.deserialize(my_val)
207213
response = response[len(my_val) :]
214+
_LOGGER.debug("HOI response: %s", response)
215+
208216
return response
209217

210218
def __len__(self) -> int:

0 commit comments

Comments
 (0)