Media_content_id ... stupid question

Hey there HA friends… just a stupid question here. Short Version: How do I find the content id from Hulu?

I’m trying to use HA to call a specific show to my chromecast. I can’t seem to figure out where to find the Hulu content id… can anyone point me in the right direction? I have been using the integration I am pretty sure came from using Nabu Casa subscription (been awhile since setup) and it doesn’t show the content id nor the TV show name on any frontend, nor in the developer tools. I have been trying desperately to login to the integration for casting from GitHub - leikoilja/ha-google-home: Home Assistant Google Home custom component, because I’ve read that it will expose this information, as well as unlock other abilities with the rest of my home products, but it won’t login, even though I’ve followed all the steps in the 2fa authentication issue. If anyone can shed light on any of this, it would be appreciated. I’m in the process of posting logs and whatnot in their issue. , but figured I’d ask yall for help in case you knew.

Thanks in advance!

Try this using android tv integration through adb command

adb shell am start -n com.hulu.livingroomplus/.MainActivity" -a android.intent.action.VIEW -d https://www.hulu.com/watch/23ba33b5-4433-4649-9adb-5eec8068cdb2

If it doesn’t open using that code, try adding this just after the Hulu link
-f 0x10808000

In any case it should call Chicago PD episode 1 ( since I’ve used that link ). Haven’t tested it since I don’t have Hulu subscription, but according to apk manifest, app should accept links with watch inside of them. Give it a go

1 Like

Hmmm… thanks for reply. I tried both mentioned solutions. Unfortunately just sitting there at the home screen. Did you by any chance miss a quotation mark? I see a solitary mark in there, not sure if it’s supposed to be there alone or not?

My mistake, didn’t notice “ you can remove it and it should work then. I’ve accidentally put it there.
If it doesn’t work then, another thing to try is put “ around the link, at start and end of the link.

Also when putting command in, there’s no need for adb shell at the start cause it automatically puts that when executing the code

1 Like

Hmmm. I feel like we are closer.
When you refer to apk manifest, you’re referring to the file required to make it run? If possible, can you show me what you see? I’d like to try to decipher it. I’m not too familiar with apks other than downloading and installing them. I’m fairly new to adb.

Screenshots of attempts. Maybe I’m just doing it wrong… forgive me if I’m coming off stupid, everything I know about code, I taught myself on Google. I’ve only recently started using the forums and posting.








service: androidtv.adb_command
data:
  command: >- 
adb shell am start -n com.hulu.livingroomplus/.MainActivity -a
    android.intent.action.VIEW -d
    "https://www.hulu.com/watch/23ba33b5-4433-4649-9adb-5eec8068cdb2"
target:
  entity_id: media_player.android_tv_192_168_178_28

Entity ID is the TV media player from the android tv integration which in my casw is called android tv with the IP address

I obsessively rename my ids lol. Tried it out, still nothing. Just the home screen still. I even tried manually opening hulu first to see if that would help.

Hmm then I’ve gotten a wrong activity for Hulu app launch.
Try this

adb shell am start -n com.hulu.plusx.activity.PlayerActivity -a
    android.intent.action.VIEW -d
    "https://www.hulu.com/watch/23ba33b5-4433-4649-9adb-5eec8068cdb2"

Or this

adb shell am start -n com.hulu.plusx.activity.PlayerActivity -d
    "https://www.hulu.com/watch/23ba33b5-4433-4649-9adb-5eec8068cdb2"

Managed to find the manifest file here where I got the plusx activity. As for what manifest is, it’s basically an xml file inside android apps that has these activities inside them that we use in android tv integration to open an app or do whatever

