New Plugin - BMW Connected Drive

Posted on
Mon Apr 12, 2021 11:54 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

ryanbuckner wrote:
I have a client on the server and a remote client. Neither have that option. :?


Ok, I had to enable that menu from the Indigo Preferences: Here's the output. It's still trying to use 2.7

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.1
>>> Traceback (most recent call last):
  File "./wrapper.py", line 4, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
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

Posted on
Mon Apr 12, 2021 11:57 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

No, it's not trying to use 2.7, it's just that the shell was created by the 2.7 Python that Indigo uses.

The Py3 script is failing because you don't have the requests module installed for Py3. Do "sudo pip3 install requests" and see if that fixes it. If so, I'll add that to the instructions.

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

Posted on
Mon Apr 12, 2021 12:17 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

ok,. should I install aiohttp next?

Code: Select all
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.1
>>> Traceback (most recent call last):
  File "./wrapper.py", line 6, in <module>
    from aiohttp import ClientSession
ModuleNotFoundError: No module named 'aiohttp'
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


Posted on
Mon Apr 12, 2021 12:19 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

And you'll probably need asyncio as well.

I already had all these installed from working on a different plugin, so I forgot to document them. I wish I could have figured out a way to include a virtual environment. I need to try that again.

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

Posted on
Mon Apr 12, 2021 12:23 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

Ok, installed both of them:

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.1
>>> Traceback (most recent call last):
  File "./wrapper.py", line 8, in <module>
    from bimmer_connected.account import ConnectedDriveAccount
  File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/BMW ConnectedDrive.indigoPlugin/Contents/Server Plugin/bimmer_connected/__init__.py", line 5, in <module>
    __version__ = pkg_resources.get_distribution("bimmer_connected").version
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 481, in get_distribution
    dist = get_provider(dist)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 357, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'bimmer_connected' distribution was not found and is required by the application
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



Posted on
Mon Apr 12, 2021 12:34 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

Hmm. I don't recall ever seeing that error. I guess I need to bite the bullet and set up a VM to test this on a "clean" machine.

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

Posted on
Mon Apr 12, 2021 1:28 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive


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

Posted on
Mon Apr 12, 2021 2:12 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

Disabling the version check fixed the issue.

I now have access to the account and the car device. The car device is properly updating with states from Connected.

Now the fun part :)

Posted on
Mon Apr 12, 2021 3:11 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

Here's what I checked. I created an Action Group for each available plugin command and executed those:

1) Lock Doors - I attempted to lock the doors through the plugin. No errors in the debug, command appeared to be sent. The doors did not lock. I attempted with my app, and the app was able to lock the doors
Code: Select all
Apr 12, 2021 at 4:24:15 PM
   Action Group                    BMW Remote Call - Lock Doors
   BMW Connected Drive Debug       Ryan's BMW 540ix: sendCommandAction lock
   BMW Connected Drive Debug       Send wrapper message: {"cmd": "lock"}
   BMW Connected Drive Debug       BMW Account: Received wrapper message:
{
    "msg": "echo",
    "request": {
        "cmd": "lock"
    }
}


2) Honk Horn - I attempted to honk the horns through the plugin. Command appeared to be sent. Error was thrown. The horn did not honk. I attempted with my app, and the app was able to honk the horn.

Code: Select all
Apr 12, 2021 at 4:36:07 PM
   Action Group                    BMW Remote Call - Honk Horn
   BMW Connected Drive Debug       Ryan's BMW 540ix: sendCommandAction horn
   BMW Connected Drive Debug       Send wrapper message: {"cmd": "horn"}
   BMW Connected Drive Debug       BMW Account: Received wrapper message:
{
    "msg": "echo",
    "request": {
        "cmd": "horn"
    }
}
   BMW Connected Drive Debug       Send wrapper message: {"cmd": "vehicles"}
   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)
   BMW Connected Drive Debug       runConcurrentThread starting


I tried a 2nd time through the plugin:

Code: Select all
  Action Group                    BMW Remote Call - Honk Horn
   BMW Connected Drive Debug       Ryan's BMW 540ix: sendCommandAction horn
   BMW Connected Drive Debug       Send wrapper message: {"cmd": "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')


I restarted the plugin:

3) Lights - I attempted to flash the lights through the plugin. No errors in the debug, command appeared to be sent. The lights did not flash. I attempted with my app, and the app was able to flash the lights (2 slow flashes)

Code: Select all
  Action Group                    BMW Remote Call - Flash Lights
   BMW Connected Drive Debug       Ryan's BMW 540ix: sendCommandAction light
   BMW Connected Drive Debug       Send wrapper message: {"cmd": "light"}
   BMW Connected Drive Debug       BMW Account: Received wrapper message:

  BMW Connected Drive Debug       BMW Account: Received wrapper message:
{
    "msg": "echo",
    "request": {
        "cmd": "light"
    }
}


