kaedenbrinkman / PyTeslaBLE

Python interface for connecting to Tesla vehicles directly using the BLE API
33 stars 2 forks source link

RuntimeError: The requested operation is not supported. #5

Open gopkg-dev opened 1 year ago

gopkg-dev commented 1 year ago

` Enter choice: 8 Connecting to vehicle... Tap your keycard on the center console 2023-06-02 20:51:42.716 Python[45762:1776268] Characteristic does not support write without response. Traceback (most recent call last): File "/Users/karen/PycharmProjects/pythonProject/main.py", line 28, in vehicle.whitelist() File "/Users/karen/PycharmProjects/pythonProject/venv/lib/python3.11/site-packages/pyteslable/TeslaBLE.py", line 233, in whitelist self.__peripheral.write_command( RuntimeError: The requested operation is not supported.

Process finished with exit code 1 `

kaedenbrinkman commented 1 year ago

What platform are you using?

Some people on macOS reported that they needed to change write_command to write_request in the library:

https://github.com/kaedenbrinkman/PyTeslaBLE/issues/3#issuecomment-1269301150

Let me know if this works for you, I'll try to test it myself this weekend and will update the library if it works.

gopkg-dev commented 1 year ago

@kaedenbrinkman

Thank you for your help.

There are no error messages, but when I place the card in the car and after click the confirm button, the program appears to be stuck and does not respond.

Scanning for vehicles...
Please select a vehicle:
0: iPhone 13 Pro Max [.....]
1: Apple Watch [.....]
2: Sxxxxxxxxxxxx [.....]
3: [.....]
4: [.....]
5: [.....]
6: Sxxxxxxxxxxxx [.....]
7:  [.....]
Enter choice: 6
Connecting to vehicle...
Tap your keycard on the center console
Sent whitelist request

Process finished with exit code 137 (interrupted by signal 9: SIGKILL)

It has remained in this state ever since.

kaedenbrinkman commented 1 year ago

Could you check that your version of macOS is on SimpleBLE's supported platforms list?

gopkg-dev commented 1 year ago

macOS Ventura 13.4

It looks like it is supported.

edi commented 1 year ago

@kaedenbrinkman I can confirm the same issue. I'm on macOS 13.4.1, and have ran the example provided. It gets stuck on Sent whitelist request.

I can also confirm it did send the request to the car, as I did "confirm" the key creation on the car's display. Here's some debugging logs.

➜  test /opt/homebrew/bin/python3 /Users/edi/Desktop/test/ble.py
Connecting to vehicle...
Tap your keycard on the center console
Sent whitelist request
commandStatus {
  operationStatus: OPERATIONSTATUS_WAIT
  signedMessageStatus {
  }
}

Waiting for keycard to be tapped...
authenticationRequest {
  requestedLevel: AUTHENTICATION_LEVEL_DRIVE
}

libc++abi: terminating due to uncaught exception of type pybind11::error_already_set: Exception: Car's ephermeral key not yet loaded!

At:
  /opt/homebrew/lib/python3.11/site-packages/pyteslable/TeslaBLE.py(365): signedToMsg
  /opt/homebrew/lib/python3.11/site-packages/pyteslable/TeslaBLE.py(515): authenticationRequestMsg
  /opt/homebrew/lib/python3.11/site-packages/pyteslable/TeslaBLE.py(305): authenticationRequest
  /opt/homebrew/lib/python3.11/site-packages/pyteslable/TeslaBLE.py(434): handle_notify
  /opt/homebrew/lib/python3.11/site-packages/pyteslable/TeslaBLE.py(302): handle_notify
  /opt/homebrew/lib/python3.11/site-packages/pyteslable/TeslaBLE.py(225): <lambda>

[1]    45571 abort      /opt/homebrew/bin/python3 /Users/edi/Desktop/test/ble.py