BMW Connected Automation - Remind me to lock my car

Nice work and thanks for sharing. Also the actionable notifications for iOS is really nice. Reminds me that I have to put some time in those automations :wink:
I have also put a link to this topic on the bimmer_connected Github page -> https://github.com/bimmerconnected/bimmer_connected/discussions/253.

Regarding the bmw_connected_drive.update_state automation. I would recommend to not make an automation for this which checks the data every 10 seconds. That means a lot of extra API calls
compared to the current 5 minute interval and I am not sure how BMW will deal with that on a long term.

My suggestion would be that you call the service on the front door trigger, put in a delay after that for e.g. 30 seconds to make sure the HA data get’s updated and then check if your car is still unlocked. That would still be quick enough.

BTW do you see that the data regarding the locks gets updated really faster by calling the service? Our view is that the service does not trigger an update from the car but gets the data from the BMW servers. So this service does not interact with the car.

Thanks for sharing on the other thread and for the recent hot fix too. Out of all of my automations i think these ones are my favourites.

On the update frequency. I’d agree that I’d prefer not to have to update so regularly. However, I’d originally planned to make these automations with read only access. But I was finding that using the door lock status binary sensor rather than the status of the lock entity was proving very slow to update and therefore was not reliable for these anti theft automations. One of my automations also shows a camera view pointed at my car when the car is unlocked. I still hope to go back to read only at some point due to the inherent security concerns around the lock service. Eg. In your example, even if I delay the automation by 30seconds, isn’t there a risk that the data won’t be refreshed for up to another 9.5 minutes??

I will try what you suggested with the delay and see how it goes. Unfortunately as soon as the automation becomes less than 100% reliable it’s much less useful.

Yes I think I’d agree that the lock entity does not seem to rely on the data refresh in the same way as for example the lock status binary sensor. Although it’s still not immediate.

That’s indeed possible I guess, but you can add another refresh after 30 seconds to avoid that maybe?

Any updates on this?

Do you see different update behaviour when calling the update_state service for the lock entity and the lock status binary sensor? I have never tested this so curious what your experencies are with this.

Fantastic… like you, I’m new to this, so still finding my way with integrations, automations etc. I would be really grateful if you could state your " * If it’s after 8pm and the car is at home and unlocked, remind me to unlock it" script…

Hi Gerard, I’m really sorry for the delay in coming back to you. My connected drive service subscription expired and I am selling the car in 2 months (third child), so I’m finding it difficult to make the time to look into this any more.

The camera part of the notification might confuse somewhat, but this is the automation (I’m guessing that’s what you meant)

- id: carunlockedreminder34928374982374
  alias: Car Unlocked After 8 Notification
  description: When it gets to 8pm notify me if the car is unlocked
  trigger:
  - entity_id: binary_sensor.*i3_94_rex*_door_lock_state
    platform: state
    to: 'on'
  condition:
  - after: '20:00:00'
    condition: time
  action:
  - data:
      data:
        attachment:
          content-type: jpeg
        entity_id: camera.*nest_cam*
        push:
          category: *camera*
        url: *nestmobile://*
      message: It's 8pm and the Car is still open!!
    service: notify.*mobile_app_iphone_sk*

You could delete everything between the first data and message if you didnt want to have a snapshot from a camera in the notification and open a URL when the notification is opened, which will open the Nest app using it’s iOS custom URL in the above case. Everything which MUST be edited for your setup is surrounded by asterisks so just copying the automation into your config is not going to work.

Brilliant… thank you so much… I will give it a try…

No problem and thanks again for sharing your automation here :+1:
I can image you have other priorities right now :grinning:

My ConnectedDrive service expired as well, but all is still working (knocking on wood).

I made a complication for my Apple Watch containing information on my car → lock state, range and fuel left. The complication is not updating very often, but it gives a good overview if I left my car unlocked or not or when I need to go to the gas station.

IMG_2895

Well, I’m wondering whether my 640D (2014) is just too old…? Even BMW connected app on the iPhone is a bit flakey - doesn’t always work - but I’m not getting anywhere with locking/unlocking the doors even if I set read_only to false. In fact, it feels a bit like the iOS app in that it goes through the motions of doing what you ask, but doesn’t actually do it. Has anyone else encountered (or overcome) these sorts of issue? I will happily leave this integration (in the too difficult pile) if others have failed too ;>)

I really struggled with it at first. Could you share your automation yaml? I assume under developer tools you can see all the bmw entities along with their state attributes?

alias: 8.00pm Check BMW 640D car is locked
description: Check BMW 640D car is locked
trigger:

  • platform: time
    at: ‘20:00:00’
    condition:
  • condition: state
    entity_id: lock.640d_lock
    state: unlocked
    action:
  • service: notify.mobile_app_ _iphone_xs_max
    data:
    title: BMW 640D
    message: ‘Your car is {{ states(’‘lock.640d_lock’’) }}’
    mode: single

The strange bit is the ‘unknown’ state… regardless of whether the care is locked or unlocked. I can also set the state to locked or unlocked, but it doesn’t do anything…

Sorry, forgot to hit reply - see below… thanks Simbieski…

Do you have a binary sensor entity called something similar like binary_sensor.i3_94_rex_door_lock_state
you could use this as an alternative to the lock entity since you’re only wanting to read the state.

Yeah I noticed that hass is still able to connect to bmw connected which was surprising. This watch complication is great. Been meaning to get round to try watch complications.

Mmmm… No, but its odd that some of the other entities that existed before like lights flashing have disappeared. Perhaps I should remove the integration (remove the lines from the config file?), reboot, then add them back in and reboot…

Yeah I’m not sure why your lock state is unknown. Are you getting any bmw related errors in the log?

Worth a try adding integration again. Just add a # to start of every toe you’d like to comment out. Then restart server. Then remove the # and restart again.

One error - ‘vehicle tracking’ - see below, but not lock related…

Logger: bimmer_connected.vehicle_status
Source: /usr/local/lib/python3.8/site-packages/bimmer_connected/vehicle_status.py:140
First occurred: 16:36:05 (1 occurrences)
Last logged: 16:36:05

Vehicle tracking is disabled

Searching for a long time where i can put my question regarding some automation what i want with BmW connected services and finally found this thread!!

Now the question is: In HA with this integration we can see the how much fuel we have and we can see how many KM range we have totally.

When we go to the tank station and fill the fuel, then we see the rest fuel range right?!

Now i want now that HA register the amounts somewhere and as result get the KM range i have done from the last fuel tank up to know every time.

How can we do that?

We have all the data from the integration what we need but where to put/calculate this data?

I have grafana with inlfuxdb as an option to use.

Hi Simbieki,

Thank you for your post. I would be interested to see how you are getting on with it (now over 2 years later). I would also like to see the other automations you are using.
I am trying to do similar myself;
i3 Automation Charging

Any pointers would be welcome.