AndroidTV Binding [3.2.0;4.2.0)

I just installed openHAB on Ubuntu Studio 22.10 and was adding stuff I have.
I began with THINGS vesync (Levoit Humidifier 300s) then hue lights.
I also have ROKU and Denon receiver working at the equipment page.

The Shield TV P3430 in installed but I don’t see it (yet) on the server home page equipment.

Is there somewhere I need to edit local files or should it appear in THINGS ?

First make sure you’ve gone and installed the shieldtclv 3.4.0 binding from the marketplace. Once that’s in, auto discovery should find the shield when it sends its periodic broadcast (which isn’t frequent, especially if it’s off). If that doesn’t happen, try to scan for it. That will usually force it to discover. To note, discovery only works if the openhab and shield are on the same network/vlan.

Looking for some input from the users. I had some time yesterday to begin working on the app pieces. It looks like we get 3 pieces of info. An app DN (e.g. org.google.youtube.tv), a real name (e.g. YouTube TV), and a URL that pointals at the shield for the app. The URL has yet to be explored by me but I believe it may provide at a minimum the icon for the app, possibly some app control (perhaps if the app has its own API?). I’m planning on adding an appname and appurl channel so that when the app reported matches something we know, we get the additional data.

The question I have for the users. Im considering another channel along the lines of appdb. Basically this would be a parasble (json maybe?) dump of what we get from the shield. I figure at a minimum it would help users figure out what they need to send to the shield to start an app. Beyond that, it may be helpful in rules or something similar. Is this channel worth the time to code? The alternate would be to just dump it to debug logging and let people grab as needed for one-off reviews.

Thoughts?

Also to note, I’ll be modifying this post to be 4.0.0 beta, and creating a 4.0.0 stable post for those who want to be more in line with what is being submitted to merge. I’ll also likely create a 3.4.0 beta as well.

Sounds like a pretty good idea.

While I haven’t thought this through at all, what about adding the apps you find to a dynamic state/command description on the existing app channel? It could serve multiple purposes, not the least of which would make it easy to launch an app by selecting it from a list.

Interesting. Ive never done that, but I’m up for learning. Are you suggesting to just do that or do both that and the channels for those who just want an easy item to display?

Ha ha. Like I said, I hadn’t thought it through…

If I understand correctly (and please correct me if I’m wrong), but

  • To launch an app, you send the DN to the app channel

  • If there wasn’t a bug in the Shield, the app channel would be updated whenever an app gets focus on the Shield. Currently, the app channel gets updated after you send a keypress.

  • The app DN and real name would be set as state options in the dynamic state description. UIs (Habpanel, Basic UI, etc) could then present a selection list to the user for the item(s) linked to the app channel.

  • In addition, you can access all the state options in a rule by iterating over the list. In DSL, it looks like this (for the SqueezeBox binding’s favorites list). In the case of the Shield, option.getValue would be the DN and option.getLabel would be the real name. That would provide the means for someone to learn the DN and real name.

    Source1_PlayFavorite.getStateDescription.getOptions.forEach[option |
       logInfo(RFN, "State Option " + option.getValue + ": " + option.getLabel)
    ]

But, I just realized that the dynamic state options don’t persist across restarts of the binding. So, I guess that puts a fork in that idea. LOL

Take a look at the vizio binding… There is a JSON database that maintains the list of apps and the metadata needed to launch them. It is editable by the user in the thing configuration. By using this information, the binding can show a drop-down channel of available apps and upon selecting an item, the desired app is launched. Likewise if an app in the list is started via the TV remote, the channel updates to show the currently running app.

To clarify this, the bug only happens before the first keypress from what I’ve experienced. Once any keypress is made, the bug is gone for the duration of the connection.

We get the app list basically as soon as login happens. Would this still work since it is generated so quickly?

Interesting. I will definitely check it out and adapt some of the code in as applicable. Thanks!

So you read this at binding initialization and use it to populate the state options?

Oh, you get the whole app list at one time after the login? Then, yeah, I think that would be perfect.

Yes. It comes in as one big blob about 5 payloads after login is completed. I can actually call for it as well if needed for a refresh (which I should probably do periodically, haven’t gotten there yet).

