WonkiDonk / homebridge-jlr-incontrol

Jaguar Land Rover InControl plugin for homebridge: https://github.com/nfarina/homebridge
16 stars 3 forks source link

2020 Range Rover Sport Preconditioning Not Working #13

Open Jack123uk opened 3 years ago

Jack123uk commented 3 years ago

Hi, Im wondering if you could help me regarding the Preconditioning function. Im able to lock/unlock the car perfectly with no issues, by either using HomeKit, or asking Siri by the commands. When trying to use the Preconditioning feature nothing happens at all, whether I use HomeKit and select "heat" or use the Siri commands from your example. Is this a known issue or should it be working fine. Also I want to add that is plugin is well needed. I downloaded it as soon as I bought the car. Great Work!

Thanks

william-cowell-mf commented 3 years ago

What version are you using? There was a defect that was fixed in v0.7

Jack123uk commented 3 years ago

Thankyou for your reply, I am using version 0.7.0. The lock and unlock works great, just can't get the preconditioning to work at all?

william-cowell-mf commented 3 years ago

Can you share your logs around the time you turn the preconditioning on, please? What version of iOS are you using?

Jack123uk commented 3 years ago

Of course am I ok to share my log on here, as it has sensitive information in the log. Im using an iPhone 12 pro max running iOS14.

jleesnow commented 3 years ago

I'd like to add that I have a similar experience. Just got a new '21 RR Sport and the lock/unlock works great but no response with Preconditioning. Does preconditioning apply to non-EV vehicles? In a quick scan of the jlrpy repo I see that preconditioning looks to be different than remote start...could that be why?

Jack123uk commented 3 years ago

Good to see it isn’t just me having this issue, yes I have a 70 plate too! I don’t think it should just work for EV vehicles, as within the app you can turn on the heating, the engine will start and start to precondition. So I would of thought it should work, but I’m no expect here...

jleesnow commented 3 years ago

[11/12/2020, 11:27:26] [Rover] Setting heating cooling state to 1 [11/12/2020, 11:27:26] [Rover] Starting preconditioning [11/12/2020, 11:27:26] [Rover] Setting CurrentHeatingCoolingState to 1 [11/12/2020, 11:27:26] [Rover] Current session valid until Sat, 12 Dec 2020 16:15:16 GMT [11/12/2020, 11:27:26] [Rover] Getting active session [11/12/2020, 11:27:26] [Rover] Getting command token ECC [11/12/2020, 11:27:27] [Rover] Sending preconditioning command [ { key: 'PRECONDITIONING', value: 'START' }, { key: 'TARGET_TEMPERATURE_CELSIUS', value: 283 } ] [11/12/2020, 11:27:29] [Rover] Setting heating cooling state to 1 [11/12/2020, 11:27:29] [Rover] Starting preconditioning [11/12/2020, 11:27:29] [Rover] Setting CurrentHeatingCoolingState to 1 [11/12/2020, 11:27:29] [Rover] Current session valid until Sat, 12 Dec 2020 16:15:16 GMT [11/12/2020, 11:27:29] [Rover] Getting active session [11/12/2020, 11:27:29] [Rover] Getting command token ECC [11/12/2020, 11:27:30] [Rover] Sending preconditioning command [ { key: 'PRECONDITIONING', value: 'START' }, { key: 'TARGET_TEMPERATURE_CELSIUS', value: 283 } ]

jleesnow commented 3 years ago

Right, what I meant was that in the jlrpy repo there is separate functionality for remote_engine_start and preconditioning_start. I'm wondering if the preconditioning in this plugin is focused on EV because you don't need to start the engine to precondition in EVs. I honestly have no idea though, I'll look through the code here to see if I can find out what the issue might be

william-cowell-mf commented 3 years ago

Ah, I see. Yes, in EVs you can just turn on the pre-conditioning without starting the engine. I'll add a button to start the engine. I'll also add functionality to start the engine before turning on pre-conditioning when disableEV is set to true.

I will need your help to test, though, since my vehicle is an EV and doesn't work in the same way.

I'll take a look this weekend and post version 0.8 with the change.

Jack123uk commented 3 years ago

Amazing thank you, yes no problem at all, I can test as soon as you post new version. Yes with the app on petrol/diesel cars it will start the engine and start eating the car for a limit of 30 minutes. Also I don’t know if it’s possible but would be great to be able to say “hey Siri heat the Range Rover to 24 degrees” not precondition. Thank you again look forward to the new version

jleesnow commented 3 years ago

