MediaInputSource capability -- what's the JSON_OBJECT format?

Hi, I'm not sure which category this falls into. I was just looking into a question here.

The user has a "Generic Component Audio Zone" device which supports MediaInputSource capability.

According to the docs, this supports the following attribute and command:

supportedInputs - JSON_OBJECT

setInputSource(inputName) - inputName required (STRING) - Input to select

I have an example of this JSON_OBJECT here but it's not JSON that I can tell.

{1={code=1, name=Radio}, 2={code=2, name=Kodi}, 3={code=3, name=Great Box}, 4={code=4, name=Master Box}, 5={code=5, name=Porch Box}, 6={code=6, name=White Echo}}

I'm looking for some way to parse this attribute so I can show a list of inputs to change to and then send one to the setInputSource command.

Is this same format used for all other MediaInputSource capabilities? Also, am I passing in the code or the name to the command?

thanks!

Should be more like:

["1":{"code":"1", "name":"Radio"}, "2":{"code":"2","name":"Kodi"}, ...]

Where did this come from?

A lot of the JSON attributes weren't really standardized until some need came up to do them, as started maybe a couple years ago with thermostats. If this is a built-in driver, that one could be looked at and some more clarity given around the expectations. That could be all that is (or really not) happening here. :slight_smile:

Borrowed from Mike's list of Capabilities:
setInputSource(String inputName)
where inputName is either "HDMI1" or "1", etc.

1 Like

It supports the input name or the number as a string

3 Likes

From one of my AVRs: