How do I open Home Assistant for Android using Home Assistant?

I have a dashboard that I would like to open on my phone whenever I start charging wirelessly, so I am trying to use the command_activity notification to achive this. Here is what I have so far.

alias: James phone open dashboard
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.le2123_charger_type
    to: wireless
condition: []
action:
  - service: notify.mobile_app_le2123
    data:
      message: command_activity
      data:
        intent_package_name: io.homeassistant.companion.android
        intent_action: android.intent.action.MAIN
        intent_category: android.intent.category.LAUNCHER
mode: single

Unfortunately, when I run this, the android device shows the following error in a toast notification.

Unable to send activity intent, please check command format

The provided example does work with this device.

What am I getting wrong here?

Thanks!

Just looking at the doc you linked the only thing is the speech marks around everything.

No idea if that is the issue or not.

Maybe this topic can help you:

You have to use open URL instead of an intent.

YAML does not require strings to be double quote encapsulated

https://yaml.org/spec/1.2.2/#10113-generic-string

What is the open URL of the Home Assistant Android app?

You can try this (copied from the forum post I mentioned)

    action:
      - service: notify.mobile_app_<your_device_id_here>
        data:
          title: "Motion Detected in Backyard"
          message: "Someone might be in the backyard."
          data:
            # iOS URL
            url: "/lovelace/cameras"
            # Android URL
            clickAction: "/lovelace/cameras"

In case you still finding a solution, here is my functional code for open specific lovelace view based on service call.
Based on this I am able to popup remote control (lovelace view) to control my TV on mobile by voice assist (additional automation).

all is based on documentation here
https://companion.home-assistant.io/docs/integrations/url-handler/

service: >-
  notify.mobile_app_{{state_attr(state_attr('person.tom',
  'source'),'friendly_name')}}
data:
 message: "command_activity"
 data:
  intent_package_name: "io.homeassistant.companion.android"
  intent_action: "android.intent.action.VIEW"
  intent_uri: "homeassistant://navigate/lovelace/android-tv-remote"

3 Likes