Posted on
Mon Apr 12, 2021 4:22 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

I'm probably missing some sort of auth parameter on the calls that actually try to do something. Or the library I'm using doesn't actually work for that. I'll investigate some more.

If you can reliably replicate the sequence that throws the Broken Pipe error, I'd love to see the terminal output from the Interactive shell. In any case, I need to trap that error and restart the Py3 process.

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

Posted on
Tue Apr 13, 2021 12:46 am
ChopOMatic offline
Posts: 110
Joined: Sep 12, 2014

Re: New Plugin - BMW Connected Drive

Using the most recent build (1.0.2?), I'm not getting errors in the event window like before. But, unlike when I first got the plugin working several versions back, I only get data for the parameters you'll see in the linked video. (The first version of the plugin that worked dumped a long list of data.) I also cannot create a new device, either from scratch or via duplicating an existing working device. I have installed requests, aiohttp, and asyncio.

https://screencast-o-matic.com/watch/crfI1UVnwgg

Here's what I get from the interactive 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, Dec 21 2020, 23:00:36)
[GCC Apple LLVM 12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri
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 4, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
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

Posted on
Tue Apr 13, 2021 5:38 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

ChopOMatic wrote:
Using the most recent build (1.0.2?), I'm not getting errors in the event window like before. But, unlike when I first got the plugin working several versions back, I only get data for the parameters you'll see in the linked video. (The first version of the plugin that worked dumped a long list of data.) I also cannot create a new device, either from scratch or via duplicating an existing working device. I have installed requests, aiohttp, and asyncio.


The shell errors say that the Py3 code couldn't find the requests library. Are you sure that you installed those packages for Python3?

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

Posted on
Tue Apr 13, 2021 8:04 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

FlyingDiver wrote:
I'm probably missing some sort of auth parameter on the calls that actually try to do something. Or the library I'm using doesn't actually work for that. I'll investigate some more.

If you can reliably replicate the sequence that throws the Broken Pipe error, I'd love to see the terminal output from the Interactive shell. In any case, I need to trap that error and restart the Py3 process.


That error is coming every 5 mins now ( default call time) , although I'm just letting it run. I haven't made any new command attempts .

Code: Select all
Apr 13, 2021 at 9:59:09 AM
   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 8:06 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

ryanbuckner wrote:
That error is coming every 5 mins now ( default call time) , although I'm just letting it run. I haven't made any new command attempts .

Code: Select all
Apr 13, 2021 at 9:59:09 AM
   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)


That error basically says that the Python3 process is not running. So there should be an error in the Interactive Shell that would provide more info.

joe

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

Posted on
Tue Apr 13, 2021 8:21 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

Not sure if this helps you but I'm able to get this error to throw:

1) Every time I change the Config Debug level in the plugin menu.
2) Every 5 minutes

The errors below are triggered by changing the debug levels in the menu:

Code: Select all
Apr 13, 2021 at 10:17:16 AM
   BMW Connected Drive Debug       closedPrefsConfigUi, logLevel = 10, updateFrequency = 300.0
   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)
   Received INSTEON                "Basement Bathroom Motion Sensor" off (button 1)
   BMW Connected Drive Debug       runConcurrentThread starting

Apr 13, 2021 at 10:17:48 AM
   BMW Connected Drive Debug       validatePrefsConfigUi called
   BMW Connected Drive Debug       closedPrefsConfigUi, logLevel = 5, updateFrequency = 300.0
   BMW Connected Drive Debug       Send wrapper message: {"cmd": "vehicles"}
   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)
   BMW Connected Drive Debug       runConcurrentThread starting
   BMW Connected Drive Debug       validatePrefsConfigUi called
   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)

Apr 13, 2021 at 10:18:50 AM
   All States CVS Twitter Bot      Bot attempted to tweet duplicate in VA
   Rite Aid Twitter Bot            Bot attempted to tweet duplicate in VA
   All States CVS Twitter Bot      Bot attempted to tweet duplicate in MD
   All States CVS Twitter Bot      Bot attempted to tweet duplicate in CA
   All States CVS Twitter Bot      Bot attempted to tweet duplicate in GA
   All States CVS Twitter Bot      Bot attempted to tweet duplicate in HI

Apr 13, 2021 at 10:19:27 AM
   Schedule                        Determine house occupied when house not occupied w/ delay (delayed action)
   Received INSTEON                "Garage Motion Sensor" off (button 1)
   Trigger                         Garage Motion Sensor Off
   Trigger                         Insteon Command Received at Home
   Sent INSTEON                    "Garage Lights" off
   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)

Page 8 of 12 1 ... 5, 6, 7, 8, 9, 10, 11, 12

Who is online

Users browsing this forum: No registered users and 22 guests