Card to check updates availables from github

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:

  • haaska

Can someone explain how to get version info about a script from github? And from actual script installed? Is it possible?

see: https://github.com/custom-components/custom_updater, but the custom components need to support it for it to work.

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.

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…

Try to use the file sensor on that file.

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?

Did you whitelist the directory?

Check the error log.

ok I’ve whitelisted now.
now i get “unavaible” instead number version…

Does your home sssistant user have permissions to read that file?

i don’t know. where i can set it?
Tried with no success:

cd /opt/zigbee2mqtt
sudo chmod a+rw *

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?