Volumio - Any Way to Extract URI?

I’ve got a couple of Volumio Pi’s, which I use as internet radios. Everything works fine to play stuff etc, but I’m now digging in a little deeper as I want to make some remote control/displays for them using a separate Pi and something like a ScrollPhat.

Whilst I can get the song titles via the media_title attribute (usually, subject to what the station includes in its stream) I’m struggling to get the URI to know which station is actually playing. I’ve got it set up with a playlist of stations (with prev/next to flick through them), but of course other than idents playing I have no idea which station I’m actually listening to.

In the Volumio API the URI is shared (via curl of volumio_IP_address/api/v1/getState for example), but the Volumio integration doesn’t seem to make that available so I can work with it inside HA?

For reference, the Volumio API details are here.

To expand a bit, this is what I see for the states of the media player entity in HA:

  - Absolute 80s
  - Absolute Classic Rock
  - Absolute Radio
  - RadioList
volume_level: 0.49
is_volume_muted: false
media_content_type: music
media_duration: 0
media_title: Listen To The Music - The Doobie Brothers
shuffle: true
friendly_name: RadioPiZero
entity_picture: >-
supported_features: 196159

But if I look directly at it via it’s API, I can see this:

{"status":"play","position":1,"title":"Listen To The Music - The Doobie Brothers","artist":null,"album":null,"albumart":"/albumart","uri":"http://mp3-ac-128.timlradio.co.uk/","trackType":"webradio","seek":171536,"duration":0,"samplerate":"","bitdepth":"","channels":2,"bitrate":"112 Kbps","random":true,"repeat":true,"repeatSingle":false,"consume":true,"volume":49,"mute":false,"disableVolumeControl":false,"stream":true,"updatedb":false,"volatile":false,"service":"webradio"}

You can see the URI in the direct API ("uri":"http://mp3-ac-128.timlradio.co.uk/" - Absolute Classic Rock in this case) but it’s not available in the attributes of the HA media_player entity.

Is there a way I can get that information into HA, either via the integration or some other way?

Edited to ask - can I do this with a command line sensor to read the getState API method directly via curl? Can anyone give me a hint here as to what the set-up might be?

To come back and answer my own question as there was no other inputs.

Had to make a new rest template sensor for it, and then it’s working with a couple of caveats. Just in case anyone else needs it, the sensor is:

  - platform: rest
    name: radio.station
    value_template: >-
      {% set stations = {
        "http://mp3-a8-128.timlradio.co.uk/": "Absolute 80s",
        "http://mp3-ac-128.timlradio.co.uk/": "Absolute Classic Rock",
        "http://mp3-ar-128.timlradio.co.uk/": "Absolute Radio",
      } %}
      {{ stations.get(value_json.uri, 'Radio') }}

Where is the IP address that the Volumio pi is on, and the three URI’s are the main ones I use (all Absolute radio stations). It sends back the friendly names associated with the URI’s, or “Radio” if it’s a different URI.

Would still be nicer to have this included into the integration though, as there is one drawback to doing it this way. As it’s a sensor, there is the update delay involved which can be anything up to 30s.

What would be the best way to make a feature request for ask for addition into the integration? A feature request post here somewhere, or is there somewhere more appropriate for the Volumio integration?