Closed Danne1981 closed 6 years ago
from pycalima import Calima fan =Calima('58:2B:DB:00:F0:EF', '16185135') [Calima] [W] 0x18 = 2ff7f600 fan.scanCharacteristics() [0x3] READ = 50617820426f7261 [0x5] READ = 0000 [0x7] READ = 900190010400e803 [0xb] READ = 3030303030303000 [0xd] READ = 3130 [0xf] READ = 30312e303000 [0x11] READ = 30312e303200 [0x13] READ = 30312e3035 [0x15] READ = 504158 [0x18] WRITE [0x1a] READ = 01 [0x1c] READ WRITE = 5476c3a474747374756761000000000000000000 [0x1e] READ = 582bdb00f0ef [0x21] READ = 00 [0x23] READ = 420055007c00000000000000 [0x26] READ = 01 [0x28] READ WRITE = 01 [0x2a] READ WRITE = 600934080000 [0x2c] READ WRITE = 01030103 [0x2e] READ WRITE = 000f [0x30] READ WRITE = 1900003408 [0x32] READ WRITE = 0000000000 [0x34] READ WRITE = 0000 [0x36] READ WRITE = 02 [0x38] READ WRITE = 02062a0a [0x3a] READ WRITE = 0017000600 [0x3c] READ WRITE = 0101 [0x3e] READ WRITE = 00
This is the output from fan.scanCharacteristics(), in an effort to get the script to work with a Pax Bora.
It seems as firmware version 1.5 inserted a characteristic at 0x1e and effectively shifting characteristic addresses. I've updated the scanCharacteristics
function to show UUID of each characteristic. Would you mind printing the new output from scanCharacteristics
? Maybe we can switch from handle to UUID when requesting characteristics.
NEW [0x1e] READ = 582bdb00f0ef
PREV 0x1f [0x21] READ = 00
PREV 0x21 [0x23] READ = 420055007c00000000000000
PREV 0x24 [0x26] READ = 01
PREV 0x26 [0x28] READ WRITE = 01
PREV 0x28 [0x2a] READ WRITE = 600934080000
PREV 0x2a [0x2c] READ WRITE = 01030103
PREV 0x2c [0x2e] READ WRITE = 000f
PREV 0x2e [0x30] READ WRITE = 1900003408
PREV 0x30 [0x32] READ WRITE = 0000000000
PREV 0x32 [0x34] READ WRITE = 0000
PREV 0x34 [0x36] READ WRITE = 02
PREV 0x36 [0x38] READ WRITE = 02062a0a
PREV 0x38 [0x3a] READ WRITE = 0017000600
PREV 0x3a [0x3c] READ WRITE = 0101
NEW [0x3e] READ WRITE = 00
fan =Calima('58:2B:DB:00:F0:EF', '16185135') [Calima] [W] 0x18 = 2ff7f600 fan.scanCharacteristics() [0x3] Device Name (READ ) = (8) 50617820426f7261 [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) 5476c3a474747374756761000000000000000000 [0x1e] 638ff62c-3823-4e0f-8179-1695c46ee8af (READ ) = (6) 582bdb00f0ef [0x21] 25a824ad-3021-4de9-9f2f-60cf8d17bded (READ ) = (1) 00 [0x23] 528b80e8-c47a-4c0a-bdf1-916a7748f412 (READ ) = (12) 130058000c00750802000000 [0x26] 63b04af9-24c0-4e5d-a69c-94eb9c5707b4 (READ ) = (1) 01 [0x28] 90cabcd1-bcda-4167-85d8-16dcd8ab6a6b (READ WRITE ) = (1) 01 [0x2a] 1488a757-35bc-4ec8-9a6b-9ecf1502778e (READ WRITE ) = (6) 600934080000 [0x2c] e782e131-6ce1-4191-a8db-f4304d7610f1 (READ WRITE ) = (4) 01030103 [0x2e] 49c616de-02b1-4b67-b237-90f66793a6f2 (READ WRITE ) = (2) 000f [0x30] a22eae12-dba8-49f3-9c69-1721dcff1d96 (READ WRITE ) = (5) 1900003408 [0x32] 118c949c-28c8-4139-b0b3-36657fd055a9 (READ WRITE ) = (5) 0000000000 [0x34] 8b850c04-dc18-44d2-9501-7662d65ba36e (READ WRITE ) = (2) 0000 [0x36] f508408a-508b-41c6-aa57-61d1fd0d5c39 (READ WRITE ) = (1) 02 [0x38] 6dec478e-ae0b-4186-9d82-13dda03c0682 (READ WRITE ) = (4) 02130105 [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
I changed the PAX specific functions to use UUID as handles. This seems to work for me, give it a try!
Just download the UUID branch and do the same as you did with the master branch!
fan.getState() Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python3.4/dist-packages/pycalima/Calima.py", line 128, in getState v = unpack('<4HBHB', self._readUUID("528b80e8-c47a-4c0a-bdf1-916a7748f412 ")) File "/usr/local/lib/python3.4/dist-packages/pycalima/Calima.py", line 62, in _readUUID val = self.conn.getCharacteristics(uuid=uuid)[0].read() File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 466, in getCharacteristics cmd += ' %s' % UUID(uuid) File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 68, in init self.binVal = binascii.a2b_hex(val.encode('utf-8')) binascii.Error: Odd-length string
I'm sorry! There slipped in a space at the end of the readUUID call which effectively gave it the wrong UUID! I've updated yet again.
fan.getState() [Calima] [R] 528b80e8-c47a-4c0a-bdf1-916a7748f412 = 1e005c003500000000000000 FanState(Humidity=30, Temp=23.0, Light=53, RPM=0, BoostActive=False, Mode=0, Unknown=0, Unknown2=0)
Success!!! I owe you a lunch at some fancy place man! ;)
pi@raspberrypi:~ $ ./pax [Calima] [W] 0x18 = 2ff7f600 [Calima] [R] 0x3 = 50617820426f7261 Device Name: Pax Bora [Calima] [R] 0xd = 3130 Model Number: 10 [Calima] [R] 0xb = 3030303030303000 Serial Number: 0000000 [Calima] [R] 0xf = 30312e303000 Hardware Revision: 01.00 [Calima] [R] 0x11 = 30312e303200 Firmware Revision: 01.02 [Calima] [R] 0x13 = 30312e3035 Software Revision: 01.05 [Calima] [R] 0x15 = 504158 Manufacturer: PAX [Calima] [R] 0x1c = 5476c3a474747374756761000000000000000000 Traceback (most recent call last): File "/usr/local/bin/calima", line 10, in
load_entry_point('Calima==1.0', 'console_scripts', 'calima')()
File "/usr/local/lib/python3.4/dist-packages/pycalima/cmdline.py", line 67, in main
print("Alias: ", fan.getAlias())
File "/usr/local/lib/python3.4/dist-packages/pycalima/Calima.py", line 106, in getAlias
return self._readHandle(0x1c).decode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)