@william-cowell-mf That's awesome, thanks for looking into this. I'd be happy to help test this out as well!

william-cowell-mf commented 3 years ago

Hey! Just writing this now. Could someone with a Range Rover do me a favour? Could you query the get vehicle status endpoint and attach the output here? Could I get two files: one with the engine running, with the engine stopped? I need the information to detect the engine state in order to build this.

Feel free to redact any sensitive information from the files.

Thanks in advance!

Jack123uk commented 3 years ago

@william-cowell-mf Awesome thank you for starting this.. I would love to help you with what you need but I’m unsure how to get that information for you? If you tell me the steps I can get this sorted for you! Thanks again

william-cowell-mf commented 3 years ago

You may find this complicated...

If you're on a Mac or Linux computer then you can do this in your terminal. I think it should work on Windows, too. If you struggle, then I'll need to get someone else to help. If someone offers to help asking for your username, password, VIN or any personal details then please don't share the details.

Please check the response that comes out at the end and remove any personally identifiable information. Please be very careful before posting the data online. If in doubt, you can email me. My address is on my profile.

1. Authenticate

curl --location --request POST 'https://ifas.prod-row.jlrmotor.com/ifas/jlr/tokens' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YXM6YXNwYXNz' \
--header 'X-Device-Id: {{deviceId}}' \
--header 'Connection: close' \
--data-raw '{"grant_type":"password","password":"{{password}}","username":"{{username}}"}'

You'll need to fill in:

That will give you some output that will look something like

{"access_token":"{{an access token}}","authorization_token":"{{an auth token}}","expires_in":"{{a number}}","refresh_token":"{{a refresh_token}}","token_type":"bearer"}

Copy that response. You will need some of the properties from it for the next request.

2. Register a device

curl --location --request POST 'https://ifop.prod-row.jlrmotor.com/ifop/jlr/users/{{username}}/clients' \
--header 'X-Device-Id: {{deviceId}}' \
--header 'Content-Type: application/json' \
--header 'Connection: close' \
--data-raw '{
    "access_token": "{{access_token}}",
    "authorization_token": "{{authorization_token}}",
    "expires_in": "{{expires_in}}",
    "deviceID":"{{deviceId}}"
}+'

You'll need to fill in:

There should be no output in the Terminal for this.

3. Log in user

curl --location --request GET 'https://if9.prod-row.jlrmotor.com/if9/jlr/users?loginName={{username}}' \
--header 'Accept: application/vnd.wirelesscar.ngtp.if9.User-v3+json' \
--header 'Content-Type: application/json' \
--header 'X-Device-Id: {{deviceId}}' \
--header 'Authorization: Bearer {{access_token}}'

You'll need to fill in:

This will give you some output something like:

{"contact":{"userPreferences":{"timeZone":"Europe/London","unitsOfMeasurement":"Miles Litres Celsius DistPerVol kWh kWhPer100Dist","dateFormat":"DD/MM/YYYY","language":"en_GB"},"firstName":"Joe","middleName":null,"lastName":"Bloggs","title":"Mr","gender":null,"birthday":null,"emailAddress":"someone@example.com","homePhone":null,"businessPhone":null,"mobilePhone":"07111222333"},"homeAddress":{"street":null,"city":"city","zipCode":"post code","stateProvince":"stateCounty","country":"GB","addressLine1":"Some address","addressLine2":null},"homeMarket":"GBR","userId":"userid","loginName":"someone@example.com","userType":null,"nextOfKin":null,"pin":null,"secureQuestion1":null,"secureQuestion2":null,"secureQuestion3":null,"secureAnswer1":null,"secureAnswer2":null,"secureAnswer3":null,"authCredentials":null,"marketingPrefsUpdatedAt":"2019-11-14T17:26:49+0000","marketingOffersAccepted":false,"vhsMessagesAccepted":true}

4. Get vehicle status

You'll need to do this twice; once with the engine running; once with the engine stopped.

curl --location --request GET 'https://if9.prod-row.jlrmotor.com/if9/jlr/vehicles/{{vin}}/status?includeInactive=true' \
--header 'Accept: application/vnd.ngtp.org.if9.healthstatus-v3+json' \
--header 'Content-Type: application/json' \
--header 'X-Device-Id: {{deviceId}}' \
--header 'Authorization: Bearer {{access_token}}'

You'll need to fill in:

This will output quite a bit of information. I need the full output, starting something like:

{"vehicleStatus":{"coreStatus":...}}

It'll be quite long... I need the full output all the way to the last closing brace }.

