New Plugin - BMW Connected Drive

Posted on
Tue Apr 13, 2021 8:28 am
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

I need to see the Interactive Shell output. That's the only way to see error messages from the subprocess.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Apr 13, 2021 10:26 am
ryanbuckner offline
Posts: 1081
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

FlyingDiver wrote:
I need to see the Interactive Shell output. That's the only way to see error messages from the subprocess.


Here's the shell output attempting to honk horn:

Code: Select all
Starting shell for plugin BMW ConnectedDrive.indigoPlugin.
To access the plugin instance use the global named self.

Python 2.7.16 (default, Jun  5 2020, 22:59:21)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
Connected to Indigo Server v7.5.0, api v2.4 (localhost:1176)
Started Plugin BMW Connected Drive v1.0.2
>>> Traceback (most recent call last):
  File "./wrapper.py", line 100, in <module>
    asyncio.run(main(sys.argv))
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "./wrapper.py", line 73, in main
    vehicle = account.get_vehicle(request['vin'])
KeyError: 'vin'
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "plugin.py", line 159, in wrapper_read
    data = json.loads(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded



After that, attempted to honk horn again a few minutes later. No update in Interactive shell but this error was thrown in the Event Log:

Code: Select all
Apr 13, 2021 at 12:23:31 PM
   Action Group                    BMW Remote Call - Honk Horn
   BMW Connected Drive Error       Error in plugin execution ExecuteAction:

Traceback (most recent call last):
  File "plugin.py", line 335, in sendCommandAction
  File "plugin.py", line 151, in wrapper_write
IOError: (32, 'Broken pipe')


Apr 13, 2021 at 12:24:19 PM
   Ring                            Front Door motion detected

Apr 13, 2021 at 12:25:10 PM
   BMW Connected Drive Error       Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 138, in runConcurrentThread
  File "plugin.py", line 151, in wrapper_write
IOError: [Errno 32] Broken pipe

   BMW Connected Drive Error       plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

Posted on
Tue Apr 13, 2021 10:44 am
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

This is the key data:

Code: Select all
>>> Traceback (most recent call last):
  File "./wrapper.py", line 100, in <module>
    asyncio.run(main(sys.argv))
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "./wrapper.py", line 73, in main
    vehicle = account.get_vehicle(request['vin'])
KeyError: 'vin'

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Apr 13, 2021 10:49 am
ryanbuckner offline
Posts: 1081
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

FlyingDiver wrote:
This is the key data:

Code: Select all
>>> Traceback (most recent call last):
  File "./wrapper.py", line 100, in <module>
    asyncio.run(main(sys.argv))
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "./wrapper.py", line 73, in main
    vehicle = account.get_vehicle(request['vin'])
KeyError: 'vin'



Pun intended?

Posted on
Tue Apr 13, 2021 10:51 am
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

ryanbuckner wrote:
Pun intended?


Could be....

And yes, that's a definite bug in the code. What I can't figure out is why on my system I don't get the errors. It just doesn't do anything.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Apr 13, 2021 10:57 am
ryanbuckner offline
Posts: 1081
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

I just noticed that this error is only thrown when sending the Honk Horn command. The other commands, as you said, do nothing.

I tend to test with this command most so I don't have to stand in my garage while testing.

Posted on
Tue Apr 13, 2021 11:01 am
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

I've managed to arrange things so I'm seeing errors from the Py3 code now, so I should be able to make progress on this.

I also managed to get this running in a Python virtual environment, so I think I'll be able to include all the other packages with the plugin, so no pip commands needed.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Apr 13, 2021 1:52 pm
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

Some progress. I figured out why some commands did nothing, and others generated errors. Now all the commands generate errors, which is sort of a good thing. It's down to one problem to solve. Unfortunately, it looks like I sent too many commands to the API, and I'm locked out temporarily. So I'll resume work on it tomorrow.

In the meantime, I've successfully converted the plugin to use a Python virtual environment for all the libraries, so no more use pip to install a bunch. Downside is that the plugin is MUCH larger, since it's now including all that code. It's still only 5MB or so, which is not terrible. Another downside is that it requires the standard Xcode based Python3 install, as the link to the Python interpreter is fixed in the virtual environment.

Oh, and the error I'm getting is from the CD servers. I'll probably need to open an issue with the library maintainers because I'm pretty sure I'm calling the API correctly.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Apr 13, 2021 3:52 pm
ryanbuckner offline
Posts: 1081
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

Thanks so much for all you're doing. Let me know what I can do to help test tomorrow

Posted on
Tue Apr 13, 2021 4:06 pm
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

Grab the latest commit in the venv branch: https://github.com/FlyingDiver/Indigo-B ... mmits/venv

Replace your existing plugin with this one (save the old one). Set log level to debug, restart in the Interactive Shell, and try to send a command. There's going to be a lot of output, so might be best to create a GitHub issue for it.

I'm wondering if the errors I'm getting are because I can never send commands to my car.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Apr 14, 2021 7:45 am
ryanbuckner offline
Posts: 1081
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

I may have done this wrong. Apologies. I took the ZIP from the latest venv and dropped it in the Plugins folder after removing the old one.

I get this error in the event log and the Interactive Shell doesn't launch

Code: Select all
Apr 14, 2021 at 9:39:35 AM
   Error                           plugin "BMW ConnectedDrive 7.23.44 PM.indigoPlugin" is missing file: /Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/BMW ConnectedDrive 7.23.44 PM.indigoPlugin/Contents/Info.plist

Posted on
Wed Apr 14, 2021 8:30 am
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

Fix the name of the plugin file. It should not have a time stamp in it.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Apr 14, 2021 8:58 am
ryanbuckner offline
Posts: 1081
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

Ok, it required an Indigo restart. Looks like Indigo creates a copy of a plugin if you delete it.

Here's the output when reloading into shell:

Code: Select all
Starting shell for plugin BMW ConnectedDrive.indigoPlugin.
To access the plugin instance use the global named self.

Python 2.7.16 (default, Jun  5 2020, 22:59:21)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
Connected to Indigo Server v7.5.0, api v2.4 (localhost:1176)
Started Plugin BMW Connected Drive v1.0.2
>>>   File "./wrapper.py", line 18
    async def main(args) -> None:
            ^
SyntaxError: invalid syntax


Posted on
Wed Apr 14, 2021 9:11 am
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

ryanbuckner wrote:
Ok, it required an Indigo restart. Looks like Indigo creates a copy of a plugin if you delete it.


You always need to disable the plugin before swapping it out.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Apr 14, 2021 9:14 am
FlyingDiver online
User avatar
Posts: 7256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

ryanbuckner wrote:
Here's the output when reloading into shell:

Code: Select all
Starting shell for plugin BMW ConnectedDrive.indigoPlugin.
To access the plugin instance use the global named self.

Python 2.7.16 (default, Jun  5 2020, 22:59:21)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
Connected to Indigo Server v7.5.0, api v2.4 (localhost:1176)
Started Plugin BMW Connected Drive v1.0.2
>>>   File "./wrapper.py", line 18
    async def main(args) -> None:
            ^
SyntaxError: invalid syntax



That's very odd. Please confirm which version of Python3 you have installed.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 2 guests