Does anyone have any experience connecting to the lucid's api they use with the mobile app through something like postman or something similar? I am hoping to use this to create a teslascope/teslafi alternative for lucid
Lucid has not released an official API.Does anyone have any experience connecting to the lucid's api they use with the mobile app through something like postman or something similar? I am hoping to use this to create a teslascope/teslafi alternative for lucid
Maybe @borski ?So I know nothing is official, but the way all the original Tesla implementations worked (such as teslascope) wasn't technically through an official api either; the endpoints were originally discovered by checking outgoing network calls on the app I believe and was wondering if anyone has attempted anything like this before
No idea what you are talking about or what any of this means(only have basic python knowledge lol) but it sounds really useful! What will Joe's app be doing?I meant to post a new thread about this, but you did it for me, so thanks.
Python bindings for the REST API here: https://github.com/nshp/python-lucidmotors
There is a branch called grpc-api where @segbrk has reversed most of the grpc api: https://github.com/nshp/python-lucidmotors/tree/grpc-api
And there is a working Home Assistant integration, through HACS: https://github.com/borski/ha-lucidmotors
There is a discord where we are working on this here: https://discord.gg/uWa5nSxr
Please only join if you can contribute. We do not want it to turn into a spam server or general interest server.
What’s presently left is filling out the rest of the protobuf stuff (assigning the numbers to states, etc.) and then ensuring HA uses the grpc api, which seems to be a superset of the REST API. My guess is REST is old, grpc is new. It *could* be the other way around, and the REST api hasn’t caught up to feature parity yet, but either way the library supports both at the moment.
@joec has been working on a new iOS app using the reversed bindings, but it’s very early and not for release - the rest I’ll leave to him.
PRs and issues welcome! Please post them to GitHub.
If you run into issues, please checkout python-lucidmotors, generate an anonymized test case from your data, using `python examples/anonymize_login_response.py`. This will log in, remove identifying information from the API response, and write it to a file. Check the file to ensure anonymization actually worked, then you can share it as a test case.
To make a long story short: the Lucid mobile app talks to the internet via an API. Every time you tap a button, or every time it loads any information, it isn’t talking directly to your car. It talks to some Lucid servers on the internet which then, in turn, talk to your car, and report back those servers who then report back to you.No idea what you are talking about or what any of this means(only have basic python knowledge lol) but it sounds really useful! What will Joe's app be doing?
I knew what APIs and bindings were, just not the protobuf, states, etc. All of that is nonsense to me lol.To make a long story short: the Lucid mobile app talks to the internet via an API. Every time you tap a button, or every time it loads any information, it isn’t talking directly to your car. It talks to some Lucid servers on the internet which then, in turn, talk to your car, and report back those servers who then report back to you.
Those APIs can exist in many forms, but are generally well-defined - meaning that if you can snoop on or listen to the communication, or find out by reverse engineering the app how it communicates, you can pretend to be the mobile app and get the info yourself, or issue commands.
That is what the Python bindings (a fancy word for “the thing that does the communication, but in Python”) do. You ask it for info or give it commands, and then it talks to Lucid’s servers, and so on. As a result, now Home Assistant can talk to your car, and you can set up any automations you want - with the full power of all your other home integrations.
For example, you could have your garage open/close when you arrive/leave. I don’t have to wait for Lucid to implement that, and neither do you.
You could have it automatically set the temperature in the car 10 minutes before you have an event on your calendar with a location that isn’t at home.
And so on.
As for @joec’s mobile app, it’s not my place to say. But I can tell you what *my* goal would be - not to re-implement the whole mobile app, but just give quick access to various commands and info.
The Lucid first party app does a lot - mobile key, support, analytics, and so on.
A simpler app that only does a few important things would thus be likely much faster.
You can only do what's available from Lucid's servers. And only then what can be gleaned via lots of sleuthing.I knew what APIs and bindings were, just not the protobuf, states, etc. All of that is nonsense to me lol.
And that does sound very useful.. you previously mentioned turning off all headlights for example! Perhaps some stuff could be knocked off the mega polls for features?
Also, would it be possible to turn on heated seats remotely for example?
States are just that. For example, the POWER_STATE may be something like AWAKE, ASLEEP, WINK, or LIVE_CHARGE or LIVE_UPDATE. But underneath they’re like 1 or 2 or 3 or 4 or 5. Figuring out which is which is what I’m talking about.I knew what APIs and bindings were, just not the protobuf, states, etc. All of that is nonsense to me lol.
And that does sound very useful.. you previously mentioned turning off all headlights for example! Perhaps some stuff could be knocked off the mega polls for features?
Also, would it be possible to turn on heated seats remotely for example?
This single-handedly convinced me to finally update my HA setup so I can use this integration. Thank you for the amazing work!And there is a working Home Assistant integration, through HACS: https://github.com/borski/ha-lucidmotors
Feel free to join the discord if you're interested. Now that most of the work is done, we'd love feedback; just bear in mind we have day jobsThis single-handedly convinced me to finally update my HA setup so I can use this integration. Thank you for the amazing work!
Oh, I get it. Why do you think my HA isn't updated every month? And my home server UPS has needed new batteries for 3 years? And my curtains aren't fully automated yet? And my closet is full of unopened Lego sets? And the aluminum I bought to make hub covers for my Touring is still sitting next to my lathe?Feel free to join the discord if you're interested. Now that most of the work is done, we'd love feedback; just bear in mind we have day jobs
It’s okay, I had half a lamp for about six monthsOh, I get it. Why do you think my HA isn't updated every month? And my home server UPS has needed new batteries for 3 years? And my curtains aren't fully automated yet? And my closet is full of unopened Lego sets? And the aluminum I bought to make hub covers for my Touring is still sitting next to my lathe?
No a programmer but can hack together code that sorta works. Tried vehicle_info then test_all_actions on Mac. Killed test_all_actions after a minute or two since I didn't see anything on console. Looked outside and saw doors unlocked, frunk and trunk opened and the fan blowing. Thanks @borski for putting this together and sharing! Is there a special discord server for this?