PatrickE94 / pycalima

Python interface for Pax Calima Fan via Bluetooth LE
Apache License 2.0
43 stars 22 forks source link

unpack requires a bytes object of length 10 #8

Closed tactmaster closed 5 years ago

tactmaster commented 5 years ago

Hello

I get the error unpack requires a bytes object of length 10

import sys, time, datetime
from pycalima.Calima import Calima

fan = Calima("my mac", "mypin")
currentState = fan.getState()

Any ideas?

PatrickE94 commented 5 years ago

What fan dom you have? There seems to be some differences between firmware versions.

If possible, provide the output from running cmdline.py with the scan flag -s.

I.e. something like,

sudo python3 cmdline.py -m your_mac -p "your_pin" -s
tactmaster commented 5 years ago

I have had this python code working before btw.

without -s

Device Name: PAX Calima Model Number: 10 Serial Number: 0000000 Hardware Revision: 01.00 Firmware Revision: 01.02 Software Revision: 01.05 Manufacturer: PAX Alias: Traceback (most recent call last): File "cmdline.py", line 134, in main() File "cmdline.py", line 110, in main print("Unknown 24: ", fan.getUnknown24()) AttributeError: 'Calima' object has no attribute 'getUnknown24'

with -s

[0x3] Device Name (READ ) = (10) 5041582043616c696d61 [0x5] Appearance (READ ) = (2) 0000 [0x7] Peripheral Preferred Connection Parameters (READ ) = (8) 900190010400e803 [0xb] Serial Number String (READ ) = (8) 3030303030303000 [0xd] Model Number String (READ ) = (2) 3130 [0xf] Hardware Revision String (READ ) = (6) 30312e303000 [0x11] Firmware Revision String (READ ) = (6) 30312e303200 [0x13] Software Revision String (READ ) = (5) 30312e3035 [0x15] Manufacturer Name String (READ ) = (3) 504158 [0x18] 4cad343a-209a-40b7-b911-4d9b3df569b2 (WRITE ) [0x1a] d1ae6b70-ee12-4f6d-b166-d2063dcaffe1 (READ ) = (1) 01 [0x1c] b85fa07a-9382-4838-871c-81d045dcc2ff (READ WRITE ) = (20) 0000000000000000000000000000000000000000 [0x1e] 638ff62c-3823-4e0f-8179-1695c46ee8af (READ ) = (6) 582bdb013049 [0x21] 25a824ad-3021-4de9-9f2f-60cf8d17bded (READ ) = (1) 00 [0x23] 528b80e8-c47a-4c0a-bdf1-916a7748f412 (READ ) = (12) de0050002a00850601000000 [0x26] 63b04af9-24c0-4e5d-a69c-94eb9c5707b4 (READ ) = (1) 01 [0x28] 90cabcd1-bcda-4167-85d8-16dcd8ab6a6b (READ WRITE ) = (1) 00 [0x2a] 1488a757-35bc-4ec8-9a6b-9ecf1502778e (READ WRITE ) = (6) 590934088b06 [0x2c] e782e131-6ce1-4191-a8db-f4304d7610f1 (READ WRITE ) = (4) 01030002 [0x2e] 49c616de-02b1-4b67-b237-90f66793a6f2 (READ WRITE ) = (2) 003c [0x30] a22eae12-dba8-49f3-9c69-1721dcff1d96 (READ WRITE ) = (5) 1900003408 [0x32] 118c949c-28c8-4139-b0b3-36657fd055a9 (READ WRITE ) = (5) 0060090000 [0x34] 8b850c04-dc18-44d2-9501-7662d65ba36e (READ WRITE ) = (2) 0000 [0x36] f508408a-508b-41c6-aa57-61d1fd0d5c39 (READ WRITE ) = (1) 01 [0x38] 6dec478e-ae0b-4186-9d82-13dda03c0682 (READ WRITE ) = (4) 01091614 [0x3a] b5836b55-57bd-433e-8480-46e4993c5ac0 (READ WRITE ) = (5) 0017000600 [0x3c] faa49e09-a79c-4725-b197-bdc57c67dc32 (READ WRITE ) = (2) 0101 [0x3e] ff5f7c4f-2606-4c69-b360-15aaea58ad5f (READ WRITE ) = (1) 00

PatrickE94 commented 5 years ago

Thanks for the hint, you're correct. getState previously read 12 bytes (which the characteristic contains), but when going from handles to uuid a letter had disappeared from the unpack fmt. Do try the latest commits!

tactmaster commented 5 years ago

Sorry for forgot to get back you. That is great it working again very nicely. Thanks