Volvo on call

Posted on
Thu Dec 29, 2016 1:02 am
eriass offline
Posts: 26
Joined: May 12, 2016

Volvo on call

Hi,
Have anyone tried to integrate "Volvo on call" in indigo?

//Eric


Skickat från min iPhone med Tapatalk

Posted on
Fri Oct 06, 2017 10:09 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

Anyone?!:)

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

Re: Volvo on call

Not come across it but there’s a Python api on GitHub:

https://github.com/molobrakos/volvooncall


Sent from my iPhone using Tapatalk Pro

Posted on
Sun Oct 08, 2017 3:55 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

i have seen that python api, but how can I use it in indigo?
can someone help me?

I found this also: https://community.openhab.org/t/help-wi ... mmand/7046

Posted on
Mon Oct 09, 2017 12:19 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

now I can start the heater, stop heater, unlock, lock. But how can I get the status in an variable in indigo? I get some of it, but not all of the status message. look at the pictures
Attachments
Skjermbilde 2017-10-09 kl. 20.11.11.png
Skjermbilde 2017-10-09 kl. 20.11.11.png (12.69 KiB) Viewed 4083 times
Skjermbilde 2017-10-09 kl. 20.10.39.png
Skjermbilde 2017-10-09 kl. 20.10.39.png (22.39 KiB) Viewed 4083 times
Skjermbilde 2017-10-09 kl. 20.09.47.png
Skjermbilde 2017-10-09 kl. 20.09.47.png (34.96 KiB) Viewed 4083 times
Skjermbilde 2017-10-09 kl. 20.14.22.png
Skjermbilde 2017-10-09 kl. 20.14.22.png (47.93 KiB) Viewed 4083 times
Skjermbilde 2017-10-09 kl. 20.10.28.png
Skjermbilde 2017-10-09 kl. 20.10.28.png (75.06 KiB) Viewed 4083 times

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

Re: Volvo on call

I suspect all the status is there in the variable, just not visible because as you can see in the terminal screenshot, the rest is on a new line. Put your cursor into that variable and press Cmd+A or Option+A (whatever the correct mac shortcut for "select all" is) then Cmc+C or Option+C (copy) - then open textedit or suchlike and paste in the clipboard - see what content you get?

Your best bet is for someone to knock this into a plugin for you but I don't have time right now - though I'd be happy to do it eventually.

However you should be able to have another script in Indigo itself that parses the value from that variable and puts it into new variables for you. That will be the quicker/easier way forward for now.

Peter

Posted on
Mon Oct 09, 2017 1:49 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

yes you are right. but why? as you can see on the picture the hole status message are visible in the browser, but not in indigo.

why aren't the street address visible in the variable? because of the character Ø? position: 65.86993408203125,13.19021606445312 (10, Rypevegen, Halsøya, Mosjøen, Vefsn, Nordland, 8665, Norge)

How can I make that script? can you try to explain so I can try myself?
Attachments
Skjermbilde 2017-10-09 kl. 21.43.09.png
Skjermbilde 2017-10-09 kl. 21.43.09.png (21.26 KiB) Viewed 4051 times
Skjermbilde 2017-10-09 kl. 21.42.51.png
Skjermbilde 2017-10-09 kl. 21.42.51.png (44.58 KiB) Viewed 4051 times

Posted on
Mon Oct 09, 2017 2:29 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Volvo on call

The command you ran in the terminal must be different to the one in your indigo "run script" command?

Notice fuel isn't showing in the terminal but address is.

The new script would be along the lines of the following but it's completely made up code (based on php), unchecked in any way:

Code: Select all
myCar = indigo.variables[1234678] #the variable no
myCarLines = myCar.split(\r\n) #split it into an array with each line
for (i=0;i++;i<myCarLines.count)
line = myCarLines[i].split(":")
indigo.variables[12244321] =line[1]



Sent from my iPad using Tapatalk Pro

Posted on
Mon Oct 09, 2017 3:27 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

it is the same command, the fuel showed up after I was out driving.

im gonna test the script now. thanks=)
Attachments
Skjermbilde 2017-10-09 kl. 23.24.44.png
Skjermbilde 2017-10-09 kl. 23.24.44.png (22.34 KiB) Viewed 4019 times

Posted on
Mon Oct 09, 2017 3:33 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

this showed up in the log.


9. okt. 2017, 23:32:02
Script Error embedded script: unexpected character after line continuation character
Script Error around line 2 - "myCarLines = myCar.split(\r\n) #split it into an array with each line"

Script Error embedded script: invalid syntax
Script Error around line 3 - "for (i=0;i++;i<myCarLines.count)"
Attachments
Skjermbilde 2017-10-09 kl. 23.40.51.png
Skjermbilde 2017-10-09 kl. 23.40.51.png (64.01 KiB) Viewed 4009 times

Posted on
Tue Oct 10, 2017 11:22 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Volvo on call

I found out why the adress wasn't visible, I haven't installed geopy on the indigo server

if I run this command in the terminal, I get the adress.

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
MacMini:~ mortenolsen$

but, if I run it in indigo, it report this error message.

10. okt. 2017, 19:14:03
Action Collection Error Script /Library/Application Support/Perceptive Automation/Indigo 7/volvooncall-master/voc exited abnormally with a return code of: 1

What is return code 1 ?

Posted on
Fri Oct 13, 2017 5:13 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Volvo on call

Right.

Create yourself 6 variables as shown in my screenshot - doesn't matter what names you call them. You will need the variable IDs after you've created each one.

Then paste this script into your Execute Embedded Script action:

Code: Select all
v = indigo.variables[000000].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(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 FuelLeft 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
Attachments
VolvoStatus.png
VolvoStatus.png (26.79 KiB) Viewed 3899 times

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

Re: Volvo on call

Thanks for helping!!

I have done what you said. But it returns error in the log.

Action Group Volvo on call - Status
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

I tried comment out line 13, then this error

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

embedded script, line 14, 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

I tried comment out line 14, then this error

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

embedded script, line 16, 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

I tried comment out line 16, then this error

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

embedded script, line 17, 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

I tried comment out line 17, then this error

14. okt. 2017, 11:08:31
Action Group Volvo on call - Status
Script Error embedded script: list index out of range
Script Error Exception Traceback (most recent call shown last):

embedded script, line 19, 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

I tried comment out line 19, then this error

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

embedded script, line 20, 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

When i comment out all the lines with error, these variables got updated.
Attachments
Skjermbilde 2017-10-14 kl. 11.14.02.png
Skjermbilde 2017-10-14 kl. 11.14.02.png (35.35 KiB) Viewed 3881 times

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

Re: Volvo on call

Variables in the browser
Attachments
Skjermbilde 2017-10-14 kl. 11.20.31.png
Skjermbilde 2017-10-14 kl. 11.20.31.png (94.27 KiB) Viewed 3879 times

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

Re: Volvo on call

Add this to the bottom of your script then copy the output from your Log

Code: Select all
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))
Last edited by howartp on Sat Oct 14, 2017 4:08 am, edited 1 time in total.

Who is online

Users browsing this forum: No registered users and 13 guests