Anyone use the command_media notifications in the android app?

Hi all,

The latest android app changes the notification command messages (https://github.com/home-assistant/android/pull/1759) and I was wondering if anyone who uses them has successfully changed to the new fields and gotten them to work?

According to the change link above, and also in the HA companion documentation (Notification Commands | Home Assistant Companion Docs) it implies that:
channel changes to media_package_name
title changes to media_command (and needs to be moved into the data element)

This is my resulting notification action (as an example):

device_id: xxxxx
domain: mobile_app
type: notify
message: command_media
data:
  media_command: stop
  media_package_name: com.kodarkooperativet.blackplayerex

I’m not getting any result out of running the actions however. If I turn on notifications (from Android settings), then the notification appears (confirming the HA server is sending to the HA app) but are not actioned, so my message isn’t right, but from what I can see in the documentation, I can’t see anything wrong.

I have also tried using the service call as per the HA documentation example, no difference.

If all else fails, I may end up just rolling back the HA Companion app via apk download.

Those parts are not in the example you linked to.

I did try and use the service call as per the example but it didn’t make any difference.

I had set up device actions with action of “send a notification” which worked prior to this latest update.

But I will try it again later when I’m home.

I also tried adding a service call to my script, still no luck.

service: notify.mobile_app_XXXXX
data:
  message: command_media
  data:
    media_command: next
    media_package_name: com.kodarkooperativet.blackplayerex

The HA log on the phone now shows two messages (which look identical, despite one being a service call and the other being a device notification action), both result in “Invalid media command received, posting notification to device”.

08-30 16:39:04.965 21443 21524 D WebSocketRepository: Message number 1 received: {"id":1,"type":"event","event":{"message":"command_media","data":{"media_command":"next","media_package_name":"com.kodarkooperativet.blackplayerex"},"hass_confirm_id":"XXXX"}}
08-30 16:39:04.965 21443 21524 D WebSocketRepository: Websocket: onMessage (text)
08-30 16:39:04.966 21443 21524 D WebSocketRepository: Message number 1 received: {"id":1,"type":"event","event":{"message":"command_media","data":{"media_command":"next","media_package_name":"com.kodarkooperativet.blackplayerex"},"hass_confirm_id":"YYYY"}}
08-30 16:39:04.967 21443 21560 D WebSocketRepository: Sending message 3002: {type=mobile_app/push_notification_confirm, webhook_id=ZZZZ, confirm_id=XXXX, id=3002}
08-30 16:39:04.968 21443 21560 D WebSocketRepository: Message number 3002 sent
08-30 16:39:04.972 21443 21524 D WebSocketRepository: Websocket: onMessage (text)
08-30 16:39:04.972 21443 21524 D WebSocketRepository: Message number 3002 received: {"id":3002,"type":"result","success":true,"result":null}
08-30 16:39:04.974 21443 21474 D MessagingService: Processing device command
08-30 16:39:04.975 21443 21474 D WebSocketRepository: Sending message 3003: {type=mobile_app/push_notification_confirm, webhook_id=ZZZZ, confirm_id=YYYY, id=3003}
08-30 16:39:04.975 21443 21474 D WebSocketRepository: Message number 3003 sent
08-30 16:39:04.977 21443 21443 D UrlRepository: localUrl is: false and usesInternalSsid is: false
08-30 16:39:04.979 21443 21443 D MessagingService: Invalid media command received, posting notification to device
08-30 16:39:04.980 21443 21524 D WebSocketRepository: Websocket: onMessage (text)
08-30 16:39:04.985 21443 21524 D WebSocketRepository: Message number 3003 received: {"id":3003,"type":"result","success":true,"result":null}
08-30 16:39:04.988 21443 21443 D MessagingService: Show notification with tag "null" and id "-303598573"
08-30 16:39:04.988 21443 21474 D MessagingService: Processing device command
08-30 16:39:04.991 21443 21443 D UrlRepository: localUrl is: false and usesInternalSsid is: false
08-30 16:39:04.993 21443 21443 D MessagingService: Invalid media command received, posting notification to device
08-30 16:39:04.999 21443 21443 D MessagingService: Show notification with tag "null" and id "-303598559"

Update for anyone who comes across this issue.

I posted an issue on github here: https://github.com/home-assistant/android/issues/2834
A workaround was posted in the github link. Adding a command: along with media_command: with the same action, things will work again.
Example:

service: notify.mobile_app_XXXXX
data:
  message: command_media
  data:
    command: next
    media_command: next
    media_package_name: com.mediaplayer
1 Like

A PR was also submitted to correct this behavior. Thank you for reporting the issue on GitHub.