Volvo on call

If you can find no other place to discuss a home automation related topic, add it here. This is a completely open forum. Want to discuss competitors? Have any general comments about home automation? This is the place!
mortenkols
Posts: 198
Joined: Wed Oct 29, 2014 2:02 pm
Location: Norway

Re: Volvo on call

Post by mortenkols »

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
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Volvo on call

Post by howartp »

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
mortenkols
Posts: 198
Joined: Wed Oct 29, 2014 2:02 pm
Location: Norway

Re: Volvo on call

Post by mortenkols »

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
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Volvo on call

Post by howartp »

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

Then copy whatever output you get.
mortenkols
Posts: 198
Joined: Wed Oct 29, 2014 2:02 pm
Location: Norway

Re: Volvo on call

Post by mortenkols »

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))
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Volvo on call

Post by howartp »

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))
mortenkols
Posts: 198
Joined: Wed Oct 29, 2014 2:02 pm
Location: Norway

Re: Volvo on call

Post by mortenkols »

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
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Volvo on call

Post by howartp »

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.
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Volvo on call

Post by howartp »

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!
mortenkols
Posts: 198
Joined: Wed Oct 29, 2014 2:02 pm
Location: Norway

Re: Volvo on call

Post by mortenkols »

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 ?
mortenkols
Posts: 198
Joined: Wed Oct 29, 2014 2:02 pm
Location: Norway

Re: Volvo on call

Post by mortenkols »

How can i hide the output of the script from the log?
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Volvo on call

Post by howartp »

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


Sent from my iPhone using Tapatalk Pro
mortenkols
Posts: 198
Joined: Wed Oct 29, 2014 2:02 pm
Location: Norway

Re: Volvo on call

Post by mortenkols »

Thanks. What are you thinking of the street adress?
mortenkols
Posts: 198
Joined: Wed Oct 29, 2014 2:02 pm
Location: Norway

Re: Volvo on call

Post by mortenkols »

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$
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Volvo on call

Post by howartp »

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


Sent from my iPhone using Tapatalk Pro
Post Reply

Return to “General Home Automation”