Ok, so when you get the blob, you use it to populate the state/command options. There are many examples in bindings that show how to do dynamic state or command options.

Sounds fun. I’m close to getting the decoder done (6 hours later). This protocol is such a mess. 98% of the time the app has a prefix that is 5 bytes long. On some rare occasions, it’s 6 and it’s really hard to figure out when that is. Also apparently some apps can have multiple entries. Plex seems to actually be an offender of both a 6 byte prefix AND multiple apps so figuring out how to catch that has been, trying on my patience lol.

Reverse engineering protocols is so much fun. I’ve done a couple, but nothing even remotely close to what you’re dealing with.

That is correct. The approach of saving the list as a persistent configuration option was used because there was no way to query for a current list of installed apps on the TV.

1 Like

Just to give everyone a real world of what I’m talking about. I believe I finally have the decoder working. Working here means “my two shields aren’t throwing errors anymore and are parsing correctly”. Here is what I get (below). I’m not sure why a few like hbo and espn are missing the first 2 bytes of data (3001 in most cases) other than something the plex app is doing. I do believe that the data between the two 0x0a is the overall length of the entry, with the only thing that it’s got an endian issue (e.g. disney being 30010a89010a means the length is 0x0189 where youtube tv being 30010a650a means the length is 0x65). I ended up not actually needing that to parse it because it has other delimiters and length fields which were easier to work with.

EDIT: For those interested, this commit covers this specific decode: Working app decoder. · openhab/openhab-addons@4ea52b2 · GitHub

