Installed Version using AiO

I am trying to get the installed version to show on my sensor.hass_installed. but can’t seem to get it to work in a virtual environment. Has anyone figured out how to get this to show? Should I be writing a shell script to set the variable first?

- platform: command_line
  command: "pip3 show homeassistant | grep -w Version: | cut -d: -f2"
  name: 'HASS Installed'
  scan_interval: 60

Try pip3 show homeassistant | grep -w ^Version: | cut -d: -f2

At the moment you seems to get Metadata-Version: 1.1 and Version: 0.37.0.dev0.

The command (both of them) work when I use these commands first:

sudo su -s /bin/bash homeassistant
source /srv/homeassistant/homeassistant_venv/bin/activate

Here is the result after I bump the service:

You can always check it by clicking the three bars in the upper right and then the about tab.

I just want to automate it and get it working because my friend has his working but he doesn’t use AiO.

I do this with two commandline sensors:

-  platform: command_line
   command: python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])"
   name: Current HA Version

-  platform: command_line
   name: Installed version
   command: "/srv/hass/hass_venv/bin/hass --version"

thanks - are you running AiO?

Yes, but an older install. Your paths may vary if you did yours recently; It’s noted here:

1 Like

Reminds me of Star Wars:

“It’s an older code, but it checks out…”

1 Like

boom - worked - thanks!!!

- platform: command_line
  command: "/srv/homeassistant/homeassistant_venv/bin/hass --version"
  name: 'HASS Installed'
  scan_interval: 60

1 Like

Well thanks back - I’mma change my icons! Yours are much more appropriate!

Can you tell me which ones you used for the release and installed sensors? I really like those much better; mine are lame!

here you go:

   sensor.hass_installed:
      friendly_name: 'Installed'
      icon: mdi:folder-download
    sensor.hass_release:
      friendly_name: 'Release'
      icon: mdi:github-circle
1 Like

Thanks; I just changed them now. I’m a freak about getting the right icons for all the sensors/switches, etc.

@pauldgifford Can you share your config for the up time and SD card sensors?

https://github.com/pauldgifford/hass-config

1 Like

For anyone on the hassbian image install the following works to pull the current version.

  -  platform: command_line
     name: Installed version
     command: "head -5 /home/homeassistant/.homeassistant/.HA_VERSION"
2 Likes