Volvo on call

Posted on
Sat Oct 14, 2017 3:58 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

14. okt. 2017, 11:58:16
Script Error embedded script: invalid syntax
Script Error around line 60 - "indigo.server.log(u"vheater: #%s#" % (vheater)"
Action Collection Error Script /Library/Application Support/Perceptive Automation/Indigo 7/volvooncall-master/voc exited abnormally with a return code of: 1

Posted on
Sat Oct 14, 2017 4:09 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Volvo on call

Sorry, I missed copying a bracket when I copy/pasted into the forum.

Add another closing bracket ) right at the end of the vheater line. (Or re-copy it from above which I've fixed for future reference)

Peter

Posted on
Sat Oct 14, 2017 4:13 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

okey. now it is the same error as before?

Action Group Volvo on call - Status copy 1
Script Error embedded script: list index out of range
Script Error Exception Traceback (most recent call shown last):

embedded script, line 13, at top level
IndexError: list index out of range

Action Collection Error Script /Library/Application Support/Perceptive Automation/Indigo 7/volvooncall-master/voc exited abnormally with a return code of: 1

Posted on
Sat Oct 14, 2017 4:15 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Volvo on call

Keep commenting out those lines it moans about until it runs ok.

Then copy whatever output you get.

Posted on
Sat Oct 14, 2017 4:22 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

14. okt. 2017, 12:21:12
Action Group Volvo on call - Status copy 1
Script Status: XV68312 (V70/2015) YV1BW84ABF1328657 36689km (fuel 11% 115km)
position: 65.86991119384766,13.19027709960938
locked: yes
heater: off

Script
Script vs[0]: XV68312 (V70/2015) YV1BW84ABF1328657 36689km (fuel 11% 115km)
position: 65.86991119384766,13.19027709960938
locked: yes
heater: off

Script kmpos1: 15
Script kmpos2: 44
Script vdistance: #15) YV1BW84ABF1328657 36689km#
Script
Script fuelpos1: 51
Script fuelpos2: 54
Script vfuelpercent: #11%#
Script vfuelleft: #115km)
position: 65.86991119384766,13.19027709960938
locked: yes
heater: off#
Script
Script
Script
Action Collection Error Script /Library/Application Support/Perceptive Automation/Indigo 7/volvooncall-master/voc exited abnormally with a return code of: 1

Code: Select all
v = indigo.variables[1821019645].value #replace 00000 with your Volvo_Status variable ID (this variable already exists so don't recreate it)
vs = v.split('\r\n')

kmpos1 = vs[0].find('YV1BW84AB328657')+16
kmpos2 = vs[0].find('km')+2
vdistance = vs[0][kmpos1:kmpos2]

fuelpos1 = vs[0].find('fuel')+5
fuelpos2 = vs[0].find('%')+1
vfuelpercent = vs[0][fuelpos1:fuelpos2]
vfuelleft = vs[0][fuelpos2+1:-1]

#vpos1 = vs[1].find('(')+1
#vlocation = vs[1][vpos1:-1]

#lockedpos = vs[2].find(':')+2
#vlocked = vs[2][lockedpos:]

#heatpos = vs[3].find('heater:')+8
#vheater = vs[3][heatpos:]

indigo.variable.updateValue(87678230,vdistance)    #replace 11111 with your Distance variable ID
indigo.variable.updateValue(1736198595,vfuelpercent) #replace 22222 with your FuelPercent variable ID
indigo.variable.updateValue(644438445,vfuelleft)    #replace 33333 with your FuelLeft variable ID
#indigo.variable.updateValue(1315984501,vlocation)    #replace 44444 with your Location variable ID
#indigo.variable.updateValue(342953490,vlocked)      #replace 55555 with your Locked variable ID
#indigo.variable.updateValue(970693475,vheater)      #replace 66666 with your Heater variable ID

indigo.server.log(u"Status:       %s" % (v))

indigo.server.log(u"")
indigo.server.log(u"vs[0]:        %s" % (vs[0]))

indigo.server.log(u"kmpos1:       %s" % (kmpos1))
indigo.server.log(u"kmpos2:       %s" % (kmpos2))
indigo.server.log(u"vdistance:    #%s#" % (vdistance))

indigo.server.log(u"")
indigo.server.log(u"fuelpos1:     %s" % (fuelpos1))
indigo.server.log(u"fuelpos2:     %s" % (fuelpos2))
indigo.server.log(u"vfuelpercent: #%s#" % (vfuelpercent))
indigo.server.log(u"vfuelleft:    #%s#" % (vfuelleft))

indigo.server.log(u"")
#indigo.server.log(u"vs[1]:        %s" % (vs[1]))

#indigo.server.log(u"vpos1:        %s" % (vpos1))
#indigo.server.log(u"vlocation:    #%s#" % (vlocation))

indigo.server.log(u"")
#indigo.server.log(u"vs[2]:        %s" % (vs[2]))

#indigo.server.log(u"lockedpos:    %s" % (lockedpos))
#indigo.server.log(u"vlocked:      #%s#" % (vlocked))

indigo.server.log(u"")
#indigo.server.log(u"vs[3]:        %s" % (vs[3]))

#indigo.server.log(u"heatpos:      %s" % (heatpos))
#indigo.server.log(u"vheater:      #%s#" % (vheater))

Posted on
Sat Oct 14, 2017 5:24 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Volvo on call

Ok, give this a go.

I'd presumed the "YV1B...." number was a static number such as your vehicle chassis number but it keeps changing.

Your mac also doesn't seem to use /r/n line breaks so I can't split the lines down like I was.

Code: Select all
v = indigo.variables[00000].value #replace 00000 with your Volvo_Status variable ID

vmodel = v.find(')')+2

v = v[vmodel:]

kmpos1 = v.find(' ')+1
kmpos2 = v.find('km')+2

vdistance = v[kmpos1:kmpos2]

v = v[kmpos2+1:]

fuelpos1 = v.find('fuel')+5
fuelpos2 = v.find('%')+1
fuelpos3 = v.find('km')+2

vfuelpercent = v[fuelpos1:fuelpos2]
vfuelleft = v[fuelpos2+1:fuelpos3]

v = v[fuelpos3+1:]

if "(" in v:
   vpos1 = v.find('(')+1
   vpos2 = v.find(')')
   vlocation = v[vpos1:vpos2]
else:
   vpos1 = ""
   vpos2 = ""
   vlocation = "Not available"

if "locked: yes" in v:
   vlocked = "Yes"
else:
   vlocked = "No"

if "heater: on" in v:
   vheater = "On"
else:
   vheater = "Off"

indigo.variable.updateValue(11111,vdistance)    #replace 11111 with your Distance variable ID
indigo.variable.updateValue(22222,vfuelpercent) #replace 22222 with your FuelPercent variable ID
indigo.variable.updateValue(33333,vfuelleft)    #replace 33333 with your Fuel Left variable ID
indigo.variable.updateValue(44444,vlocation)    #replace 44444 with your Location variable ID
indigo.variable.updateValue(55555,vlocked)      #replace 55555 with your Locked variable ID
indigo.variable.updateValue(66666,vheater)      #replace 66666 with your Heater variable ID

indigo.server.log(u"Status:       %s" % (v))

#indigo.server.log(u"kmpos1:       %s" % (kmpos1))
#indigo.server.log(u"kmpos2:       %s" % (kmpos2))
#indigo.server.log(u"fuelpos1:     %s" % (fuelpos1))
#indigo.server.log(u"fuelpos2:     %s" % (fuelpos2))
#indigo.server.log(u"vpos1:        %s" % (vpos1))

indigo.server.log(u"")

indigo.server.log(u"vdistance:    %s" % (vdistance))
indigo.server.log(u"vlocation:    %s" % (vlocation))
indigo.server.log(u"vfuelpercent: %s" % (vfuelpercent))
indigo.server.log(u"vfuelleft:    %s" % (vfuelleft))
indigo.server.log(u"vlocked:      %s" % (vlocked))
indigo.server.log(u"vheater:      %s" % (vheater))

Posted on
Sat Oct 14, 2017 6:22 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

It seems to work now, but location isnt updating?!
YV1BW84ABF1328657 is the vehicle number, is it changing?

14. okt. 2017, 14:19:38
Action Group Volvo on call - Status copy 1
Script Status:
position: 65.86986541748047,13.19047546386719
locked: yes
heater: off

Script
Script vdistance: 36703km
Script vlocation: Not available
Script vfuelpercent: 11%
Script vfuelleft: 120km
Script vlocked: Yes
Script vheater: Off
Action Collection Error Script /Library/Application Support/Perceptive Automation/Indigo 7/volvooncall-master/voc exited abnormally with a return code of: 1

Posted on
Sat Oct 14, 2017 6:40 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Volvo on call

Location can't update because it's not in the Volvo_status at the moment - sometimes it's there, sometimes it's not.

If it isn't, then I change the location to "Not available" rather than the script crashing.

Yes, the vehicle number is changing.

Code: Select all
YV1BW84AB328657   yesterday
YV1BW84AB  328657 yesterday (with spaces for alignment)
YV1BW84ABF1328657 today

There's a "F1" appeared for some reason.

Posted on
Sat Oct 14, 2017 6:44 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Volvo on call

MacMini:~ mortenolsen$ /Library/Application\ Support/Perceptive\ Automation/Indigo\ 7/volvooncall-master/voc -u <username> -p <password> -I <VIN> status -g
XV6832 (V70/2015) YV1BW84AB328657 36617km (fuel 22% 210km)
position: 65.86992645263672,13.19024658203125 (8, Rypevegen, Halsøya, Mosjøen, Vefsn, Nordland, 8665, Norge)
locked: yes
heater: off

That's from your post yesterday - it's the only time in this whole thread where the "F1" is missing, but it's this quote I copied your status from into mine to play with!

Posted on
Sat Oct 14, 2017 7:32 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

okey. you are right about the VIN number

i havent seen the screet address in the variable, just the coordinates.

this error comes when i run the terminal command with indigo:

/Library/Application\ Support/Perceptive\ Automation/Indigo\ 7/volvooncall-master/voc -u <username> -p <password> -I <VIN> status -g
XV6832

Action Collection Error Script /Library/Application Support/Perceptive Automation/Indigo 7/volvooncall-master/voc exited abnormally with a return code of: 1

Options:
-u <username> VOC username
-p <password> VOC password
-s <url> VOC service URL
-i <vin> Vehicle VIN or registration number
-g Geolocate position
-h --help Show this message
-v,-vv Increase verbosity
--version Show version

what is return code of 1 ?

Posted on
Sat Oct 14, 2017 7:40 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

How can i hide the output of the script from the log?

Posted on
Sat Oct 14, 2017 8:18 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Volvo on call

Just comment out the Indigo.server.log() lines


Sent from my iPhone using Tapatalk Pro

Posted on
Sat Oct 14, 2017 9:18 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

Thanks. What are you thinking of the street adress?

Posted on
Sat Oct 14, 2017 12:43 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

This is also possible to get into indigo :) :D