2023-01-08 16:04:52.278 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 971a0a560a AppDN: com.nbcuni.nbc.androidtv
2023-01-08 16:04:52.278 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: NBC AppURL: http://IP-ADDRESS-SHIELD1:44283/com.nbcuni.nbc.androidtv
2023-01-08 16:04:52.279 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a540a AppDN: com.android.gallery3d
2023-01-08 16:04:52.279 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Gallery AppURL: http://IP-ADDRESS-SHIELD1:44283/com.android.gallery3d
2023-01-08 16:04:52.279 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a640a AppDN: com.google.android.youtube.tv
2023-01-08 16:04:52.280 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.youtube.tv
2023-01-08 16:04:52.280 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a790a AppDN: com.google.android.youtube.tvunplugged
2023-01-08 16:04:52.281 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube TV AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.youtube.tvunplugged
2023-01-08 16:04:52.281 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a540a AppDN: com.android.gallery3d
2023-01-08 16:04:52.282 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Gallery AppURL: http://IP-ADDRESS-SHIELD1:44283/com.android.gallery3d
2023-01-08 16:04:52.282 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a700a AppDN: com.amazon.amazonvideo.livingroom
2023-01-08 16:04:52.283 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Prime Video AppURL: http://IP-ADDRESS-SHIELD1:44283/com.amazon.amazonvideo.livingroom
2023-01-08 16:04:52.283 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a4f0a AppDN: com.plexapp.android
2023-01-08 16:04:52.283 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Plex AppURL: http://IP-ADDRESS-SHIELD1:44283/com.plexapp.android
2023-01-08 16:04:52.284 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a530a AppDN: com.android.vending
2023-01-08 16:04:52.284 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Store AppURL: http://IP-ADDRESS-SHIELD1:44283/com.android.vending
2023-01-08 16:04:52.285 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a4c0a AppDN: com.netflix.ninja
2023-01-08 16:04:52.285 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Netflix AppURL: http://IP-ADDRESS-SHIELD1:44283/com.netflix.ninja
2023-01-08 16:04:52.285 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a570a AppDN: com.amazon.music.tv
2023-01-08 16:04:52.286 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Amazon Music AppURL: http://IP-ADDRESS-SHIELD1:44283/com.amazon.music.tv
2023-01-08 16:04:52.286 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a640a AppDN: com.google.android.youtube.tv
2023-01-08 16:04:52.287 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.youtube.tv
2023-01-08 16:04:52.287 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5f0a AppDN: com.google.android.music
2023-01-08 16:04:52.287 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Music AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.music
2023-01-08 16:04:52.288 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a740a AppDN: com.google.android.youtube.tvmusic
2023-01-08 16:04:52.288 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube Music AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.youtube.tvmusic
2023-01-08 16:04:52.289 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a540a AppDN: com.disney.disneyplus
2023-01-08 16:04:52.289 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Disney+ AppURL: http://IP-ADDRESS-SHIELD1:44283/com.disney.disneyplus
2023-01-08 16:04:52.290 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a690a AppDN: com.google.android.play.games
2023-01-08 16:04:52.290 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Games AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.play.games
2023-01-08 16:04:52.291 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a6a0a AppDN: com.plexapp.mediaserver.smb
2023-01-08 16:04:52.291 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Plex Media Server AppURL: http://IP-ADDRESS-SHIELD1:44283/com.plexapp.mediaserver.smb
2023-01-08 16:04:52.292 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 0a510a AppDN: com.espn.score_center
2023-01-08 16:04:52.292 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: ESPN AppURL: http://IP-ADDRESS-SHIELD1:44283/com.espn.score_center
2023-01-08 16:04:52.293 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5a0a AppDN: com.google.android.tv
2023-01-08 16:04:52.293 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Live Channels AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.tv
2023-01-08 16:04:52.294 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a690a AppDN: air.com.vudu.air.DownloaderTablet
2023-01-08 16:04:52.294 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: VUDU AppURL: http://IP-ADDRESS-SHIELD1:44283/air.com.vudu.air.DownloaderTablet
2023-01-08 16:04:52.295 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5b0a AppDN: com.nvidia.tegrazone3
2023-01-08 16:04:52.295 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: NVIDIA Games AppURL: http://IP-ADDRESS-SHIELD1:44283/com.nvidia.tegrazone3
2023-01-08 16:04:52.295 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a460a AppDN: com.hbo.hbonow
2023-01-08 16:04:52.296 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: HBO Max AppURL: http://IP-ADDRESS-SHIELD1:44283/com.hbo.hbonow
2023-01-08 16:04:52.296 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5b0a AppDN: com.nvidia.tegrazone3
2023-01-08 16:04:52.297 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: NVIDIA Games AppURL: http://IP-ADDRESS-SHIELD1:44283/com.nvidia.tegrazone3
2023-01-08 16:04:52.297 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a88010a AppDN: com.disney.datg.videoplatforms.android.watchdc
2023-01-08 16:04:52.298 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: DisneyNOW AppURL: http://IP-ADDRESS-SHIELD1:44283/com.disney.datg.videoplatforms.android.watchdc
2023-01-08 16:04:52.298 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a670a AppDN: com.google.android.videos
2023-01-08 16:04:52.299 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Movies & TV AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.videos
2023-01-08 16:04:52.299 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5a0a AppDN: com.google.android.tv
2023-01-08 16:04:52.299 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Live Channels AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.tv
2023-01-08 16:04:52.300 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a740a AppDN: com.google.android.youtube.tvmusic
2023-01-08 16:04:52.300 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube Music AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.youtube.tvmusic
2023-01-08 16:04:52.301 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a4c0a AppDN: com.netflix.ninja
2023-01-08 16:04:52.301 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Netflix AppURL: http://IP-ADDRESS-SHIELD1:44283/com.netflix.ninja
2023-01-08 16:04:52.302 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a4f0a AppDN: com.plexapp.android
2023-01-08 16:04:52.302 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Plex AppURL: http://IP-ADDRESS-SHIELD1:44283/com.plexapp.android
2023-01-08 16:04:52.303 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a560a AppDN: com.nbcuni.nbc.androidtv
2023-01-08 16:04:52.303 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: NBC AppURL: http://IP-ADDRESS-SHIELD1:44283/com.nbcuni.nbc.androidtv
2023-01-08 16:04:52.304 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a570a AppDN: com.amazon.music.tv
2023-01-08 16:04:52.304 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Amazon Music AppURL: http://IP-ADDRESS-SHIELD1:44283/com.amazon.music.tv
2023-01-08 16:04:52.304 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a530a AppDN: com.android.vending
2023-01-08 16:04:52.305 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Store AppURL: http://IP-ADDRESS-SHIELD1:44283/com.android.vending
2023-01-08 16:04:52.305 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a540a AppDN: com.disney.disneyplus
2023-01-08 16:04:52.305 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Disney+ AppURL: http://IP-ADDRESS-SHIELD1:44283/com.disney.disneyplus
2023-01-08 16:04:52.306 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a790a AppDN: com.google.android.youtube.tvunplugged
2023-01-08 16:04:52.306 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube TV AppURL: http://IP-ADDRESS-SHIELD1:44283/com.google.android.youtube.tvunplugged
2023-01-08 16:04:52.306 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a540a AppDN: com.imdbtv.livingroom
2023-01-08 16:04:52.307 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: IMDb TV AppURL: http://IP-ADDRESS-SHIELD1:44283/com.imdbtv.livingroom
2023-01-08 16:04:52.307 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a590a AppDN: com.android.tv.settings
2023-01-08 16:04:52.307 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Settings AppURL: http://IP-ADDRESS-SHIELD1:44283/com.android.tv.settings



