PatrickE94 / pycalima

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

Error from Bluetooth stack #1

Closed christian-ek closed 6 years ago

christian-ek commented 7 years ago

Hello, I was hoping somebody had done this. Thank you for the work you've put in it!

I am trying to be able to start the boost through this but I am unsuccessful.

This is the error I am getting.

>>> fan.setBoostMode(1, 100, 60)
[Calima] [W] 0x30 = 0164003c00
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/repo/pycalima/pycalima/Calima.py", line 169, in setBoostMode
    self._writeHandle(0x30, pack('<BHH', on, speed, seconds))
  File "/home/pi/repo/pycalima/pycalima/Calima.py", line 72, in _writeHandle
    self.conn.writeCharacteristic(handle, val, withResponse=True)
  File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 502, in writeCharacteristic
    return self._getResp('wr')
  File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 369, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 332, in _waitResp
    raise BTLEException(BTLEException.COMM_ERROR, "Error from Bluetooth stack (%s)" % errcode)
bluepy.btle.BTLEException: Error from Bluetooth stack (comerr)
PatrickE94 commented 7 years ago

According to the bluepy documentation the exception is thrown due to permission errors. Ensure you are sending the pincode as a string.

Directly after creating the element the pincode is shown as transmitted.

>>> fan = Calima("58:2B:DB:XX:XX:XX", "01234567")
[Calima] [W] 0x18 = 87d61200

Decode it as hex and verify it matches your pincode (without any prefixing zeroes). Remember endianness (the above should be decoded as 0012d687).

I'm getting exactly the same error if I try to use setBoostMode while using an incorrect pincode.

Cheers!

christian-ek commented 7 years ago

Hi again, True that this error was because of an faulty pin code!

Now I am getting the command through. Although it does not start the boost instead the fan came to an halt. Am I running the command correctly for starting boost mode 100% for 60s? fan.setBoostMode(1, 100, 60)

PatrickE94 commented 7 years ago

The speed is not given in percentage but in RPM, 2500 being 100% and must be given in a multiple of 25.

Hope that gets it going!