{
"VIN": "YV1BW84ABF1328657",
"assistanceCallSupported": true,
"averageFuelConsumption": 70.0,
"averageFuelConsumptionTimestamp": "2017-10-14T17:41:59+0000",
"averageSpeed": 36,
"averageSpeedTimestamp": "2017-10-14T17:41:59+0000",
"bCallAssistanceNumber": "+4722670377",
"brakeFluid": "Normal",
"brakeFluidTimestamp": "2017-10-14T17:41:59+0000",
"bulbFailures": [],
"bulbFailuresTimestamp": "2017-10-14T17:41:59+0000",
"calculatedPosition": {
"latitude": null,
"timestamp": null,
"speed": null,
"heading": null,
"longitude": null
},
"carLocatorDistance": 1000,
"carLocatorSupported": true,
"carLocked": true,
"carLockedTimestamp": "2017-10-14T17:41:59+0000",
"climatizationCalendarMaxTimers": 8,
"climatizationCalendarVersionsSupported": [],
"country": {
"iso2": "NO"
},
"distanceToEmpty": 95,
"distanceToEmptyTimestamp": "2017-10-14T17:41:59+0000",
"doors": {
"tailgateOpen": false,
"timestamp": "2017-10-14T17:41:59+0000",
"frontLeftDoorOpen": false,
"hoodOpen": false,
"rearRightDoorOpen": false,
"frontRightDoorOpen": false,
"rearLeftDoorOpen": false
},
"engineCode": "3511CF78",
"engineRunning": false,
"engineRunningTimestamp": "2017-10-14T17:41:59+0000",
"engineStartSupported": false,
"exteriorCode": "351111NL",
"fuelAmount": 7,
"fuelAmountLevel": 10,
"fuelAmountLevelTimestamp": "2017-10-14T17:41:59+0000",
"fuelAmountTimestamp": "2017-10-14T17:41:59+0000",
"fuelTankVolume": 70,
"fuelType": "Diesel",
"gearboxCode": "3511DB08",
"grossWeight": 2240,
"heater": {
"status": "off",
"timestamp": "2017-10-14T18:08:15+0000",
"timer2": {
"state": false,
"time": "07:50"
},
"timer1": {
"state": false,
"time": "06:35"
}
},
"highVoltageBatterySupported": false,
"honkAndBlinkDistance": 500,
"honkAndBlinkSupported": true,
"honkAndBlinkVersionsSupported": [
"honkAndOrBlink",
"honkAndBlink"
],
"interiorCode": "3511108R",
"journalLogEnabled": true,
"journalLogSupported": true,
"lockSupported": true,
"modelYear": 2015,
"numberOfDoors": 5,
"odometer": 36719089,
"odometerTimestamp": "2017-10-14T17:41:59+0000",
"overrideDelayChargingSupported": false,
"position": {
"latitude": 65.86991882324219,
"timestamp": "2017-10-14T17:40:59+0000",
"speed": null,
"heading": null,
"longitude": 13.190254211425781
},
"preclimatizationSupported": false,
"registrationNumber": "XV68312",
"remoteHeaterSupported": true,
"sendPOIToVehicleVersionsSupported": [
"sendSinglePOIToVehicle"
],
"serverVersion": "4.11.46-voc-deployable",
"serviceWarningStatus": "Normal",
"serviceWarningStatusTimestamp": "2017-10-14T17:41:59+0000",
"status.parkedIndoor.supported": false,
"subscriptionEndDate": "2017-12-22T12:00:00+0000",
"subscriptionStartDate": "2014-12-22T12:00:00+0000",
"subscriptionType": "PREMIUM_2013",
"timeFullyAccessible": 7200,
"timeFullyAccessibleUntil": "2017-10-19T17:40:57+0000",
"timePartiallyAccessible": 31680,
"timePartiallyAccessibleUntil": "2017-11-05T17:40:57+0000",
"tripMeter1": 581300,
"tripMeter1Timestamp": "2017-10-14T17:41:59+0000",
"tripMeter2": 581200,
"tripMeter2Timestamp": "2017-10-14T17:41:59+0000",
"tyreDimensionCode": "3511R503",
"tyreInflationPressureHeavyCode": "3511YX04",
"tyreInflationPressureLightCode": "3511YT06",
"tyrePressure": {
"frontRightTyrePressure": "Normal",
"timestamp": "2017-10-14T17:41:59+0000",
"rearLeftTyrePressure": "Normal",
"frontLeftTyrePressure": "Normal",
"rearRightTyrePressure": "Normal"
},
"unlockSupported": true,
"unlockTimeFrame": 120,
"vehiclePlatform": "3511",
"vehicleType": "V70",
"vehicleTypeCode": "3511AA02",
"verificationTimeFrame": 120,
"vin": "YV1BW84ABF1328657",
"washerFluidLevel": "Normal",
"washerFluidLevelTimestamp": "2017-10-14T17:41:59+0000",
"windows": {
"frontRightWindowOpen": false,
"rearLeftWindowOpen": false,
"frontLeftWindowOpen": false,
"rearRightWindowOpen": false,
"timestamp": "2017-10-14T17:41:59+0000"
}
}
Mortens-MacBook-Air:~ mortenolsen$

Posted on
Sat Oct 14, 2017 1:49 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Volvo on call

Does it tell you who the driver is and what colour their eyes are as well?


Sent from my iPhone using Tapatalk Pro

Who is online

Users browsing this forum: No registered users and 6 guests

cron