I would like to create a radio-station switch for my Sonos speaker consiting of one input select and two buttons. That’s easy, but now comes the beef.
I’d like to use a data structure which has for each station a name, an url and up to three options. In JSON it would look like this one:
{
"stations": [
{
"name": "Station One",
"url": "https://one.example.com",
"inital_volume": 120
},
{
"name": "Radio two",
"url": "https://two.example.com",
"inital_volume": 100
},
{
"name": "LiveTalk",
"url": "https://three.example.com",
"inital_volume": 110
}
]
}
What I had not found an solution for is a way, how to read and access the data structure from within an automation or a script.
I’m looking for:
- create a drop down the data structure. I know about “input select - set_options”, but don’t know how to access my data object from within an automation and how to iterate on it.
- create a script to fetch one station by a nummerical index. Having this I can create a next station / previous station switch and push the URL to my Sonos Speaker
And yes, I know about Media Card, Media Player, Radio Player … They do not offer, what I’m looking at. And I would use my own data structure, not the favorites from my Sonos.
Any suggestion on this?
Hope “Configuration” is the right place for this, looks like almost any similar discussion happend here.
Cheers, Christian