FlyingDiver / Indigo-Connected-Drive

Plugin for the BMW Connected Drive portal
MIT License
3 stars 0 forks source link

Feature Request - Add BMW actions #7

Closed ryanbuckner closed 3 years ago

ryanbuckner commented 3 years ago

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) `

FlyingDiver commented 3 years ago

Duplicate of #3.