ble-mqtt-bridge icon indicating copy to clipboard operation
ble-mqtt-bridge copied to clipboard

writeCharacteristic ends with error

Open animavitis opened this issue 7 years ago • 10 comments

Reading data from my comet blue is working fine, but i cant set anything. All writecharacteristic actions ends with this error:

 Connected to a5:80:bc:ca:66:b2
  Command {'action': 'writeCharacteristic', 'handle': 71, 'value': [64, 226, 1, 0]}
    Write b'@\xe2\x01\x00' to 71
Error: Error from Bluetooth stack (comerr)

After downgrading bluepy to version 1.0.5, 1.1.0, 1.1.2 same logs appear.

can someone help?

animavitis avatar Jan 20 '18 12:01 animavitis

Your thermostat is not accepting the PIN code. Which firmware do you have? Can you try upgrading the firmware using the official app: https://play.google.com/store/apps/details?id=com.delan.app.germanybluetooth

seidler2547 avatar Jan 20 '18 21:01 seidler2547

My Comet Bleu is branded by LIDL. Vesion COBL0133 revision 0.0.10 & no new firmware avaible in official app. PIN from example is 123456, but it was not working for default 0 PIN too. I found this CLI tool https://github.com/xrucka/cometblue is working great, but im too dump to find why.

thx for all help :)

animavitis avatar Jan 21 '18 08:01 animavitis

Something might have changed with the PIN entry. Try removing this line: https://github.com/seidler2547/home-assistant-cc/blob/acf87dfa1e540d2a90b04c78e0ca382b9fb24c27/custom_components/climate/sygonix.py#L326 (it says "Try PIN 000000 first). That might help.

My firmware is COBL0126.

seidler2547 avatar Jan 21 '18 08:01 seidler2547

sadly still same error

ble/a5:80:bc:ca:66:b2/commands b'{"tries": 1, "commands": [{"action": "writeCharacteristic", "handle": 71, "value": [64, 226, 1, 0]}, {"action": "writeCharacteristic", "handle": 63, "value": [128, 22, 128, 128, 128, 128, 128]}, {"action": "writeCharacteristic", "handle": 29, "value": [38, 18, 21, 1, 18]}, {"action": "readCharacteristic", "handle": 61}, {"action": "readCharacteristic", "handle": 63}, {"action": "readCharacteristic", "handle": 65}, {"action": "readCharacteristic", "handle": 20}, {"action": "readCharacteristic", "handle": 22}, {"action": "readCharacteristic", "handle": 24}, {"action": "readCharacteristic", "handle": 26}]}' using ble/a5:80:bc:ca:66:b2/commands len=3 Connecting to a5:80:bc:ca:66:b2 Waiting... Waiting... Waiting... Waiting... Connected to a5:80:bc:ca:66:b2 Command {'action': 'writeCharacteristic', 'handle': 71, 'value': [64, 226, 1, 0]} Write b'@\xe2\x01\x00' to 71 Error: Error from Bluetooth stack (comerr)

Installed Wireshark on my PC and start analyzing HCI snoop logs.. then SUCCESS :)
I found that in my firmware PIN is HANDLE 72 (0x0048) and to change temperature is used HANDLE 61 (0x003d) ..... now need to find rest

animavitis avatar Jan 21 '18 17:01 animavitis

Can u give some clues how changing mode of Comet Blue is working? this is last thing that i need to find/fix

animavitis avatar Jan 21 '18 19:01 animavitis

Interesting. I will try and see if I can upgrade mine to this firmware (haven't touched them in two years or so). But it might take a while.

seidler2547 avatar Jan 21 '18 21:01 seidler2547

Ok, I could not update my firmware, but I see that the other tool uses GUIDs instead of the handles. I think I will change/implement this and then it would hopefully work.

seidler2547 avatar Jan 27 '18 19:01 seidler2547

@animavitis please try with the new version of this bridge and of the climate component.

seidler2547 avatar Jan 27 '18 21:01 seidler2547

  • current stare reading is not always works as should, from time to time i get current temp as 64 C (its look like after try of setting temp i get wrong temp reading)
  • changing target temp is not working, but changing operational mode is OK

animavitis avatar Jan 28 '18 19:01 animavitis

That is something I've seen as well with my thermostats.

If one is using GUIDs for access, they are the same for varying firmware versions. However, they're totally slow, so writing a value and then subsequently reading it will overwhelm the thermostat.

That's the reason why I implemented both handle and GUID configuration in #8, and let handles take priority.

Edit: Oh darn, just saw I dug up some really old issue... Sorry for the spam guys..^^

rikroe avatar Jul 18 '19 17:07 rikroe