Skip to content

command_webview should not relaunch application #5381

Description

@kr0ner

Is your feature request related to a problem? Please describe.
I'm trying to display the front door camera feed whenever a person is detected on the stairs. This works well, but switching the view via command_webview relaunches the already running companion app and introduces about 5 - 10 seconds latency. After some days the app seems to crash completely and needs to be manually restarted. That did not happen before.

Describe the solution you'd like
In my context it makes no sense to restart the already running HA companion app ... I just want to switch tabs. Not sure if there is any use case at all that requires multiple instances. If not, this could fix my problem:

android:launchMode="singleInstance"

alternatively what this guy suggested on stack overflow

In general you can use a combination of Intent.FLAG_ACTIVITY_SINGLE_TOP, Intent.FLAG_ACTIVITY_CLEAR_TOP, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT and Intent.FLAG_ACTIVITY_NEW_TASK to accomplish what you want. However, which one (or ones) to use depends on the situation you have

https://stackoverflow.com/a/11555704

Describe alternatives you've considered, if any
I tried the solution above, but was not able to test it, because the push notifications require firebase configuration which I did not manage to get running.

Additional context

alias: Türkamera auf Tablet EG anzeigen wenn Person(en) erkannt
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.frontdoor_person_count
    above: 0
conditions: []
actions:
  - action: notify.mobile_app_tablet_eg
    metadata: {}
    data:
      message: command_screen_on
    alias: Wakeup Tablet
  - alias: Switch to Frontdoor view
    action: notify.mobile_app_tablet_eg
    metadata: {}
    data:
      message: command_webview
      data:
        command: lovelace/frontdoor
  - wait_for_trigger:
      - trigger: numeric_state
        entity_id:
          - sensor.frontdoor_person_count
        for:
          hours: 0
          minutes: 0
          seconds: 5
        below: 1
    timeout:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - alias: Switch to Frontdoor view
    action: notify.mobile_app_tablet_eg
    metadata: {}
    data:
      message: command_webview
      data:
        command: lovelace/default_view
mode: single

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions