Closed todd-xander closed 3 years ago
Hello,
I was not able to reproduce this issue. The only reason I can think of why this might be happening is because the variable 'tesla_vehicle_id'
might not exist. Could it be that you have a typo in the name? The app currently does not produce an error message when trying to set a variable that doesn't exist.
Hi @Waboodoo , thks for reply
I am sure that the vadiable is created before running the shortcut, and type the variable name correctly in script.
One more information, I've changed the actural number value for security. I could share it if helpful: 62383593501967390
.
Ok, I was able to reproduce the issue and did a bit of debugging. It seems the problem here is that the ID is larger than JavaScript's Number.MAX_SAFE_INTEGER
, which leads to rounding issues when passing the number from the JavaScript code into the app's native code. I don't yet know how to fix this, or if it is even possible to fix this.
My suggestion for a workaround for now would be, if possible, to either use a shorter ID or to use a string ID instead of a number ID. You can also try to convert the number to a string before passing it into the setVariable
function, like this:
const vehicles = JSON.parse(response.body);
const vehicleId = `${vehicles.response[0].id}`;
setVariable('tesla_vehicle_id', vehicleId);
showDialog('Vehicle ID updated '+ vehicleId +'!','OK');
I have implemented a potential fix for this issue and included it in the 1.39.0 release. Hope it helps. I'm closing this issue for now, feel free comment and re-open if the problem still exists.
Steps To Reproduce
tesla_vehicle_id
is wrong,Expected behavior returned id is 50196233593867390
Actual behavior vadiable is 50196233593867392
Context (please complete the following information):