Auto start HA Companion app on boot

How can I auto start the HA Companion app on boot and bypass the lock screen?
Can this be done with the app alone or do I need something like Fully Single App Kiosk or WallPanel?

I tried Fully Single App Kiosk but I’ll occasionally find it at the lock-screen and I need to swipe the unlock to start the Kiosk. I’ve set the companion app to “Keep Screen On” so I’m guessing it’s going to the lock screen due to something causing my tablet to reboot.

The android lock screen is 1 thing, has nothing to do with the companion app.
Can’t you disable the lock screen?

For automatically starting an app, this? https://play.google.com/store/apps/details?id=com.autostart&gl=US

yes you can disable the lock screen

no need for additional app, one can use the existing Last reboot sensor to detect when the device reboot and then issue a command_webview notification command to start the app.

https://companion.home-assistant.io/docs/core/sensors#last-reboot-sensor

https://companion.home-assistant.io/docs/notifications/notification-commands#webview

2 Likes

I’ve disabled the lock screen and I am able to issue a command_webview notification from Developer Tools / Services

how do you have your Automation set to use the “Last Reboot Sensor” value?

the value will change only when the device reboots so any state change should be fine. You can probably add a condition to make sure the trigger from state and to state do not match.

as a brief example:

trigger:
  platform: state
  entity_id: sensor.last_reboot
condition:
  condition: template
  value_template: '{{ trigger.to_state.state != trigger.from_state.state}}'
1 Like

Here are some notes from my setup which may help the next person.

Enable the reboot sensor in the companion app

  • App Configuration / Manage Sensors / Last Reboot Sensor / Enable Sensor

Set the sensor update frequency from Normal (15 minute interval) to 1 minute

  • App Configuration / Sensor Update Frequency / Fast Always

Disable the Android lock screen

  • Settings / Security / Screen lock - None

Ensure display timeout isn’t too short

  • Settings / Display / Screen Timeout - I set mine to 5 minutes

I had it initially set to 15 seconds so the screen was blanking before the automation would kick in.
The screen needs to be on for the automation to make the call to start the companion app. (at least for my setup)

Here’s my full automation in YAML

alias: Start Kitchen Tablet on reboot
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.nexus_7_last_reboot
condition:
  - condition: template
    value_template: "{{ trigger.to_state.state != trigger.from_state.state}}"
action:
  - service: notify.mobile_app_kitchen_tablet
    data:
      message: command_webview
mode: single
1 Like