Update Pi System and HA from frontend with a button

I’m running rasbian with Home Assistant. (not HASSIO)
Main user is “pi”
Also i’ve a user “homeassistant”

At the moment I’ve only a card that show me installed version, and available version (not sure resource link is good… sometime hassio and home assistant are not sync in version update for some hours…).


  - platform: rest
    resource: https://s3.amazonaws.com/hassio-version/stable.json
    name: Hassio Version
    value_template: "{{ value_json.homeassistant.default }}"
    scan_interval: 3600

  - platform: version
    name: Installed Version


  - icon: mdi:home-assistant
    title: My System
      - type: glance
        title: Home Assistant
          - entity: sensor.installed_version
            name: Installed
            icon: mdi:folder-download
          - entity: sensor.hassio_version
            name: Available
            icon: mdi:github-circle
        columns: 2

Now I’d like to create an automation to update the system and HA from frontend (maybe clicking on my card in lovelace “Available” that open a popup with a button “UPDATE”… Is it possible? at the moment click on it appear a popup with a “no sense” hours-graph…)

Commands I’ve always used to update both system and HA are from https://www.home-assistant.io/docs/installation/hassbian/upgrading/

Is it possible to implement my idea to combine these commands in a button inside a popup?
Also…is it possible to view the upgrading logs like in a shell or…a popup log to ensure script are executed correctly?

Yes, use a bash script and launch the bash script from a button on homeassistant.

I was doing this, but my scripts have changed a bit recently due to moving to docker. You can have a look at my scripts on my GitHub for inspiration and hopefully it’ll point you in the right direction.

If you can’t work it out I can probably drum you everything you need up in a couple of days, but I’m just heading out now for a new years eve party, and it’s my birthday tomorrow so ain’t no coding happening for the next 24 hours at least :smile:

Hi thanks. I’ve already seen your config and i’m going to try again with my commands… First time i got no success… And without a log i can’t know what gone wrong…it is the reason i’d like to see a log event when i launch the script (log response for every command line maybe)… :)… Also i’m looking for a way to show the button only inside a popup instead directly in a card if it possible.
For now, thank you and happy new year and birday :wink:

You need to make sure that homeassisant user has sudo access.

I’m a little newbie about grant access :frowning: where and how can I set homeassistant user as a sudo, PERMANENTLY?

You can do more research to get more fine grained control about allowing only individual commands to run, but the basic info is on the pi website


Note of course, that allowing homeassistant user sudo access is reducing your security. It was set up that way for good reasons and you are avoiding this purely for your convenience. Personally, I prefer the extra security and I am happy to enter a few commands every few weeks.