pmdroid / tesla-ble Goto Github PK
View Code? Open in Web Editor NEWThis CPP library facilitates direct communication with Tesla vehicles via the BLE API.
License: MIT License
This CPP library facilitates direct communication with Tesla vehicles via the BLE API.
License: MIT License
I'm trying to use your library in ESPHome, unfortunately, the mbedtls
version included in the Espressif Arduino framework (/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls
) seems to be 2.x, which is not compatible:
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::LoadPrivateKey(const uint8_t*, size_t)':
src/esphome/components/tesla_ble/client.cpp:92:65: error: too many arguments to function 'int mbedtls_pk_parse_key(mbedtls_pk_context*, const unsigned char*, size_t, const unsigned char*, size_t)'
password, 0, mbedtls_ctr_drbg_random, &this->drbg_context_);
^
In file included from src/esphome/components/tesla_ble/client.h:10,
from src/esphome/components/tesla_ble/client.cpp:1:
/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/pk.h:712:5: note: declared here
int mbedtls_pk_parse_key( mbedtls_pk_context *ctx,
^~~~~~~~~~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::GeneratePublicKey()':
src/esphome/components/tesla_ble/client.cpp:131:51: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_grp'
&mbedtls_pk_ec(this->private_key_context_)->private_grp,
^~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:132:51: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_Q'
&mbedtls_pk_ec(this->private_key_context_)->private_Q,
^~~~~~~~~
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::GenerateKeyId()':
src/esphome/components/tesla_ble/client.cpp:153:54: error: void value not ignored as it ought to be
int return_code = mbedtls_sha1_starts(&sha1_context);
^
src/esphome/components/tesla_ble/client.cpp:160:59: error: void value not ignored as it ought to be
this->public_key_size_);
^
src/esphome/components/tesla_ble/client.cpp:167:58: error: void value not ignored as it ought to be
return_code = mbedtls_sha1_finish(&sha1_context, buffer);
^
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::LoadTeslaKey(const uint8_t*, size_t)':
src/esphome/components/tesla_ble/client.cpp:193:62: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_grp'
int return_code = mbedtls_ecp_group_load(&this->tesla_key_.private_grp,
^~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:201:25: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_grp'
&this->tesla_key_.private_grp, &this->tesla_key_.private_Q,
^~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:201:56: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_Q'
&this->tesla_key_.private_grp, &this->tesla_key_.private_Q,
^~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:241:50: error: void value not ignored as it ought to be
return_code = mbedtls_sha1_starts(&sha1_context);
^
src/esphome/components/tesla_ble/client.cpp:248:62: error: void value not ignored as it ought to be
temp_shared_secret_length);
^
src/esphome/components/tesla_ble/client.cpp:254:72: error: void value not ignored as it ought to be
return_code = mbedtls_sha1_finish(&sha1_context, this->shared_secret_);
^
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::Encrypt(unsigned char*, size_t, unsigned char*, size_t, size_t*, unsigned char*)':
src/esphome/components/tesla_ble/client.cpp:297:49: error: too few arguments to function 'int mbedtls_gcm_starts(mbedtls_gcm_context*, int, const unsigned char*, size_t, const unsigned char*, size_t)'
sizeof(nonce));
^
In file included from src/esphome/components/tesla_ble/client.cpp:7:
/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/gcm.h:244:5: note: declared here
int mbedtls_gcm_starts( mbedtls_gcm_context *ctx,
^~~~~~~~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:304:40: error: invalid conversion from 'unsigned char*' to 'size_t' {aka 'unsigned int'} [-fpermissive]
mbedtls_gcm_update(&aes_context, input_buffer, input_buffer_length,
^~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:304:54: error: invalid conversion from 'size_t' {aka 'unsigned int'} to 'const unsigned char*' [-fpermissive]
mbedtls_gcm_update(&aes_context, input_buffer, input_buffer_length,
^~~~~~~~~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:305:76: error: too many arguments to function 'int mbedtls_gcm_update(mbedtls_gcm_context*, size_t, const unsigned char*, unsigned char*)'
output_buffer, output_buffer_length, output_length);
^
In file included from src/esphome/components/tesla_ble/client.cpp:7:
/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/gcm.h:276:5: note: declared here
int mbedtls_gcm_update( mbedtls_gcm_context *ctx,
^~~~~~~~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:317:69: error: too many arguments to function 'int mbedtls_gcm_finish(mbedtls_gcm_context*, unsigned char*, size_t)'
&finish_buffer_length, signature_buffer, 16);
^
In file included from src/esphome/components/tesla_ble/client.cpp:7:
/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/gcm.h:297:5: note: declared here
int mbedtls_gcm_finish( mbedtls_gcm_context *ctx,
^~~~~~~~~~~~~~~~~~
*** [.pioenvs/watchy-01/src/esphome/components/tesla_ble/client.cpp.o] Error 1
I quickly had a look at it, but some changes do not seem that trivial to me. Any chance you could make the library compatible with both versions (2.x and 3.x)? I doubt adding 3.x on top of 2.x in my work tree would do any good.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.