Here's the code I was using to trigger my 2019 540xi (US) to honk horn, start ventilation, lock/unlock, and flash lights from indigo. Any chance to include in the BMW CD plugin?
`#! /usr/bin/env python
#
Here's a simple script to request a service to BMW Remote
Pulls service variable from indigoserver. This script must be executed from Indigo
Variable in Indigo holds the command to send to BMW service
myVar = indigo.variables[1342682099].value # "remoteService" for example send DOOR_LOCK to lock
service = myVar
indigo.server.log(u"Executing " + service, type="BMW Plugin")
resp = c.executeService(vin, service)
status = resp['executionStatus']['status']
while status in ('INITIATED','PENDING'):
if sendStatus:
indigo.server.log(status, type="BMW Plugin")
sendStatus = False
time.sleep(5)
check = c.call('/user/vehicles/{}/serviceExecutionStatus?serviceType={}'.format(vin, service))
status = check['executionStatus']['status']
if status in ('DELIVERED','EXECUTED'):
indigo.server.log(status, type="BMW Plugin")
else:
indigo.server.log(u"The call to the BMW was not successful. Last response from the API was " + status, type="BMW Plugin Error", isError=True)
`
Here's the code I was using to trigger my 2019 540xi (US) to honk horn, start ventilation, lock/unlock, and flash lights from indigo. Any chance to include in the BMW CD plugin?
`#! /usr/bin/env python #
Here's a simple script to request a service to BMW Remote
Pulls service variable from indigoserver. This script must be executed from Indigo
#
import bmw import time import sys import indigo
set default to True
sendStatus = True c = bmw.ConnectedDrive() resp = c.call('/user/vehicles/') vin = resp['vehicles'][0]['vin']
Variable in Indigo holds the command to send to BMW service
myVar = indigo.variables[1342682099].value # "remoteService" for example send DOOR_LOCK to lock service = myVar
indigo.server.log(u"Executing " + service, type="BMW Plugin") resp = c.executeService(vin, service) status = resp['executionStatus']['status'] while status in ('INITIATED','PENDING'): if sendStatus: indigo.server.log(status, type="BMW Plugin") sendStatus = False time.sleep(5) check = c.call('/user/vehicles/{}/serviceExecutionStatus?serviceType={}'.format(vin, service)) status = check['executionStatus']['status']
if status in ('DELIVERED','EXECUTED'): indigo.server.log(status, type="BMW Plugin") else: indigo.server.log(u"The call to the BMW was not successful. Last response from the API was " + status, type="BMW Plugin Error", isError=True) `