casambi-bt-revamped 0.3.0.dev2__py3-none-any.whl → 0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- CasambiBt/_client.py +12 -4
- {casambi_bt_revamped-0.3.0.dev2.dist-info → casambi_bt_revamped-0.3.1.dist-info}/METADATA +1 -1
- {casambi_bt_revamped-0.3.0.dev2.dist-info → casambi_bt_revamped-0.3.1.dist-info}/RECORD +6 -6
- {casambi_bt_revamped-0.3.0.dev2.dist-info → casambi_bt_revamped-0.3.1.dist-info}/WHEEL +0 -0
- {casambi_bt_revamped-0.3.0.dev2.dist-info → casambi_bt_revamped-0.3.1.dist-info}/licenses/LICENSE +0 -0
- {casambi_bt_revamped-0.3.0.dev2.dist-info → casambi_bt_revamped-0.3.1.dist-info}/top_level.txt +0 -0
CasambiBt/_client.py
CHANGED
|
@@ -414,6 +414,9 @@ class CasambiClient:
|
|
|
414
414
|
) -> None:
|
|
415
415
|
# TODO: Check incoming counter and direction flag
|
|
416
416
|
self._inPacketCount += 1
|
|
417
|
+
|
|
418
|
+
# Store raw encrypted packet for reference
|
|
419
|
+
raw_packet = data[:]
|
|
417
420
|
|
|
418
421
|
try:
|
|
419
422
|
data = self._encryptor.decryptAndVerify(data, data[:4] + self._nonce[4:])
|
|
@@ -428,7 +431,7 @@ class CasambiClient:
|
|
|
428
431
|
if packetType == IncommingPacketType.UnitState:
|
|
429
432
|
self._parseUnitStates(data[1:])
|
|
430
433
|
elif packetType == IncommingPacketType.SwitchEvent:
|
|
431
|
-
self._parseSwitchEvent(data[1:])
|
|
434
|
+
self._parseSwitchEvent(data[1:], self._inPacketCount, raw_packet)
|
|
432
435
|
elif packetType == IncommingPacketType.NetworkConfig:
|
|
433
436
|
# We don't care about the config the network thinks it has.
|
|
434
437
|
# We assume that cloud config and local config match.
|
|
@@ -482,7 +485,7 @@ class CasambiClient:
|
|
|
482
485
|
f"Ran out of data while parsing unit state! Remaining data {b2a(data[oldPos:])} in {b2a(data)}."
|
|
483
486
|
)
|
|
484
487
|
|
|
485
|
-
def _parseSwitchEvent(self, data: bytes) -> None:
|
|
488
|
+
def _parseSwitchEvent(self, data: bytes, packet_seq: int = None, raw_packet: bytes = None) -> None:
|
|
486
489
|
"""Parse switch event packet which contains multiple message types"""
|
|
487
490
|
self._logger.info(f"Parsing incoming switch event packet... Data: {b2a(data)}")
|
|
488
491
|
|
|
@@ -513,7 +516,7 @@ class CasambiClient:
|
|
|
513
516
|
|
|
514
517
|
# Process based on message type
|
|
515
518
|
if message_type == 0x08 or message_type == 0x10: # Switch/button events
|
|
516
|
-
self._processSwitchMessage(message_type, flags, parameter, payload, data, oldPos)
|
|
519
|
+
self._processSwitchMessage(message_type, flags, parameter, payload, data, oldPos, packet_seq, raw_packet)
|
|
517
520
|
else:
|
|
518
521
|
# Log other message types for now
|
|
519
522
|
self._logger.debug(
|
|
@@ -529,7 +532,7 @@ class CasambiClient:
|
|
|
529
532
|
f"Remaining data {b2a(data[oldPos:])} in {b2a(data)}."
|
|
530
533
|
)
|
|
531
534
|
|
|
532
|
-
def _processSwitchMessage(self, message_type: int, flags: int, button: int, payload: bytes, full_data: bytes, start_pos: int) -> None:
|
|
535
|
+
def _processSwitchMessage(self, message_type: int, flags: int, button: int, payload: bytes, full_data: bytes, start_pos: int, packet_seq: int = None, raw_packet: bytes = None) -> None:
|
|
533
536
|
"""Process a switch/button message (types 0x08 or 0x10)"""
|
|
534
537
|
if not payload:
|
|
535
538
|
self._logger.error("Switch message has empty payload")
|
|
@@ -585,6 +588,11 @@ class CasambiClient:
|
|
|
585
588
|
"event": event_string,
|
|
586
589
|
"flags": flags,
|
|
587
590
|
"extra_data": extra_data,
|
|
591
|
+
"packet_sequence": packet_seq,
|
|
592
|
+
"raw_packet": b2a(raw_packet) if raw_packet else None,
|
|
593
|
+
"decrypted_data": b2a(full_data),
|
|
594
|
+
"message_position": start_pos,
|
|
595
|
+
"payload_hex": b2a(payload),
|
|
588
596
|
},
|
|
589
597
|
)
|
|
590
598
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
CasambiBt/__init__.py,sha256=TW445xSu5PV3TyMjJfwaA1JoWvQQ8LXhZgGdDTfWf3s,302
|
|
2
2
|
CasambiBt/_cache.py,sha256=KZ2xbiHAHXUPa8Gw_75Nw9NL4QSY_sTWHbyYXYUDaB0,3865
|
|
3
3
|
CasambiBt/_casambi.py,sha256=gLLkhEcObgapqTx5Mk7WRClyG29UyfZYZCCIhhOg4H4,23101
|
|
4
|
-
CasambiBt/_client.py,sha256=
|
|
4
|
+
CasambiBt/_client.py,sha256=RW1rJneopzJx3TmcC1dpY3yfZnTcYg3qTeid6ddQJvI,23614
|
|
5
5
|
CasambiBt/_constants.py,sha256=_AxkG7Btxl4VeS6mO7GJW5Kc9dFs3s9sDmtJ83ZEKNw,359
|
|
6
6
|
CasambiBt/_discover.py,sha256=H7HpiFYIy9ELvmPXXd_ck-5O5invJf15dDIRk-vO5IE,1696
|
|
7
7
|
CasambiBt/_encryption.py,sha256=CLcoOOrggQqhJbnr_emBnEnkizpWDvb_0yFnitq4_FM,3831
|
|
@@ -11,8 +11,8 @@ CasambiBt/_operation.py,sha256=-BuC1Bvtg-G-zSN_b_0JMvXdHZaR6LbTw0S425jg96c,842
|
|
|
11
11
|
CasambiBt/_unit.py,sha256=YiQWoHmMDWHHo4XAjtW8rHsBqIqpmp9MVdv1Mbu2xw4,17043
|
|
12
12
|
CasambiBt/errors.py,sha256=0JgDjaKlAKDes0poWzA8nrTUYQ8qdNfBb8dfaqqzCRA,1664
|
|
13
13
|
CasambiBt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
casambi_bt_revamped-0.3.
|
|
15
|
-
casambi_bt_revamped-0.3.
|
|
16
|
-
casambi_bt_revamped-0.3.
|
|
17
|
-
casambi_bt_revamped-0.3.
|
|
18
|
-
casambi_bt_revamped-0.3.
|
|
14
|
+
casambi_bt_revamped-0.3.1.dist-info/licenses/LICENSE,sha256=TAIIitFxpxEDi6Iju7foW4TDQmWvC-IhLVLhl67jKmQ,11341
|
|
15
|
+
casambi_bt_revamped-0.3.1.dist-info/METADATA,sha256=Sc9Q12DSn4dAo8x_LFnF3Vtnk1r5HkaDfsziG-rcmIA,3044
|
|
16
|
+
casambi_bt_revamped-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
casambi_bt_revamped-0.3.1.dist-info/top_level.txt,sha256=uNbqLjtecFosoFzpGAC89-5icikWODKI8rOjbi8v_sA,10
|
|
18
|
+
casambi_bt_revamped-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
{casambi_bt_revamped-0.3.0.dev2.dist-info → casambi_bt_revamped-0.3.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{casambi_bt_revamped-0.3.0.dev2.dist-info → casambi_bt_revamped-0.3.1.dist-info}/top_level.txt
RENAMED
|
File without changes
|