Closed denisjoshua closed 3 years ago
In the mean time, I make a function that retreive the Lat and Lon GPS position using the "vehicleData" node, and I rounded to 3 decimals in order to have about 111 mt radius position.
// func. that retrive if the M3 is at home position or not
var M3IsHome = global.get('M3IsHome') || 'false';
var M3Lat = global.get('M3Lat') || 0;
var M3Lon = global.get('M3Lon') || 0;
// receive vars from Tesla Api ///////////
M3Lat = msg.payload.drive_state.latitude.toFixed(3);
M3Lon = msg.payload.drive_state.longitude.toFixed(3);
// lat and lon is rounded to 3 decimal (3-th decimal in GPS is 111 mt radius)
if (M3Lat==xx.xxx || M3Lon==xx.xxx){
global.set('M3IsHome','true');
}
else {
global.set('M3IsHome','false');
}
global.set('M3Lat',M3Lat);
global.set('M3Lon',M3Lon);
Maybe can be useful for anyone. Denis
Yep, the gps coords are the way to go. The Tesla api does not have a build-in function to tell you if it's home or not, but the code above should do the trick just fine.
Yes it's work :-) Thanks a lot for confirmation. Denis
Hi there, and first of all thanks a lot for this greate node. I use it a lot for automation of charge batt. from my PV system.
One of think I need is to know when my Tesla M3 is at home, is there possibility to know it please ?
Thanks a lot again