2023-01-08 16:04:51.992 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: d31f0a470a AppDN: com.hbo.hbonow
2023-01-08 16:04:51.993 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: HBO Max AppURL: http://IP-ADDRESS-SHIELD2:42493/com.hbo.hbonow
2023-01-08 16:04:51.993 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a580a AppDN: com.amazon.music.tv
2023-01-08 16:04:51.994 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Amazon Music AppURL: http://IP-ADDRESS-SHIELD2:42493/com.amazon.music.tv
2023-01-08 16:04:51.994 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a540a AppDN: com.android.vending
2023-01-08 16:04:51.995 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Store AppURL: http://IP-ADDRESS-SHIELD2:42493/com.android.vending
2023-01-08 16:04:51.996 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a92010a AppDN: com.nvidia.stub.com.google.android.youtube.tvkids
2023-01-08 16:04:51.996 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube Kids AppURL: http://IP-ADDRESS-SHIELD2:42493/com.nvidia.stub.com.google.android.youtube.tvkids
2023-01-08 16:04:51.997 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a7a0a AppDN: com.google.android.youtube.tvunplugged
2023-01-08 16:04:51.998 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube TV AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.youtube.tvunplugged
2023-01-08 16:04:51.998 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5f0a AppDN: com.moviesanywhere.goo
2023-01-08 16:04:51.999 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Movies Anywhere AppURL: http://IP-ADDRESS-SHIELD2:42493/com.moviesanywhere.goo
2023-01-08 16:04:52.000 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a4e0a AppDN: org.pbskids.video
2023-01-08 16:04:52.000 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: PBS KIDS AppURL: http://IP-ADDRESS-SHIELD2:42493/org.pbskids.video
2023-01-08 16:04:52.001 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a500a AppDN: com.plexapp.android
2023-01-08 16:04:52.002 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Plex AppURL: http://IP-ADDRESS-SHIELD2:42493/com.plexapp.android
2023-01-08 16:04:52.002 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a750a AppDN: com.google.android.youtube.tvmusic
2023-01-08 16:04:52.003 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube Music AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.youtube.tvmusic
2023-01-08 16:04:52.004 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a550a AppDN: com.android.gallery3d
2023-01-08 16:04:52.004 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Gallery AppURL: http://IP-ADDRESS-SHIELD2:42493/com.android.gallery3d
2023-01-08 16:04:52.005 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5a0a AppDN: com.android.tv.settings
2023-01-08 16:04:52.006 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Settings AppURL: http://IP-ADDRESS-SHIELD2:42493/com.android.tv.settings
2023-01-08 16:04:52.007 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a4d0a AppDN: com.netflix.ninja
2023-01-08 16:04:52.007 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Netflix AppURL: http://IP-ADDRESS-SHIELD2:42493/com.netflix.ninja
2023-01-08 16:04:52.008 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a580a AppDN: com.amazon.music.tv
2023-01-08 16:04:52.009 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Amazon Music AppURL: http://IP-ADDRESS-SHIELD2:42493/com.amazon.music.tv
2023-01-08 16:04:52.009 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5b0a AppDN: com.google.android.tv
2023-01-08 16:04:52.010 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Live Channels AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.tv
2023-01-08 16:04:52.011 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a520a AppDN: com.espn.score_center
2023-01-08 16:04:52.012 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: ESPN AppURL: http://IP-ADDRESS-SHIELD2:42493/com.espn.score_center
2023-01-08 16:04:52.012 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a550a AppDN: com.disney.disneyplus
2023-01-08 16:04:52.013 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Disney+ AppURL: http://IP-ADDRESS-SHIELD2:42493/com.disney.disneyplus
2023-01-08 16:04:52.014 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5c0a AppDN: com.nvidia.tegrazone3
2023-01-08 16:04:52.015 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: NVIDIA Games AppURL: http://IP-ADDRESS-SHIELD2:42493/com.nvidia.tegrazone3
2023-01-08 16:04:52.016 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a7f0a AppDN: com.bamnetworks.mobile.android.gameday.atbat
2023-01-08 16:04:52.016 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: MLB AppURL: http://IP-ADDRESS-SHIELD2:42493/com.bamnetworks.mobile.android.gameday.atbat
2023-01-08 16:04:52.017 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5b0a AppDN: com.pandora.android.atv
2023-01-08 16:04:52.018 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Pandora AppURL: http://IP-ADDRESS-SHIELD2:42493/com.pandora.android.atv
2023-01-08 16:04:52.019 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a600a AppDN: com.google.android.music
2023-01-08 16:04:52.020 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Music AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.music
2023-01-08 16:04:52.021 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a540a AppDN: com.android.vending
2023-01-08 16:04:52.021 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Store AppURL: http://IP-ADDRESS-SHIELD2:42493/com.android.vending
2023-01-08 16:04:52.022 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5c0a AppDN: com.nvidia.tegrazone3
2023-01-08 16:04:52.023 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: NVIDIA Games AppURL: http://IP-ADDRESS-SHIELD2:42493/com.nvidia.tegrazone3
2023-01-08 16:04:52.024 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a650a AppDN: com.google.android.youtube.tv
2023-01-08 16:04:52.025 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.youtube.tv
2023-01-08 16:04:52.026 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a500a AppDN: com.plexapp.android
2023-01-08 16:04:52.027 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Plex AppURL: http://IP-ADDRESS-SHIELD2:42493/com.plexapp.android
2023-01-08 16:04:52.028 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a680a AppDN: com.google.android.videos
2023-01-08 16:04:52.028 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Movies & TV AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.videos
2023-01-08 16:04:52.029 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a6a0a AppDN: air.com.vudu.air.DownloaderTablet
2023-01-08 16:04:52.030 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: VUDU AppURL: http://IP-ADDRESS-SHIELD2:42493/air.com.vudu.air.DownloaderTablet
2023-01-08 16:04:52.031 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a7a0a AppDN: com.google.android.youtube.tvunplugged
2023-01-08 16:04:52.032 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube TV AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.youtube.tvunplugged
2023-01-08 16:04:52.038 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a750a AppDN: com.google.android.youtube.tvmusic
2023-01-08 16:04:52.043 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube Music AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.youtube.tvmusic
2023-01-08 16:04:52.045 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a550a AppDN: com.imdbtv.livingroom
2023-01-08 16:04:52.045 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: IMDb TV AppURL: http://IP-ADDRESS-SHIELD2:42493/com.imdbtv.livingroom
2023-01-08 16:04:52.046 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5b0a AppDN: com.google.android.tv
2023-01-08 16:04:52.047 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Live Channels AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.tv
2023-01-08 16:04:52.048 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a650a AppDN: com.google.android.youtube.tv
2023-01-08 16:04:52.048 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: YouTube AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.youtube.tv
2023-01-08 16:04:52.050 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a4d0a AppDN: com.netflix.ninja
2023-01-08 16:04:52.051 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Netflix AppURL: http://IP-ADDRESS-SHIELD2:42493/com.netflix.ninja
2023-01-08 16:04:52.052 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a6b0a AppDN: com.plexapp.mediaserver.smb
2023-01-08 16:04:52.052 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Plex Media Server AppURL: http://IP-ADDRESS-SHIELD2:42493/com.plexapp.mediaserver.smb
2023-01-08 16:04:52.053 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 0a470a AppDN: com.hbo.hbonow
2023-01-08 16:04:52.054 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: HBO Max AppURL: http://IP-ADDRESS-SHIELD2:42493/com.hbo.hbonow
2023-01-08 16:04:52.056 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a7f0a AppDN: com.bamnetworks.mobile.android.gameday.atbat
2023-01-08 16:04:52.057 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: MLB AppURL: http://IP-ADDRESS-SHIELD2:42493/com.bamnetworks.mobile.android.gameday.atbat
2023-01-08 16:04:52.060 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a5b0a AppDN: com.pandora.android.atv
2023-01-08 16:04:52.061 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Pandora AppURL: http://IP-ADDRESS-SHIELD2:42493/com.pandora.android.atv
2023-01-08 16:04:52.062 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a89010a AppDN: com.disney.datg.videoplatforms.android.watchdc
2023-01-08 16:04:52.062 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: DisneyNOW AppURL: http://IP-ADDRESS-SHIELD2:42493/com.disney.datg.videoplatforms.android.watchdc
2023-01-08 16:04:52.063 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a550a AppDN: com.disney.disneyplus
2023-01-08 16:04:52.063 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Disney+ AppURL: http://IP-ADDRESS-SHIELD2:42493/com.disney.disneyplus
2023-01-08 16:04:52.064 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a550a AppDN: com.android.gallery3d
2023-01-08 16:04:52.064 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Gallery AppURL: http://IP-ADDRESS-SHIELD2:42493/com.android.gallery3d
2023-01-08 16:04:52.064 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a6a0a AppDN: com.google.android.play.games
2023-01-08 16:04:52.065 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Play Games AppURL: http://IP-ADDRESS-SHIELD2:42493/com.google.android.play.games
2023-01-08 16:04:52.065 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppPrepend: 30010a710a AppDN: com.amazon.amazonvideo.livingroom
2023-01-08 16:04:52.066 [TRACE] [tocol.shieldtv.ShieldTVMessageParser] - AppName: Prime Video AppURL: http://IP-ADDRESS-SHIELD2:42493/com.amazon.amazonvideo.livingroom

