Pi-Hole Version Sensor

Hello!

I am using the following to get the current installed version of Pi-Hole

  #Pihole Version
  - platform: command_line
    name: Pi-Hole Version
    command: "pihole -v"

Which gives me the following output

Pi-hole version is v4.2.2 (Latest: v4.3) 
AdminLTE version is v4.2 (Latest: v4.3) 
FTL version is v4.2.3 (Latest: v4.3.1)

I’m using an entity card to display this sensor - but was wondering if there is a way to either split the 3 lines into 3 sensors or at least format the result some way - as it currently displays like this

Annotation%202019-06-15%20224926

Ideally - I’d like a way of knowing when a new version is available, but haven’t found anything like this as of yet
Any suggestions would be appreciated!

The Pi-Hole API has a way to report whether updates are available (replace the ip address with your pi-hole server address) - http://192.168.1.40/admin/api.php?versions

@bacco007 is of course correct.

Lesson in scripting though, as long as the output format doesn’t change from what you are seeing, you could run three separate commandline sensors, viz

pihole -v|grep Pi-hole
pihole -v|grep AdminLTE
pihole -v|grep FTL
1 Like

Good idea, I never thought of doing that.
I did it like this

- platform: rest
  resource: http://192.168.1.124/admin/api.php?versions
  name: Core
  value_template: 'Core Update: {{ value_json.core_update}} Current: {{ value_json.core_current}}  Latest: {{ value_json.core_latest}}'
- platform: rest
  resource: http://192.168.1.124/admin/api.php?versions
  name: Web
  value_template: 'Web Update : {{ value_json.web_update}} Current: {{ value_json.web_current}}   Latest: {{ value_json.web_latest}}'  
- platform: rest
  resource: http://192.168.1.124/admin/api.php?versions
  name: FTL
  value_template: 'FTL Update : {{ value_json.FTL_update}} Current: {{ value_json.FTL_current}} Latest: {{ value_json.FTL_latest}}'