Jack123uk commented 3 years ago

Thanks for the heads up yes I would never share anything like that.. I will get that sorted for you give me half an hour hopefully lol..

Jack123uk commented 3 years ago

Yes may be a little above me this but I will keep trying, I keep getting an error with the url link curl: (3) URL using bad/illegal format or missing URL curl: (3) URL using bad/illegal format or missing URL curl: (3) nested brace in URL position 15:

william-cowell-mf commented 3 years ago

Which step? Step 1? What are you on, Windows or Mac or other? You could try removing the \ characters at the end of each line and entering it as a single line...

Jack123uk commented 3 years ago

Yes i'm using a Mac, ok I will try that, sorry your having to teach me how to suck eggs..

Jack123uk commented 3 years ago

Right i've sorted it, i'm on the last step :)

Jack123uk commented 3 years ago

@william-cowell-mf I can't seem to find your email address on your profile?

william-cowell-mf commented 3 years ago

It's my first name dot last name at Muscle Food dot com!!

WonkiDonk commented 3 years ago

An update on this: I've written the code, but having some issues with a regression. I'll post an update once I get some time to iron out the kinks!

jleesnow commented 3 years ago

I'm running through this right now to give you an extra set of output if you need it. Will send it over shortly

Jack123uk commented 3 years ago

An update on this: I've written the code, but having some issues with a regression. I'll post an update once I get some time to iron out the kinks!

Not a problem at all.. thanks

vgnome commented 3 years ago

Hey there! Also interested in this fix to remote-start/precondition non-EV vehicles. I have a Discovery Sport, and the lock/unlock functions are working great — very much looking forward to the above fix going out.

William, thanks for your work developing this plugin. The app-based InControl is so onerous in terms of clicks to actually get the car started, this is going to be a fantastic workaround.

namanadded commented 3 years ago

Hi. Looking forward forward for the update/fix too, lock/unlock are working on my 2016 Discovery Sport but remote start will the feature that I'll use. Thanks a lot for working on this plugin.

WonkiDonk commented 3 years ago

I'm re-writing the homebridge-jlr-incontrol plug-in. The current plug-in is a homebridge PlatformAccessory; I'm re-writing it as a PlatformPlugin. This will allow me to do more dynamic things, like detecting whether a vehicle is EV or ICE and offering appropriate capabilities.

As part of this, I've split the remote-part (jlr-remote) from the homebridge-part (homebridge-jlr-remote). The goal is to have the homebridge-jlr-remote just being a bridge between HomeKit and the jlr-remote

The remote-part, jlr-remote is ready for testing. I've tested all the generic JLR-remote features, as well as the EV-features. I need help testing the library with an Internal Combustion Engine (ICE) JLR-vehicle. Specifically, the preconditioning works differently between EVs and ICEs.

Does someone want to volunteer helping me to test this?

You'll need:

Any volunteers?

vgnome commented 3 years ago

Would be happy to volunteer. Just let me know how/when. On Feb 24, 2021, 7:30 AM -0700, William Cowell notifications@github.com, wrote:

I'm re-writing the homebridge-jlr-incontrol plug-in. The current plug-in is a homebridge PlatformAccessory; I'm re-writing it as a PlatformPlugin. This will allow me to do more dynamic things, like detecting whether a vehicle is EV or ICE and offering appropriate capabilities. As part of this, I've split the remote-part (jlr-remote) from the homebridge-part (homebridge-jlr-remote). The goal is to have the homebridge-jlr-remote just being a bridge between HomeKit and the jlr-remote The remote-part, jlr-remote is ready for testing. I've tested all the generic JLR-remote features, as well as the EV-features. I need help testing the library with an Internal Combustion Engine (ICE) JLR-vehicle. Specifically, the preconditioning works differently between EVs and ICEs. Does someone want to volunteer helping me to test this? You'll need:

• A JLR-vehicle with an active JLR Remote account • user name, password, VIN, PIN for the above account (you'll be running these tests on your local computer, so you won't need to share these details with me!!) • Computer with yarn/npm package manager • Zoom

Any volunteers? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Jack123uk commented 3 years ago

I'm re-writing the homebridge-jlr-incontrol plug-in. The current plug-in is a homebridge PlatformAccessory; I'm re-writing it as a PlatformPlugin. This will allow me to do more dynamic things, like detecting whether a vehicle is EV or ICE and offering appropriate capabilities.

As part of this, I've split the remote-part (jlr-remote) from the homebridge-part (homebridge-jlr-remote). The goal is to have the homebridge-jlr-remote just being a bridge between HomeKit and the jlr-remote

