Hi,
Have anyone tried to integrate "Volvo on call" in indigo?
//Eric
Skickat från min iPhone med Tapatalk
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]
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
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))
Users browsing this forum: No registered users and 13 guests