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
fabaff
(Fabian Affolter)
January 20, 2017, 3:57pm
2
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:
silvrr
January 20, 2017, 4:17pm
4
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.
rpitera
(Robert Pitera)
January 20, 2017, 4:20pm
7
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"
rpitera:
thanks - are you running AiO?
rpitera
(Robert Pitera)
January 20, 2017, 4:28pm
9
Yes, but an older install. Your paths may vary if you did yours recently; It’s noted here:
1 Like
boom - worked - thanks!!!
- platform: command_line
command: "/srv/homeassistant/homeassistant_venv/bin/hass --version"
name: 'HASS Installed'
scan_interval: 60
1 Like
rpitera
(Robert Pitera)
January 20, 2017, 4:33pm
12
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
rpitera
(Robert Pitera)
January 20, 2017, 4:39pm
14
Thanks; I just changed them now. I’m a freak about getting the right icons for all the sensors/switches, etc.
silvrr
January 20, 2017, 6:52pm
15
@pauldgifford Can you share your config for the up time and SD card sensors?
silvrr
January 21, 2017, 3:07am
17
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