itajackass
(Giuseppe Lodi Rizzini)
January 10, 2019, 12:57pm
1
I don’t find an example how to create a card and insert inside it info about new versions available about script and plugin installed inside HA.
For example i’d like to show version installed of zigbee2mqtt (and version available from github)
Also for other scripts like:
Can someone explain how to get version info about a script from github? And from actual script installed? Is it possible?
Pippyn
January 10, 2019, 1:02pm
2
see: https://github.com/custom-components/custom_updater , but the custom components need to support it for it to work.
silvrr
January 10, 2019, 1:56pm
3
You should be able to pull this from the GitHub api
- platform: command_line
command: 'curl https://api.github.com/repos/Koenkk/zigbee2mqtt/releases/latest'
name: github
scan_interval: 3600
value_template: '{{ value_json.tag_name }}'
That should currently return 1.0.1 which is the current release. Adding that sensor to your front end should be pretty easy.
I have a number of sensors like this and get notifications when they change.
here is the Github API documentation.
itajackass
(Giuseppe Lodi Rizzini)
January 13, 2019, 9:38am
5
Thank you. I got it working for display last update available. But how to show actual version installed? (where I can find that value in automatic)? example for zigbee2mqtt
Edit: i see actual installed version inside file /opt/zig2mqtt/npm-shrinkwrap.json
File structure:
{
"name": "zigbee2mqtt",
"version": "1.0.1",
"lockfileVersion": 1,
"requires": true,
...
}
But i don’t know how to retrieve the version from a local file. Curl is still valid? scan_interval is useless in local files…
silvrr
January 13, 2019, 3:46pm
6
Try to use the file sensor on that file.
itajackass
(Giuseppe Lodi Rizzini)
January 13, 2019, 3:48pm
7
Yes i’ve found it.
I tried:
- platform: file
file_path: '/opt/zigbee2mqtt/npm-shrinkwrap.json'
name: zigbee2mqtt_current_version
value_template: '{{ value_json.version }}'
but in dev-state list my sensor doesn’t appear. How can I debug this?
silvrr
January 13, 2019, 3:50pm
8
Did you whitelist the directory?
Check the error log.
itajackass
(Giuseppe Lodi Rizzini)
January 13, 2019, 4:00pm
9
ok I’ve whitelisted now.
now i get “unavaible” instead number version…
silvrr
January 13, 2019, 4:23pm
10
Does your home sssistant user have permissions to read that file?
itajackass
(Giuseppe Lodi Rizzini)
January 13, 2019, 4:38pm
11
i don’t know. where i can set it?
Tried with no success:
cd /opt/zigbee2mqtt
sudo chmod a+rw *
itajackass
(Giuseppe Lodi Rizzini)
January 15, 2019, 8:04pm
12
I checked with command:
namei -l ./npm-shrinkwrap.json
and i get:
f: ./npm-shrinkwrap.json
drwxr-xr-x pi pi .
-rwxrw-rw- pi pi npm-shrinkwrap.json
how can i change permission to pi user and homeassistant user?