I’m gonna check through the manifest and see what I can find. Still not doing anything =(

I’m wondering if it has to do with this and how to use it if so?

<action android:name="hulu.intent.action.LAUNCH_VIDEO_ID" />

This part is what you use hulu.intent.action.LAUNCH_VIDEO_ID Instead of the com.Hulu part. But I’m not sure that’s it. Can’t really play a guessing game since I don’t have Hulu nor I can install it.

It would be easier if you’ve install a terminal type app on your phone or have it on your laptop or desktop pc, install adb Shell, connect to home assistant instance through terminal then while in there,connect to your Android tv using adb shell connect command , then run this adb shell logcat > output.txt command, then launch Hulu, then stop the command in terminal by hitting ctrl c. In the output.txt there will be a log of what was happening on your tv behind the scenes and since you’ve launched Hulu it should give Hulu activity you need to launch Hulu through home assistant and hopefully launch a tv show using a link.

This is awesome thank you. I’m gonna try now.

Now I’ve got a headach. I’ve been going through the logs like crazy and all I’ve figured out is that it should be the com.hulu.livingroomplus

Is any of this helpful?

05-22 20:22:00.174  3853  6602 I ActivityTaskManager: START u0 {act=android.intent.action.VIEW dat=https://www.hulu.com/... flg=0x14000000 pkg=com.hulu.livingroomplus cmp=com.hulu.livingroomplus/.WKFactivity (has extras)} from uid 10043

05-23 20:09:22.800  3853  7337 I ActivityTaskManager: START u0 {act=android.intent.action.VIEW dat=https://www.hulu.com/... flg=0x14000000 pkg=com.hulu.livingroomplus cmp=com.hulu.livingroomplus/.WKFactivity (has extras)} from uid 10036

05-27 13:35:03.368  3853 14594 I ActivityTaskManager: START u0 {act=android.intent.action.VIEW dat=https://www.hulu.com/... flg=0x10000000 cmp=com.hulu.livingroomplus/.MainActivity} from uid 2000


05-27 19:40:59.544  5461  5461 W BasicMediaStatusFactory: com.hulu.livingroomplus's media session has no metadata
05-27 19:40:59.545  3999  3999 V AvrcpMediaPlayerWrapper: onPlaybackStateChanged(): com.hulu.livingroomplus : PlaybackState {state=3, position=1024640, buffered position=0, speed=1.0, updated=439506258, actions=895, custom actions=[], active item id=-1, error=null}
05-27 19:40:59.548  5461  5461 D BasicMediaStatusFactory: Supported media session actions: 895
05-27 19:40:59.552  3999  3999 V AvrcpMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for com.hulu.livingroomplus
05-27 19:40:59.552  3999  3999 D AvrcpMediaPlayerList: sendMediaUpdate
05-27 19:40:59.552  3999  3999 I AvrcpMediaPlayerList: sendMediaUpdate: Creating a one item queue for a player with no queue
05-27 19:40:59.552  3999  3999 D AvrcpTargetService: onMediaUpdated: track_changed=false state=true queue=false
05-27 19:40:59.552  3999  3999 D AvrcpNativeInterface: sendMediaUpdate: metadata=false playStatus=true queue=false
05-27 19:40:59.552  3999  3999 D AvrcpTargetJni: sendMediaUpdateNative
05-27 19:40:59.552  3999  3999 I bt_stack: [INFO:avrcp_service.cc(346)] virtual void bluetooth::avrcp::AvrcpService::SendMediaUpdate(bool, bool, bool) track_changed=0 :  play_state=1 :  queue=0
05-27 19:41:00.431  3526 14842 D PlayReadySecureOs: PRSecure_video_csd/406
05-27 19:41:00.541  5461  5461 W BasicMediaStatusFactory: com.hulu.livingroomplus's media session has no metadata
05-27 19:41:00.542  3999  3999 V AvrcpMediaPlayerWrapper: onPlaybackStateChanged(): com.hulu.livingroomplus : PlaybackState {state=3, position=1025664, buffered position=0, speed=1.0, updated=439507258, actions=895, custom actions=[], active item id=-1, error=null}
05-27 19:41:00.546  5461  5461 D BasicMediaStatusFactory: Supported media session actions: 895
05-27 19:41:00.548  3999  3999 V AvrcpMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for com.hulu.livingroomplus
05-27 19:41:00.548  3999  3999 D AvrcpMediaPlayerList: sendMediaUpdate
05-27 19:41:00.548  3999  3999 I AvrcpMediaPlayerList: sendMediaUpdate: Creating a one item queue for a player with no queue
05-27 19:41:00.548  3999  3999 D AvrcpTargetService: onMediaUpdated: track_changed=false state=true queue=false
05-27 19:41:00.548  3999  3999 D AvrcpNativeInterface: sendMediaUpdate: metadata=false playStatus=true queue=false
05-27 19:41:00.548  3999  3999 D AvrcpTargetJni: sendMediaUpdateNative
05-27 19:41:00.548  3999  3999 I bt_stack: [INFO:avrcp_service.cc(346)] virtual void bluetooth::avrcp::AvrcpService::SendMediaUpdate(bool, bool, bool) track_changed=0 :  play_state=1 :  queue=0
05-27 19:41:00.552  5461  5461 I chromium: [5461:5461:INFO:metrics_recorder.cc(188)] cast event: Cloud.Transport.Https.StatusChange.Out
05-27 19:41:00.743  5461  6296 I chromium: [5461:6296:INFO:snr_tracker.cc(50)] snr = 49
05-27 19:41:00.763  5461  5461 I chromium: [5461:5461:INFO:metrics_recorder.cc(188)] cast event: Cloud.Transport.Https.StatusChange.Out.Success

The if that’s the case, this should work

And only thing that crosses my mind is that entity there isn’t your android tv integration but chromecast integration and you can’t send adb commands to a chromecast integration, only to the android tv integration.

Firstly, thank you for trying so hard for an integration you don’t even have, this is the kinda thing I would do with the knowledge too. I bet this is like a puzzle to you.

I’m gonna try this out here in a bit.

I can put your mind to rest though, I’ve been sending it the right direction. - I had mentioned my obsessive naming of entities and devices, I even format them the same… “ROOM - DEVICE - PERSON(if applicable)”
“Chromecast” indicates the entity from the Android TV Python Integration.
“Cast” indicates the entity provided by the HA Cloud Google Integration.

I actually tried the commands via ADB Shell and everything I tried said I had a bad component. I can post results in the morning.

No need to thank me, I like a challenge :rofl: :wink:

Hmm well if the entity is right then just this


adb shell am start -n com.hulu.livingroomplus/.MainActivity 

Should launch Hulu only.
You can also try this

adb shell am start -n com.hulu.livingroomplus/.WKFactivity

Still no change. It wouldn’t send until I reversed the data and command, but still did nothing after.

Oddly absolutely 0 logs in HA for me calling the service.

The ADB Shell produced these logs, so I’m thinking I need to figure out the command in here and then try it in HA.

C:\Users\Prono\Downloads\platform-tools_r33.0.2-windows\platform-tools>    adb shell am start -n  com.hulu.livingroomplus/.MainActivity -a
    android.intent.action.VIEW -d
    "https://www.hulu.com/watch/23ba33b5-4433-4649-9adb-5eec8068cdb2"

Exception occurred while executing:
java.lang.IllegalArgumentException: Argument expected after "-a"
        at android.os.ShellCommand.getNextArgRequired(ShellCommand.java:327)
        at android.content.Intent.parseCommandArgs(Intent.java:7058)
        at com.android.server.am.ActivityManagerShellCommand.makeIntent(ActivityManagerShellCommand.java:316)
        at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:408)
        at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:171)
        at android.os.ShellCommand.exec(ShellCommand.java:104)
        at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:9826)
        at android.os.Binder.shellCommand(Binder.java:881)
        at android.os.Binder.onTransact(Binder.java:765)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4516)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2741)
        at android.os.Binder.execTransactInternal(Binder.java:1021)
        at android.os.Binder.execTransact(Binder.java:994)

