@@ -206,6 +206,16 @@ class Volvo extends utils.Adapter {
206
206
native : { } ,
207
207
} ) ;
208
208
209
+ //added for including location position
210
+ await this . setObjectNotExistsAsync ( id + ".location" , {
211
+ type : "channel" ,
212
+ common : {
213
+ name : "Location of the car via Connected Vehicle API" ,
214
+ } ,
215
+ native : { } ,
216
+ } ) ;
217
+ // end
218
+
209
219
let remoteArray = [ { command : "Refresh" , name : "True = Refresh" } ] ;
210
220
await this . requestClient ( {
211
221
method : "get" ,
@@ -305,7 +315,26 @@ class Volvo extends utils.Adapter {
305
315
error . response && this . log . error ( JSON . stringify ( error . response . data ) ) ;
306
316
} ) ;
307
317
}
318
+ // added for including location position
319
+ await this . requestClient ( {
320
+ method : "get" ,
321
+ url : "https://api.volvocars.com/location/v1/vehicles/" + vin + "/location" ,
322
+ headers : {
323
+ accept : "application/json" ,
324
+ "vcc-api-key" : this . config . vccapikey ,
325
+ Authorization : "Bearer " + this . session . access_token ,
326
+ } ,
327
+ } )
328
+ . then ( async ( res ) => {
329
+ this . log . debug ( JSON . stringify ( res . data ) ) ;
330
+ this . json2iob . parse ( vin + ".location" , res . data . data , { forceIndex : true } ) ;
331
+ } )
332
+ . catch ( ( error ) => {
333
+ this . log . error ( error ) ;
334
+ error . response && this . log . error ( JSON . stringify ( error . response . data ) ) ;
335
+ } ) ;
308
336
337
+ //added for including location position
309
338
await this . requestClient ( {
310
339
method : "get" ,
311
340
url : "https://api.volvocars.com/energy/v1/vehicles/" + vin + "/recharge-status" ,
0 commit comments