BMW ConnectedDrive component

I will check it. It used to work when requirements where part of the py file (so before manifest.json existed).

If that is not working I can upload your library to PyPi and then it should definitely work.

We are almost there :smile:

For fun I removed that fragment at the end of the github url in manifest.json, and that was not the right thing to do. HA does not fully restart. Had to restore this morning’s snapshot before I could use it again.

Oh, that’s not good. Removing the BMW folder and restarting didn’t help?

Let me put the library on PyPi and see if we get it working. I will send you a DM so we can continue the chat there.

Oh, no. I never tried removing the folder . . . I knew I had a good snapshot that would save me some time to restore. I was able to return to a state just before I found that I’d mis-typed the manifest.json filename.

I tried the same and get the same error. Can you help me as well?

@roborob, cc @deluxestyle
I have added the updated library to Pypi and it’s working now :grinning:
I don’t have a sunroof so can’t test the LidState, that honour is up to you :wink:

Change the requirements part in manifest.json as follows:

"requirements": [
    "bimmer-connected-drive==0.5.5"
  ],

I made the change and restarted and nothing broke, so so far so good. Hopefully tomorrow will be a suitable day to test the sunroof tilted open and I can add to this. Forecast looks not bad, so we will see . . .

Hi,

New to this site here. Having been using BMW connected drive official HA component since last year. Until recently sometimes I found all its sensors are gone completely, and my custom lovelace appeared errors of course as they are all depending on them. Anyone has the same issue?

Are we supposed to be following https://github.com/robthebold/bimmer_connected/ as custom component instead of the official one due to lack of support?

PS: I am in Australia

Thank you guys

Been trying to follow the discussion to get this up and running again, but I’m facing a new error.

This is probably due to me, but I’m not sure how to proceed.

Unable to install package bimmer_connected==0.5.5: ERROR: Could not find a version that satisfies the requirement bimmer_connected==0.5.5 (from versions: 0.0.1, 0.0.3, 0.0.4, 0.1.0, 0.2.0, 0.3.0, 0.4.0.dev0, 0.4.0, 0.4.1, 0.5.0, 0.5.1, 0.5.2, 0.5.3)
ERROR: No matching distribution found for bimmer_connected==0.5.5

Not initializing bmw_connected_drive because could not install requirement bimmer_connected==0.5.5

I restarted my HA instance on the weekend and had the same issue. I had to restart three times before it worked again. I’m not sure if it was a coincidence, but before the third, successful reboot, I opened the ConnectedDrive app and signed into the ConnectedDrive website.

Thanks for the reply.

Yes I have been noticing that it is on and off for a while. It used to be quite solid, not sure when it became like this.

I’ve only been using it for three weeks and it’s been hit and miss since then. I think it’s more BMW than this component, though; the weekend I picked up the vehicle they had an outage for about 48 hours.

In fact, shortly after submitting my previous comment, I restarted HA to complete an unrelated change to my configuration.yaml and setup had failed for this component again. The third restart fixed it. Again.

@roborob Is the new version working?

No, that is just a temporary solution to test the fix.

I have reached out to M1n3rva (owner of the bimmer_connected library) and he doesn’t own a BMW anymore and has no time to work on it :cry:

:sparkles: But the good news is that he handed over the library on Github and PyPi, so I can make new releases of the library which can be updated in the regular HA component :sparkles:

You only changed the version number, but you also have to change the name from bimmer_connected to bimmer-connected-drive. But as mentioned above, this is only temporary. As soon as @roborob can confirm the fix, I will make a new version of the official library and make a PR for HA.

The problem that the BMW entities in HA don’t load are indeed caused by the BMW servers not being available at the moment you restart HA. The entities can’t be loaded in that case and you get warnings for every sensor, binary sensor etc. If you see that, just try it again by restarting HA. Also check this post.

Once the entities are loaded you will see an error in the logs every now and then as well that no new data could be retrieved (but then at least all sensors etc. are there and will get updated with the next successful update). Looks like this indeed happens more often now then 1.5 years ago, but that could be caused by the extra users of the app and HA :grinning:

1 Like

@gerard33 thank you for your response, and excellent news about gaining ownership of the repos.

The BMW ConnectedDrive servers really do seem on the flaky side!

Please let me know if you’d like any help testing new versions of the component; I’ll be more than happy to help.

Finally got back in town and able to test sunroof tilt. I made the change in manifiest.json. On restart, didn’t see any problem. When I finally opened the sunroof, I got the same problem from before (open_tilt state missing).

ValueError: 'OPEN_TILT' is not a valid LidState

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/binary_sensor.py", line 149, in update
    self._state = not vehicle_state.all_windows_closed
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 208, in all_windows_closed
    return len(list(self.open_windows)) == 0
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 203, in open_windows
    return [lid for lid in self.windows if not lid.is_closed]
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 203, in <listcomp>
    return [lid for lid in self.windows if not lid.is_closed]
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 348, in is_closed
    return self.state == LidState.CLOSED
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 343, in state
    return LidState(getattr(self._vehicle_state, self.name))
  File "/usr/local/lib/python3.7/enum.py", line 310, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.7/enum.py", line 564, in __new__
    raise exc
  File "/usr/local/lib/python3.7/enum.py", line 548, in __new__
    result = cls._missing_(value)
  File "/usr/local/lib/python3.7/enum.py", line 577, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'OPEN_TILT' is not a valid LidState

Is there anything else I was supposed to do but change the requirements line?

@gerard33 Thanks for your explanation. Like anyone else, happy to test if there is new version coming out. Thx

Thanks, sometimes you don’t look properly at the instructions.

I can reproduce it and found out that the new library on PyPi I made for this test is not complete. I will try to fix it and let you know when you can retest again :smile:

1 Like

Allright, can you give it another try? The new value for LidState is loaded now.

Change the version in manifest.json to 0.5.6:

"requirements": [
    "bimmer-connected-drive==0.5.6"
  ],

I changed the version number to 0.5.6

Here’s the log:

2019-08-06 17:40:05 ERROR (MainThread) [homeassistant.components.binary_sensor] bmw_connected_drive: Error on device update!
ValueError: 'OPEN_TILT' is not a valid LidState

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/binary_sensor.py", line 149, in update
    self._state = not vehicle_state.all_windows_closed
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 208, in all_windows_closed
    return len(list(self.open_windows)) == 0
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 203, in open_windows
    return [lid for lid in self.windows if not lid.is_closed]
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 203, in <listcomp>
    return [lid for lid in self.windows if not lid.is_closed]
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 348, in is_closed
    return self.state == LidState.CLOSED
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 343, in state
    return LidState(getattr(self._vehicle_state, self.name))
  File "/usr/local/lib/python3.7/enum.py", line 310, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.7/enum.py", line 564, in __new__
    raise exc
  File "/usr/local/lib/python3.7/enum.py", line 548, in __new__
    result = cls._missing_(value)
  File "/usr/local/lib/python3.7/enum.py", line 577, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'OPEN_TILT' is not a valid LidState

I also downloaded https://github.com/bimmerconnected/bimmer_connected/archive/master.zip#bimmer_connected==0.5.6 and I don’t see the OPEN_TILT in the LidState enum in state.py.