The remote-part, jlr-remote is ready for testing. I've tested all the generic JLR-remote features, as well as the EV-features. I need help testing the library with an Internal Combustion Engine (ICE) JLR-vehicle. Specifically, the preconditioning works differently between EVs and ICEs.

Does someone want to volunteer helping me to test this?

You'll need:

  • A JLR-vehicle with an active JLR Remote account
  • user name, password, VIN, PIN for the above account (you'll be running these tests on your local computer, so you won't need to share these details with me!!)
  • Computer with yarn/npm package manager
  • Zoom

Any volunteers?

If it’s like what I did last time for you, I can help you! Let me know.

WonkiDonk commented 3 years ago

Email me with some availability times (UK weekday evenings are best for me) and I'll send an invite for a Zoom call.

We'll need to:

  1. Download a branch from the jlr-remote repo
  2. Install package dependencies (either yarn or npm install)
  3. Write a quick script on your local machine with your credentials in (putting them in ./private folder, as Git will ignore on that report and not upload them to GitHub keeping them safe)
  4. Run the script
  5. Check a) for errors messages or b) if the air conditioning is running 🎉
WonkiDonk commented 3 years ago

Actually, I've written a script to do the test for you. You should be able to run the entire thing from Terminal.

Dependant upon whether you have yarn or npm, you'll need to execute one of the below sets of commands, substituting in:

The docs are really unclear on which pin, so let's try the one your use to log into the JLR Remote app. Failing that, we could try the last four digits of your VIN... 🤷‍♂️

yarn

git clone https://github.com/WonkiDonk/jlr-remote.git
cd jlr-remote
git checkout feature/internal-combustion-engine-services
yarn
tsc && node ./dist/test-ice.js [deviceId] [username] [password] [vin] [pin]

npm

git clone https://github.com/WonkiDonk/jlr-remote.git
cd jlr-remote
git checkout feature/internal-combustion-engine-services
npm install
tsc && node ./dist/test-ice.js [deviceId] [username] [password] [vin] [pin]
Jack123uk commented 3 years ago

Awesome I will run the test for you in the next few hours. 👍👍

Jack123uk commented 3 years ago

ok so the test script failed to start the preconditioning. Sorry how do you want me to send the logs/reports?

WonkiDonk commented 3 years ago

Email me

WonkiDonk commented 3 years ago

...Zoom call may be easier!?

vgnome commented 3 years ago

I'm similarly getting errors, tried both my incontrol app pin and the last four of my VIN as the pin argument. Emailing you the error log.

Jack123uk commented 3 years ago

...Zoom call may be easier!?

Yes sure, I can do anything after 7 o’clock.

WonkiDonk commented 3 years ago

Looks like it's starting the engine, but failing to set the temp. I had the wrong endpoint for setting the temperature. Could you try again. You'll need to pull down my latest changes:

git pull
tsc && node ./dist/test-ice.js [deviceId] [username] [password] [vin] [pin]

Please ensure the engine isn't running before running the command.

WonkiDonk commented 3 years ago

Or, if in doubt, just delete the jlr-remote folder from your computer and run all the original commands again!

william-cowell-mf commented 3 years ago

I've had confirmation that this is working. I'll integrate the jlr-remote with the new plug-in. Should take me around a week. I'll advise once it's ready!!

jagpreetbatth commented 3 years ago

Hello William,

Have you had a chance to integrate the JLR-remote with the new plug-in?

If so, how do I install the update version using terminal and Mac OS?

Thank you!

william-cowell-mf commented 3 years ago

The plug-in is still in progress. I'm using writing it as an opportunity to teach a student, so it is taking longer than it normally would. I'll post updates here when it is ready to download.

jesseking3 commented 3 years ago

I'm really looking forward to this, please let me know if you need any additional testing. I'm happy to help @william-cowell-mf

jagpreetbatth commented 3 years ago

Would love to see this as well, please let me know if I can help in anyway!

jleesnow commented 3 years ago

@WonkiDonk is this still happening?

william-cowell-mf commented 3 years ago

It is; it's just taking some time as I have a student and I'm using it as an opportunity to teach.

sebastienb commented 3 years ago

Following this thread. I'm interested in setting this up for a defender.

sebastienb commented 2 years ago

Please let me know if i can help with testing, I have a 2022 defender.

jleesnow commented 2 years ago

@WonkiDonk Any updates?

jagpreetbatth commented 2 years ago

@WonkiDonk Any updates?