Open Lineflyer opened 1 year ago
Here is more info from Tesla about how to get location data with newer vehicle software: https://developer.tesla.com/docs/fleet-api#announcements-amp-api-changelog
Edit: Seems you can still get it, but need to include location_data
explicitly in your request. I guess this could be an easy fix?
https://developer.tesla.com/docs/fleet-api#vehicle_data
Yes, please consider this request x2. Many automations relying on the location data are now broken with the latest Tesla update.
Here's a different application and an example of how they have altered their code to suit the new endpoints -
https://github.com/ngardiner/TWCManager/commit/adbf1cbb01fed07381db10321faed0603a4ac16c
Here's a flow to pull the new endpoints for location. Note the field 'your id here' is the value of the very first object if you place a debug node on node-red-contrib-tesla. The objects user_id and vehicle_id won't work.
@ChutneyMary
Thanks, this is very helpful and works as an interim solution.
How about the access token? I guess it will be invalid after some hours as there is no refresh included.
Additionally I do now run into problems as I now need to issue two requests (one with node-red-contrib-tesla and this one) and the server starts throttling (error 408). Need to find a clever timing solution for that (or include all other endpoints into your nodes instead).
I have the same problem with throttling with two requests running. It's a choice between losing automations that rely on location data versus all the other data... Think I'll have to manually open the garage door for awhile...1st world problems! I think the Access Code only has an 8 hour validity, so not even a good interim solution. There's a lot of code hanging off node-red-contrib-tesla. Hopefully @onokje can come to the rescue soon!
1st world problems!
Indeed.
Hopefully @onokje can come to the rescue soon!
I think your node if a good PoC for a possible fix in node-red-contrib-tesla. It might even start to have a look at the source and see if I can provide a PR, but I am not really familiar with JS and not familiar with node red syntax. So chances are high, that I will not be successful.
I use my version @gaphi/node-red-contrib-tesla and do not have any problem for several years.
I just had to add the location_data endpoint since recent Tesla update in my automation (my garage door still open automatically), without any change in this node-red-contrib-tesla code.
Probably a good starting point for the update you want to provide 😊
Le mar. 14 nov. 2023 à 13:53, Lineflyer @.***> a écrit :
1st world problems!
Indeed.
Hopefully @onokje https://github.com/onokje can come to the rescue soon!
I think your node if a good PoC for a possible fix in node-red-contrib-tesla. It might even start to have a look at the source and see if I can provide a PR, but I am not really familiar with JS and not familiar with node red syntax. So chances are high, that I will not be successful.
— Reply to this email directly, view it on GitHub https://github.com/onokje/node-red-contrib-tesla/issues/69#issuecomment-1810150674, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNWNPRACQZOWAQI7IYRSTYENSWHAVCNFSM6AAAAAA7JDMJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJQGE2TANRXGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hello @GaPhi. I tried installing your version using Manage Palette in Node-Red. Unfortunately it has a boxed 'conflict' message. It won't allow installation. It also says the version is 2 years and 2 months ago (1.0.6-0)?
Is this the latest branch you have tweaked with the new endpoint? Or have I misunderstood something?
Is this the latest branch you have tweaked with the new endpoint? Or have I misunderstood something?
@GaPhi I would have the same question as I did not see any related commit in your fork?
No need to commit anything, API has not changed enough :
msg = { vehicleID: 'XXX', command: 'vehicleData', commandArgs: { endpoints: ['charge_state', 'location_data', ...any others...], let_sleep: true } }
I just had to add the 'location_data' new endpoint.
Maybe the dependencies should be refreshed to be more up-to-date for your environment... It depends to my @gaphi/teslajs fork too to support commandArgs (if I remember what I did 2 or 3 years ago)
Le mar. 14 nov. 2023 à 15:37, Lineflyer @.***> a écrit :
Is this the latest branch you have tweaked with the new endpoint? Or have I misunderstood something?
@GaPhi https://github.com/GaPhi I would have the same question as I did not see any related commit in your fork?
— Reply to this email directly, view it on GitHub https://github.com/onokje/node-red-contrib-tesla/issues/69#issuecomment-1810346230, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNWNIC4ZJWJVAV77JXRLTYEN62LAVCNFSM6AAAAAA7JDMJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJQGM2DMMRTGA . You are receiving this because you were mentioned.Message ID: @.***>
I just had to add the 'location_data' new endpoint.
And you use these msg.* objects as input into the node-red-contrib-tesla node?
Yes
Le mar. 14 nov. 2023 à 19:14, Lineflyer @.***> a écrit :
I just had to add the 'location_data' new endpoint.
And you use these msg.* objects as input into the node-red-contrib-tesla node?
— Reply to this email directly, view it on GitHub https://github.com/onokje/node-red-contrib-tesla/issues/69#issuecomment-1810864334, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNWNLSYTCEWKDJKMSWUVDYEOYJPAVCNFSM6AAAAAA7JDMJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJQHA3DIMZTGQ . You are receiving this because you were mentioned.Message ID: @.***>
@GaPhi Do you know the correct name of all the endpoints normally contained in a node-red-contrib-tesla "overall" request? I guess that's the reason why I can't get it working.
Here are the command arguments I use
{"endpoints":["charge_state","climate_state","closures_state","drive_state","gui_settings","location_state","location_data","vehicle_config","vehicle_state","vehicle_data_combo"],"let_sleep":true}
Le jeu. 16 nov. 2023 à 22:06, Lineflyer @.***> a écrit :
@GaPhi https://github.com/GaPhi Do you know the correct name of all the endpoints normally contained in a node-red-contrib-tesla "overall" request? I guess that's the reason why I can't get it working.
— Reply to this email directly, view it on GitHub https://github.com/onokje/node-red-contrib-tesla/issues/69#issuecomment-1815315572, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNWNMYXBNQWYCVM2W7IZLYEZ56NAVCNFSM6AAAAAA7JDMJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJVGMYTKNJXGI . You are receiving this because you were mentioned.Message ID: @.***>
I use my version @gaphi/node-red-contrib-tesla and do not have any problem for several years. I just had to add the location_data endpoint since recent Tesla update in my automation (my garage door still open automatically), without any change in this node-red-contrib-tesla code. Probably a good starting point for the update you want to provide 😊
I'm not able to install npm packages on my node red device. I've tried installing @gaphi/node-red-contrib-tesla via Node Red pallette but get the following error:
2023-11-18T14:51:41.362Z Install : @gaphi/node-red-contrib-tesla 1.0.6-0
2023-11-18T14:51:41.674Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict @gaphi/node-red-contrib-tesla@1.0.6-0 2023-11-18T14:51:51.990Z [err] npm WARN config production Use
--omit=dev
instead. 2023-11-18T14:52:14.476Z [err] npm 2023-11-18T14:52:14.478Z [err]
2023-11-18T14:52:14.479Z [err] ERR! code 2023-11-18T14:52:14.480Z [err] ETARGET 2023-11-18T14:52:14.508Z [err] npm 2023-11-18T14:52:14.509Z [err] ERR! notarget 2023-11-18T14:52:14.511Z [err] No matching version found for @gaphi/node-red-contrib-tesla@1.0.6-0. 2023-11-18T14:52:14.514Z [err] npm ERR! notarget In most cases you or one of your dependencies are requesting 2023-11-18T14:52:14.514Z [err] npm 2023-11-18T14:52:14.517Z [err] ERR! notarget a package version that doesn't exist. 2023-11-18T14:52:14.540Z [err] 2023-11-18T14:52:14.540Z [err] npm ERR! 2023-11-18T14:52:14.543Z [err] A complete log of this run can be found in: /data/home/nodered/.npm/_logs/2023-11-18T14_51_50_637Z-debug-0.log 2023-11-18T14:52:14.593Z rc=1
@GaPhi could you please fix the version in the Node Red pallete? @onokje it would be nice to merge the pull request of @GaPhi
Here are the command arguments I use...
Somehow I can't get it working. Should it work to just feed the node-red-contrib-tesla with this custom parameters or do I need a newer version (e.g. from your fork)?
The version is 1.0.6-0 in your log which is not the latest version...
I have forced an update @.***/node-red-contrib-tesla> which should now become 2.0.1-9 This can take some time to propagate but I hope it will be available soon in the palette manager ! ;-)
Le sam. 18 nov. 2023 à 16:12, Bart @.***> a écrit :
I use my version @gaphi/node-red-contrib-tesla and do not have any problem for several years. I just had to add the location_data endpoint since recent Tesla update in my automation (my garage door still open automatically), without any change in this node-red-contrib-tesla code. Probably a good starting point for the update you want to provide 😊
I'm not able to install npm packages on my node red device. I've tried installing @gaphi/node-red-contrib-tesla via Node Red pallette but get the following error:
2023-11-18T14:51:41.362Z Install : @gaphi/node-red-contrib-tesla 1.0.6-0
2023-11-18T14:51:41.674Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict @@. 2023-11-18T14:51:51.990Z [err] npm WARN config production Use --omit=dev instead. 2023-11-18T14:52:14.476Z [err] npm 2023-11-18T14:52:14.478Z [err] 2023-11-18T14:52:14.479Z [err] ERR! code 2023-11-18T14:52:14.480Z [err] ETARGET 2023-11-18T14:52:14.508Z [err] npm 2023-11-18T14:52:14.509Z [err] ERR! notarget 2023-11-18T14:52:14.511Z [err] No matching version found for @@. 2023-11-18T14:52:14.514Z [err] npm ERR! notarget In most cases you or one of your dependencies are requesting 2023-11-18T14:52:14.514Z [err] npm 2023-11-18T14:52:14.517Z [err] ERR! notarget a package version that doesn't exist. 2023-11-18T14:52:14.540Z [err] 2023-11-18T14:52:14.540Z [err] npm ERR! 2023-11-18T14:52:14.543Z [err] A complete log of this run can be found in: /data/home/nodered/.npm/_logs/2023-11-18T14_51_50_637Z-debug-0.log 2023-11-18T14:52:14.593Z rc=1
@GaPhi https://github.com/GaPhi could you please fix the version in the Node Red pallete? @onokje https://github.com/onokje it would be nice to merge the pull request of @GaPhi https://github.com/GaPhi
— Reply to this email directly, view it on GitHub https://github.com/onokje/node-red-contrib-tesla/issues/69#issuecomment-1817534229, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNWNKAB3ZROFFOSJZVWDDYFDF63AVCNFSM6AAAAAA7JDMJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGUZTIMRSHE . You are receiving this because you were mentioned.Message ID: @.***>
The palette doesn't get the updated version. I've installed package version 2.0.1-9 using the tgz file.
I've configured the API key and I'm able to get a list of vehicles.
I can't get any other get command to work. (haven't tried a post) I keep getting the
error [error] [tesla-api:Get status] TypeError: Cannot read properties of undefined (reading '0')
I've modified my live tesla.js file with extra console.log statements and found the cause of the issue is in the wakeup method line 53. I've put the whole method in a try catch block and this is the error it produces:
TypeError: Cannot read properties of undefined (reading '0') @40000000655d094a02a95fa4 at /data/home/nodered/.node-red/node_modules/@gaphi/teslajs/teslajs.js:612:33 @40000000655d094a02a96f44 at Request._callback (/data/home/nodered/.node-red/node_modules/@gaphi/teslajs/teslajs.js:512:13) @40000000655d094a02a97ee4 at self.callback (/data/home/nodered/.node-red/node_modules/request/request.js:185:22) @40000000655d094a02a98e84 at Request.emit (node:events:517:28) @40000000655d094a02a99654 at Request.<anonymous> (/data/home/nodered/.node-red/node_modules/request/request.js:1154:10) @40000000655d094a02abbd1c at Request.emit (node:events:517:28) @40000000655d094a02abc8d4 at IncomingMessage.<anonymous> (/data/home/nodered/.node-red/node_modules/request/request.js:1076:12) @40000000655d094a02abdc5c at Object.onceWrapper (node:events:631:28) @40000000655d094a02abe42c at IncomingMessage.emit (node:events:529:35) @40000000655d094a02abefe4 at endReadableNT (node:internal/streams/readable:1368:12)
So it seems the cause is in the teslajs package. @GaPhi do you know what might cause this?
I let you test it now. ;-) => release 2.0.1-10
Le mar. 21 nov. 2023 à 21:03, Bart @.***> a écrit :
The palette doesn't get the updated version. I've installed package version 2.0.1-9 using the tgz file. I've configured the API key and I'm able to get a list of vehicles. I can't get any other get command to work. (haven't tried a post) I keep getting the error [error] [tesla-api:Get status] TypeError: Cannot read properties of undefined (reading '0') I've modified my live tesla.js file with extra console.log statements and found the cause of the issue is in the wakeup method line 53. I've put the whole method in a try catch block and this is the error it produces: TypeError: Cannot read properties of undefined (reading '0') @40000000655d094a02a95fa4 at @./teslajs/teslajs.js:612:33 @40000000655d094a02a96f44 at Request._callback @./teslajs/teslajs.js:512:13) @40000000655d094a02a97ee4 at self.callback (/data/home/nodered/.node-red/node_modules/request/request.js:185:22) @40000000655d094a02a98e84 at Request.emit (node:events:517:28) @40000000655d094a02a99654 at Request.
(/data/home/nodered/.node-red/node_modules/request/request.js:1154:10) @40000000655d094a02abbd1c at Request.emit (node:events:517:28) @40000000655d094a02abc8d4 at IncomingMessage. (/data/home/nodered/.node-red/node_modules/request/request.js:1076:12) @40000000655d094a02abdc5c at Object.onceWrapper (node:events:631:28) @40000000655d094a02abe42c at IncomingMessage.emit (node:events:529:35) @40000000655d094a02abefe4 at endReadableNT (node:internal/streams/readable:1368:12) So it seems the cause is in the teslajs package. @GaPhi https://github.com/GaPhi do you know what might cause this?
— Reply to this email directly, view it on GitHub https://github.com/onokje/node-red-contrib-tesla/issues/69#issuecomment-1821599924, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNWNPSSAOI36ZEEYPPW3LYFUCJLAVCNFSM6AAAAAA7JDMJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRRGU4TSOJSGQ . You are receiving this because you were mentioned.Message ID: @.***>
I have found a workaround that works for this node.
From:
get_command(options, "vehicle_data", callback);
To:
get_command(options, "vehicle_data?endpoints=location_data%3Bcharge_state%3Bclimate_state%3Bclosures_state%3Bdrive_state%3Bgui_settings%3Bvehicle_config%3Bvehicle_state", callback);
Thanks @osvedman . Confirmed working for me!
@GaPhi hi, just hijacking this thread. i installed your code into my nodered. and it works well, but only for the first car. i can select whatever i want.. it just takes my first car. any clue?
I only have one Tesla... but the code seems to support more : const vehicleID = msg.vehicleID ?? config.vehicleID;
Then, if you set msg.vehicleID (not in the payload), then another car should be selected I suppose, otherwise it is the one selected in the node configuration.
hmm the pull down doesnt work for me.. allways my first car as output. Question, since im new to node.red since 4h ;-)
payload i use template and select in the pulldown:
@cycl0ne
You can also follow the workaround posted by @osvedman to modify the tesla.js
file. That for sure will work with multiple vehicles.
@cycl0ne You can also follow the workaround posted by @osvedman to modify the
tesla.js
file. That for sure will work with multiple vehicles.
ah sorry the whole "multiple cars" wont work with me.. i just ask for the model: i allways get model 3, but my 2nd (wife) is a model y. i was just hijacking this thread because of GaPhi has no issue tracker on his github repo and saw hes answering here.. ;-)
but since you all have no 2nd car... wont help me :( .. this is why i try to understand template and sending maybe the vehicleID per template to the node.
i will open an own issue now.. i tried all kinds of stuff, but it allways falls back to the first car.
The attached file works perfectly. I have made the modification mentioned above and added the functionality to also send the latitude and longitude of the vehicle, as I was using it and needed it. Remember to rename the file to Teslajs.js Regards. teslajs.txt
Hello @venomako. I've installed the node-red-contrib-tesla via the Palette Manager. Where do you find the Teslajs.js file to replace with the one you provided? I've installed Node-Red on a 'standard' Raspberry Pi image. I've also read that you need to provide your own domain to work with the new Tesla authentication process. How does that link into the functionality of node-red-contrib-tesla? Sorry for the basic questions but I'm really missing having a functioning method to get Tesla vehicle data.
The attached file works perfectly. I have made the modification mentioned above and added the functionality to also send the latitude and longitude of the vehicle, as I was using it and needed it. Remember to rename the file to Teslajs.js Regards. teslajs.txt
What model of Tesla are you connecting to? I am asking because AFAICS the API used by this node is deprecated and no longer working at least for Models 3 and Y. Are you maybe connecting to an older model X or S?
Hello @venomako. I've installed the node-red-contrib-tesla via the Palette Manager. Where do you find the Teslajs.js file to replace with the one you provided? I've installed Node-Red on a 'standard' Raspberry Pi image. I've also read that you need to provide your own domain to work with the new Tesla authentication process. How does that link into the functionality of node-red-contrib-tesla? Sorry for the basic questions but I'm really missing having a functioning method to get Tesla vehicle data.
IMHO it should not work, despite changes made by @venomako at least for the current models. As you describe: You need to be an official listed partner with its domain to make use of the new API....a modified node should not help...
I deinstalled this node meanwhile and decided to use the service of Teslemetry.com, which provide the exact same data as with the old API via their partner-licensed API access.
After my vehicle (Model 3) upgraded to 2023.38.6 I noticed, that
drive_state
object is now missing the elementslatitude
andlongitude
. So you are no longer able to use the current vehicle location in Node Red.According to what I read here it might be related to a change in the API respectively, that location information was already moved to new/other endpoints (might be related to #67)?