home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.35k stars 656 forks source link

Implement autostart on system startup #4030

Open voed opened 1 year ago

voed commented 1 year ago

I am using my old tablet as a control panel for Home Assistant and it scheduled to reboot every night for proper work. It would be great to have autostart feature out of the box, without installing 3rd party apps. Maybe even start as a launcher to reduce RAM usage?

dshokouhi commented 1 year ago

please do not combine multiple requests into one, one should be created for each request.

voed commented 1 year ago

Sorry. Fixed.

dshokouhi commented 1 year ago

For this we should make it an option in settings, we also need to do a permission check on certain android versions to autostart.

In the meantime you are more than welcome to use existing app features to automate this already.

Maybe even start as a launcher to reduce RAM usage?

I think making the app into a launcher is a bit out scope for the project and this request :)

voed commented 12 months ago

Interesting solution. Had no idea we can do this:) But for me BOOT_COMPLETED sometimes triggered before WIFI being connected, so i just used "from ACTION_SHUTDOWN" trigger:

alias: Tablet HA start
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.lenovo_yt3_x50fn_last_update_trigger
    from: android.intent.action.ACTION_SHUTDOWN
condition: []
action:
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: notify.mobile_app_lenovo_yt3_x50fn
    data:
      message: command_webview
mode: single

Thanks.

sebastienserre commented 9 months ago

Hello, I'm not sure to understand how these sensors can work if the Companion not launched on the Android phone ? Should be great to have an option in the Companion settings.

Regards

jpelgrom commented 9 months ago

Hello, I'm not sure to understand how these sensors can work if the Companion not launched on the Android phone ? Should be great to have an option in the Companion settings.

Sensors are scheduled to update periodically if you started the app once. The system will take care of restarting these updates when the device is rebooted / updated, so this already works. The feature request is for opening the app (showing a dashboard) immediately after starting the device.

jcz1 commented 1 month ago

My version of working automation:

alias: Tablet - Home Assistant autostart
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.sm_t815_last_reboot
conditions: []
actions:
  - action: notify.mobile_app_sm_t815
    metadata: {}
    data:
      message: command_webview
mode: single

For start by command you need persistent connection in app (App - Settings - Server / Connection - Persistent Connection) and app permission (just send "command_webview" command when app is running). Also "Last reboot" sensor needs to be activated in app.

Not so user-friendly. Some option in app would be great.