C:\Users\Prono\Downloads\platform-tools_r33.0.2-windows\platform-tools>adb shell am start -n  com.hulu.livingroomplus/.MainActivity -a
    android.intent.action.VIEW -d
    "https://www.hulu.com/watch/23ba33b5-4433-4649-9adb-5eec8068cdb2"

Exception occurred while executing:
java.lang.IllegalArgumentException: Argument expected after "-a"
        at android.os.ShellCommand.getNextArgRequired(ShellCommand.java:327)
        at android.content.Intent.parseCommandArgs(Intent.java:7058)
        at com.android.server.am.ActivityManagerShellCommand.makeIntent(ActivityManagerShellCommand.java:316)
        at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:408)
        at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:171)
        at android.os.ShellCommand.exec(ShellCommand.java:104)
        at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:9826)
        at android.os.Binder.shellCommand(Binder.java:881)
        at android.os.Binder.onTransact(Binder.java:765)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4516)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2741)
        at android.os.Binder.execTransactInternal(Binder.java:1021)
        at android.os.Binder.execTransact(Binder.java:994)

Getting Closer to the root of the issue I think.
from the first one on your last post:

C:\Users\Prono\Downloads\platform-tools_r33.0.2-windows\platform-tools>adb shell am start -n  com.hulu.livingroomplus/.MainActivity
Starting: Intent { cmp=com.hulu.livingroomplus/.MainActivity }
Error type 3
Error: Activity class {com.hulu.livingroomplus/com.hulu.livingroomplus.MainActivity} does not exist.

Then the second one:
---- SOAB! IT LAUNCHED! IT EVEN STARTED UP THE LAST THING I WAS WATCHING!
You’re awesome! Now, how to direct it from here?

Then if second one launched Hulu, you should try this command

adb shell am start -n com.hulu.livingroomplus/.WKFactivity -a android.intent.action.VIEW -d "https://www.hulu.com/watch/23ba33b5-4433-4649-9adb-5eec8068cdb2"

Or this

adb shell am start -n com.hulu.livingroomplus/.WKFactivity -d "https://www.hulu.com/watch/23ba33b5-4433-4649-9adb-5eec8068cdb2"

With and without “

1 Like

But huh buh buh buh buh! (Trumpet sounds) you are awesome. I’ve now launched Chicago PD ep 1. I guess now I need to try another url, but do you think it’s possible for me to have it continue the show from where it left off vs calling a specific ep?

Edit: I figured out how to pull the menu for How I Met Your Mother up, now I can follow it with a CENTER command and it should play. This should resolve my issue. The main issue was that when you voice command the Google Assistant to play a Hulu show, then it only pulls up the menu, you still have to press center, which to me kinda defeats the entire point in voice commands…

Now I need to figure out how to make it automatically press center after I’ve told it to play any show on Hulu without having to customize an automation for each. Is this possible with Templating? Not sure how I could go about creating a custom voice command with variables, but I was thinking more of a way to get it to automatically hit the button by recognizing that Hulu is on a menu?