Has anyone managed to use the mediaInputSource capability working? I can set it up and it gets added but I can’t seem to define what inputs are available and set them or init them.
https://developer.smartthings.com/capabilities/mediaInputSource
It is a proposed capability.
Proposed Capabilities are scheduled to be finalized and released in the future, but are subject to change. You can begin incorporating these Capabilities into your integration, but the Capability may not function in its entirety, particularly in the mobile app detail view.
I knew it was a proposed capability but based on the definition in the proposed caps section of the dev site I kind of hoped that what was listed in the capability would work but be subject to change without notice.
I basically want to use it to change the source on a display I’m playing with.
I just can’t get it to populate the initial view. I can choose the inputs from an automation though which makes me think I’m just not understanding how to initialise the default view properly.
What do you have so far ?
I tried using mediaInputSource
a while back but ended up using custom capabilities. I think I made that choice because the available input options in mediaInputSource
were too restrictive, but it’s possible that there’s some other issue with the capability. There are many stock (both proposed and production) capabilities that just don’t work right.
This should be what you need to do to populate the list of enabled sources (typing on phone, so apologies for bugs):
local supportedInputs = {"AM","FM","HDMI1","HDMI2"}
local event = mediaInputSource.supportedInputSources({value = supportedInputs})
device:emit_event(event)
And then you’ll also need to initialize the value, preferably by querying your device but this will just give you a starting place to see if the capability works:
device:emit_event(mediaInputSource.inputSource({value = "FM"}))
Interesting and many thanks for taking the time to reply.
Since my original post ive been trying things out and discovered that i can limit the input choice in the proifile itself rather than setting supportedInputs.
- id: mediaInputSource
config:
values:
- key: "inputSource.value"
enabledValues:
- HDMI1
- HDMI2
- HDMI3
- USB
- wifi
- aux
version: 1
Then once an input is selected i can get the selection with
command.args.mode
which returns the string of the name or value e.g HDMI1 and i can then action a command to the device etc.
Once i have confirmed the comand has been recieved and actioned on the display I then do
device:emit_event(capabilities.mediaInputSource.inputSource(command.args.mode))
Not sure this last is the correct way to do it but it seems to do what i want without errors or failure.
Ultimatley i think i will need to build a custom capability profile so that i can name the sources correctly. For the moment though this is a proof of concept so im not too worried.
Cheers Hugh