Wow.

Thinking out loud… I wonder if it would be worth wrapping the code with try/catch for ArrayIndexOutOfBoundsException. That would give you the chance to log some relevant information to help with debugging. Mostly thinking about if a problem occurs in a user’s environment. Probably a question that should be answered as part of the review of the PR.

@mlobstein WDYT?

Honestly, that entire function should probably be in a try/catch now that you’re mentioning it, not just the individual message.

That said, I don’t think that I should be able to hit an out of bounds the way this protocol works. While it’s a pain, it is somewhat deterministic once you figure out the delimiters. The end of the packet will always be 5 bytes long after the last entry. Also, from a debug standpoint, the best thing (for me) if someone has a shield that freaks out is to get them to run trace logging and to get the actual payload from them. There is a hidden raw message decoder channel that I can send their payload to on my side which fakes a packet receipt and processes it. In theory, it should barf in the same places as long as the payload is the same.

I’m not even going to call this a beta or release it as such. I’d like a few people to give this a try to see if it throws any exceptions (I think I’ve got them all caught). There are several apps (like the default launcher) which aren’t sent as part of the payload and had to get loaded manually. I’ll drop a cleaner version once I get the kinks worked out.

Two new channels are appname and appurl. They should auto populate as app changes.

Watch the log file for errors that say “Unknown Android App” at the info level. If it spits one out, please send me the DN so I can find and add it to the default load.

https://github.com/morph166955/openhab-addons/releases/download/shieldtv-beta-4/org.openhab.binding.shieldtv-4.0.0-SNAPSHOT-apptest1.jar

EDIT: Standby for a 3.4.0 cut of that, should be later tonight or early tomorrow.

To note, I still intend to do the dynamic channel part. Trying to make sure the decoder is working properly first. Once I know its “cleanish” I’ll add the dynamic channel and drop it as a beta.