Can't figure out why Dynamic Command Description Provider isn't working

Looking for another set of eyes. I’ve tried to deploy DynamicCommandDescriptionProvider on the androidtv binding and I can’t get it to post the metadata to the channel. No exceptions/errors thrown. I mirrored the ADB binding as best as I can find. When I dump the List of CommandOption right before sending .setCommandOptions it sends back exactly what I’d be expecting. If someone who has worked with this before wouldn’t mind taking a peak over the code I’d appreciate it! Thank you!

EDIT: Just to throw in, the goal here is that we get a database of available apps from the androidtv and we want to populate the metadata on the app channel so that if it’s added to a sitemap, UI, etc that it creates a list of options for the user to pick (and then send as a command to the channel).

    logger.trace("CDP List: {}", commandOptions.toString());
    commandDescriptionProvider.setCommandOptions(new ChannelUID(getThing().getUID(), channelName), commandOptions);

2023-02-04 09:03:51.343 [TRACE] [g.androidtv.internal.ShieldTVHandler] - CDP List: [CommandOption [command=com.google.android.youtube.tv, label=YouTube], CommandOption [command=com.android.tv.settings, label=Settings], CommandOption [command=com.hbo.hbonow, label=HBO Max], CommandOption [command=com.imdbtv.livingroom, label=IMDb TV], CommandOption [command=com.google.android.backdrop, label=Backdrop Daydream], CommandOption [command=com.google.android.videos, label=Play Movies & TV], CommandOption [command=com.google.android.tv, label=Live Channels], CommandOption [command=com.disney.datg.videoplatforms.android.watchdc, label=DisneyNOW], CommandOption [command=com.google.android.play.games, label=Play Games], CommandOption [command=com.plexapp.mediaserver.smb, label=Plex Media Server], CommandOption [command=com.google.android.youtube.tvmusic, label=YouTube Music], CommandOption [command=com.google.android.katnisspx, label=Google app for Android TV (Pictures)], CommandOption [command=com.netflix.ninja, label=Netflix], CommandOption [command=com.google.android.tvlauncher, label=Android TV Home], CommandOption [command=com.nvidia.tegrazone3, label=NVIDIA Games], CommandOption [command=com.google.android.katniss, label=Google app for Android TV], CommandOption [command=com.android.vending, label=Play Store], CommandOption [command=com.plexapp.android, label=Plex], CommandOption [command=air.com.vudu.air.DownloaderTablet, label=VUDU], CommandOption [command=com.android.gallery3d, label=Gallery], CommandOption [command=com.google.android.youtube.tvunplugged, label=YouTube TV], CommandOption [command=com.amazon.amazonvideo.livingroom, label=Prime Video], CommandOption [command=com.disney.disneyplus, label=Disney+], CommandOption [command=com.nbcuni.nbc.androidtv, label=NBC], CommandOption [command=com.amazon.music.tv, label=Amazon Music], CommandOption [command=com.espn.score_center, label=ESPN], CommandOption [command=com.google.android.music, label=Play Music]]

openhab> service:list | grep DynamicCommandDescriptionProvider
[org.openhab.core.thing.type.DynamicCommandDescriptionProvider, org.openhab.binding.androidtv.internal.AndroidTVDynamicCommandDescriptionProvider]
 component.name = org.openhab.binding.androidtv.internal.AndroidTVDynamicCommandDescriptionProvider
openhab>

So apparently this is working, but only when viewed through a Selection in a sitemap. It’s not visible via the main UI or CLI. Is this expected behavior?

If you query the Item in the REST API explorer does it list the commandDescriptions? Note that command descriptions is only about what commands can be sent (which can be listed in e.g. the selection widget), if you want it to be displayed elsewhere you need to use state description as well.

Yes, they are shown through the API when queried. I hadn’t looked there before. I’m not looking to display it elsewhere for now, this is simply to provide the end user with a pre-populated list of apps that they can start via the protocol.

So my question is, how do I see this from the karaf cli or via the main UI now?

For karaf I have no idea, but for Main UI it depends on what type of widget is configured for the item. I found that selecting the “Label widget” and configure Action as “Command options” and Action item as the item itself should work. When the label is clicked, a list pops up with the options.

Interesting. So apparently my code is working as expected but I was testing it incorrectly. I think I would still like to understand what the correct mechanisms are to test this on CLI and UI. For example, on CLI I would run “openhab:metadata list” and just get an empty reply. On the UI, I would assume that if I opened up the item in settings that I should see it listed under metadata.

The metadata is connected to the Item itself, and may be a source of state/command descriptions, but the bindings (whether using dynamic providers or xml-files) is a different source. When a description is requested, OH checks for all available providers, and selects one based on some priority, if I understand correctly.

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