How to send notifications to Bmw connected

Not sure how to fill in target and data to be able to send to BMW

the other question what the difference between the two services
Skärmavbild 2021-10-15 kl. 18.08.22

Thanks in advance!

Interested in the replies as I have tried both (quite a while ago now) and could never get it to work.

1 Like

It looks like we are just interested with title and message when you are using the second service call (330e _xdrive). If you use the first one, you have to specify target as 330e_xdrive, i believe it is name of the car.

Btw, i don’t have the integration, just speculating from code.

The Message and Title seems not to be enough…

Try checking your logs, there should be something in there about why it failed. :smiley:

Ok been trying this today:

service: notify.bmw_connected_drive_m240i
data:
  message: test message 2
  title: test title 2

Error:
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: The My BMW API does not support sending messages without location.

Cant find any documentation on how to use either of the two notification service calls.

Edit:
Also just noticed that via the official ios app there is no function to send a message - only a location with no ability to add text or notes, just location.

As already mentioned - not supported without location. Next question is how to send with location?

2021-10-17 19:49:15 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: The My BMW API does not support sending messages without location.
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 371, in _async_step
await getattr(self, handler)()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 571, in _async_call_service_step
await service_task
File “/usr/src/homeassistant/homeassistant/core.py”, line 1491, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1526, in _execute_service
await handler.job.target(service_call)
File “/usr/src/homeassistant/homeassistant/components/notify/init.py”, line 174, in _async_notify_message_service
await self.async_send_message(**kwargs)
File “/usr/src/homeassistant/homeassistant/components/notify/init.py”, line 149, in async_send_message
await self.hass.async_add_executor_job(
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 52, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/notify.py”, line 73, in send_message
_vehicle.remote_services.trigger_send_message(
File “/usr/local/lib/python3.9/site-packages/bimmer_connected/remote_services.py”, line 300, in trigger_send_message
self._send_message(Message.from_text(data[‘text’], data.get(‘subject’)))
File “/usr/local/lib/python3.9/site-packages/bimmer_connected/remote_services.py”, line 350, in _send_message
raise NotImplementedError(‘The My BMW API does not support sending messages without location.’)
NotImplementedError: The My BMW API does not support sending messages without location.
2021-10-17 19:49:15 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [14057974859] Error handling message: Unknown error
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py”, line 26, in _handle_async_response
await func(hass, connection, msg)
File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 525, in handle_execute_script
await script_obj.async_run(msg.get(“variables”), context=context)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1219, in async_run
await asyncio.shield(run.async_run())
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 353, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 371, in _async_step
await getattr(self, handler)()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 571, in _async_call_service_step
await service_task
File “/usr/src/homeassistant/homeassistant/core.py”, line 1491, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1526, in _execute_service
await handler.job.target(service_call)
File “/usr/src/homeassistant/homeassistant/components/notify/init.py”, line 174, in _async_notify_message_service
await self.async_send_message(**kwargs)
File “/usr/src/homeassistant/homeassistant/components/notify/init.py”, line 149, in async_send_message
await self.hass.async_add_executor_job(
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 52, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/notify.py”, line 73, in send_message
_vehicle.remote_services.trigger_send_message(
File “/usr/local/lib/python3.9/site-packages/bimmer_connected/remote_services.py”, line 300, in trigger_send_message
self._send_message(Message.from_text(data[‘text’], data.get(‘subject’)))
File “/usr/local/lib/python3.9/site-packages/bimmer_connected/remote_services.py”, line 350, in _send_message
raise NotImplementedError(‘The My BMW API does not support sending messages without location.’)
NotImplementedError: The My BMW API does not support sending messages without location.

Found some info for you guys. It seems that this feature have been removed because it is not supported for rest_of_world and north_america anymore. See here: https://github.com/bimmerconnected/bimmer_connected/releases/tag/0.7.19

Can i assume that you guys already read the help page before reading the code more?

ahh thanks for clarification.

1 Like