Skip to content

Instantly share code, notes, and snippets.

@narfel
Created January 26, 2020 07:37
Show Gist options
  • Save narfel/7e34750dca76924cc9a90ed33f10ce63 to your computer and use it in GitHub Desktop.
Save narfel/7e34750dca76924cc9a90ed33f10ce63 to your computer and use it in GitHub Desktop.
Home Assistant: apt packages sensor
sensor.yaml:
------------
- platform: command_line
name: "Apt Sensor"
command: "ssh -o StrictHostKeyChecking=no <user>@<host> -p 22 -i /config/sshkey/id_rsa /path/to/get_apt.sh"
scan_interval: 43200 #check every 12h
command_timeout: 60
get_apt.sh:
-----------
LANG=C apt-get upgrade -s |grep -P '^\d+ upgraded'|cut -d" " -f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment