XML preset list

Hi all,

Im new to openhab and still bit struggling with it’s environment.
I’m looking for the (a/best) way to retrieve BluOs preset list from a bluesound player.
It gives an array with preset id (number) and info like stream (name/url) or source (optical1).

<presets prid="15">
<preset url="TuneIn:s17523/http://opml.radiotime.com/Tune.ashx?id=s17523&formats=wma,mp3,aac,ogg,hls&partnerId=8OeGua6y&serial=78:8A:20:43:E0:D5" id="1" volume="24" name="98.9 | NPO Radio 1 (Classic Hits)" image="http://cdn-radiotime-logos.tunein.com/s17523q.png"/>
...
</presets>

I have a http binding to the device, with the url command “Presets” i could retrieve a xml list.
I was thinking about Xpath but i probably have to do some scripting to get an array with preset names (and the ids as array index)

But how should I approach and how to get this (with actions “Preset&id=2”) in the web interface?

Best regards,

Ps. I inserted a part of the xml within < code > but it’s not visible.

code is marked with three backticks ` in a row.
```
<Your Code goes here>
```
will result in

<Your Code goes here>

Hi @Udo_Hartmann ,

Thank you for your reply. It’s now visible in my post.

Best regards,

There are no ‘array’ Items in openHAB, so that is something you would have deal with in whatever structures your chosen rule language uses.

First step though is to fetch your XML into a single String type Item, ready for further processing.
You’d probably use the HTTP binding for that, as you’ve guessed.
An early decision for you to make … when to fetch it?
On demand, or periodically? Binding does either.

Hi @rossko57 ,

Thank you for your reply.
Yea i would prefer to use binding. But should I retrieve it as a channel “presets” on a HTTP binding?

Or should I use a “command” with the query as text in a (java-)script?
I’m a bit struggling with the (abstraction) layering of obenhab and all possibilities.

The command for retrieve is very simple:
http://192.168.2.20:11000/Presets
Which returns a list of presets each having an ID nr.

The command to select a preset is
http://192.168.2.20:11000/Preset?id=

I have already a http binding to 192.168.2.20:11000
and have made a GUI item list to select a preset and send using channel url command “Preset?id=%2$s”

In the end I just would like to have a list of preset channels to select. I see a lot of possible ways but documentation seems to be a bit behind.
Or should I make the retrieve of items also indexable (id=)

Best regards,

Well, I don’t know how you want to do it. I’ve no idea what is important to you, or what constraints you are working with.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.