Has anyone figured out how to automate playing something on Netflix? (e.g. on a Samsung smart TV.)

I have some Samsung Smart TVs and I want to set up some automations, so I can say things like “Alexa, play the office.” This should turn on the TV, open the Netflix app, and resume playing the next episode of the office. So far I can only figure out how to open the Netflix app on the TV (setting the source for the TV media player), and then I get stuck.

The SmartThings app allows me to use my phone as a TV remote. One idea I had is to use this SmartThings API to manually send arrow and enter buttons to control the Netflix UI once it starts: https://smartthings.developer.samsung.com
E.g. Press enter to choose the user, left + down + down + enter to Search, then use the arrow keys to select each letter on the keyboard and spell out “office”, then select the first result and click the play button.

Questions:

  • Has anyone figured this out?
  • Is there a Samsung / SmartThings API to play a show in the Netflix app?
  • Is there a Netflix API to control a player remotely? (The Plex integration has this)
  • Can I root my TV and install an alternative OS that makes this easier?
  • Is this easier if I use a Chromecast?
    • Maybe I could automate a browser using puppeteer, open Netflix, and cast it to the TV.

Related:

2 Likes

Hi! Did you find a solution for this?

1 Like

Good luck. Ok … down … down … right … right may select CoComelon for all you know. Who played it last?

Or worse, for some advertisement you may just have subscribed to a movie.

Be happy you got to Netflix then have a GUI on phone in HA to respond further

1 Like

Not yet unfortunately, I’m still interested in finding a solution. I don’t think there’s an easy way to achieve this, but it can be done either by sending IR signals to emulate a remote, or maybe via the SmartThings API (since the mobile app uses this.) I’m able to control the TV using my iPhone so in theory it’s possible to write a script to automate these actions, but I haven’t been able to find a public API.

In this tread I talk about how I added IR capability to enable some functionality to my media setup. It could be helpful. My main tv is an LG tv with web OS. The “custom:lg-remote-control” provides a great controller for LG tvs with web OS that lets you select and control the apps, such as netflix. I’ll check and see if the samsung tv I have is smart and if it is I’ll see if I can access and control the apps. If you have a firestick there is an add-on that allows you to control it via the android debug interface. It works for providing control but is kind of slow.

I checked the samsung tv I have and it is smart. It’s in my wife’s work room so I don’t normally use it, I just set it up. I can control netflix as set up. I use this custom integration to communicate with the tv. As it is connected via wifi to my network I had to use the method documented in my post above to turn the TV on and off transimitting the IR signal.

It’s not connected to cable tv, we use mythtv to record anything we watch from cable and so the remote set up doesn’t have any channel controls. Below is picture of the remote I’ve set up for it. It’s nothing fancy but works. The 9 square icon gives access to the applications menu.

This is created via the following lovelace card:

type: custom:stack-in-card
title: TV Controls
mode: vertical
cards:
  - type: custom:tv-card
    entity: media_player.backbed_samsung
    tv: true
    enable_button_feedback: false
    media_control_row:
      - samsung_power
      - mythtv
      - music
      - select_app
      - tv
    channel_row:
      - return
      - info
    navigation_row: buttons
    volume_row: buttons
    custom_keys:
      samsung_power:
        icon: mdi:power
        service: shell_command.wake_samsung_tv
      tv:
        icon: mdi:television-classic
        service: media_player.play_media
        service_data:
          media_content_id: KEY_SOURCE+KEY_LEFT+KEY_LEFT+KEY_LEFT+KEY_ENTER
          media_content_type: send_key
          entity_id: media_player.backbed_samsung
      mythtv:
        icon: mdi:television-play
        service: media_player.play_media
        service_data:
          media_content_id: KEY_SOURCE+KEY_LEFT+KEY_LEFT+KEY_LEFT+KEY_RIGHT+KEY_ENTER
          media_content_type: send_key
          entity_id: media_player.backbed_samsung
      music:
        icon: mdi:music
        service: media_player.play_media
        service_data:
          media_content_id: KEY_SOURCE+KEY_LEFT+KEY_LEFT+KEY_LEFT+KEY_RIGHT+KEY_RIGHT+KEY_ENTER
          media_content_type: send_key
          entity_id: media_player.backbed_samsung
      select_app:
        icon: mdi:apps
        service: media_player.play_media
        service_data:
          media_content_id: KEY_HOME
          media_content_type: send_key
          entity_id: media_player.backbed_samsung

The shell command wake_samsung_tv contains:

#!/bin/bash
ssh -i /config/.ssh/id_rsa -o StrictHostKeyChecking=no [email protected] ./ir-wake-samsung

Then on the pi that sends the wake ir signal the script ir-wake-samsung has the following

#!/bin/bash
ir-ctl -d /dev/lirc1 --send=samsung_power1.key

This link speaks more to the IR setup. IR was only required to wake the tv because WOL didn’t work with WiFi when the TV was off.

If the tv is integrated in google home, you can theoretically implement your idea through the use the Google Assistant SDK integration.

I’ve got the same request and i have a philips tv connected to Google Home. If i say to google “play the office”, it turns up the tv, start netflix and play the office. Good.
BUT:
I tried to ask the same phrase to the google assistant sdk via the home assistant service, but it simply does not work.
It’s like phrases are interpreted differently basing on where they’re coming from (mobile app/echo devices or sdk). Weird thing is that if i ask the sdk to simoly start netflix on tv, it will.

2 Likes

On Android TV you will be able to play any Netflix title with the Android TV Remote integration, see PR Android TV Remote integration by tronikos · Pull Request #89935 · home-assistant/core · GitHub and Android TV Remote integration documentation by tronikos · Pull Request #26659 · home-assistant/home-assistant.io · GitHub

It would be great if we could say “play the office” to turn on the tv, start netflix, and play the next episode of “The Office” - without having to use Google. Is this what you mean, that you can send the desired title to the Netflix app ?

I have looked at the PR you linked to, and it looks like a cleaner implementation of the features we already have - which I do think is still worthwhile.

If I understand correctly, with your new integration (like the existing Android TV integration which uses ADB) I can launch an app such as Netflix, but then have to send commands simulating a Remote control in order to select which title to play.

On my ShieldTV I think Kodi is probably best route to achieve this result (because Kodi is open source and in theory open to new features) - but it would be even better if the ShieldTV could boot straight into Kodi, rather than having to launch the Kodi app every time the TV is turned on.

See the documentation and the example there to launch a specific YouTube video. I don’t have Netflix but you should be able to pass the URL of a specific Netflix title.

I see that the only way to open specific videos would be to pass the link of it. Is there anyway to use just a voice dictated title? Eg: “The Office”.
I don’t want to create a table with all my current TV shows and transform it into a link :sweat_smile: Also, i don’t think that opening the link of the main page of a netflix show will automatically play the next unwatched episode (like google home does by just saying "Play the office on TV)

@tronikos do you confirm that it’s a known issue for Google Assistant SDK to ignore commands like “Play the office on TV”? Obviously the command works through the Google Assistant application.
I also tried to disable the IPV6 directly on the raspberry running my HA (can’t do it on the router)

Yes that’s a known issue on the Google side. Only podcasts, news, and relaxing sounds work. Disabling IPV6 would only help with broadcast commands.

1 Like

@ndbroadbent ,
have you figured it out yet?

I have a button in my living room to play something on Netflix for my kid, I use this script:

service: webostv.command
data:
  entity_id: media_player.living_room_tv
  command: system.launcher/launch
  payload:
    id: netflix
    contentId: m=https://www.netflix.com/watch/70287700

This is LG and webos. Not sure if Samsung offers something similar, take a look around the available scrips the samsung integration offers. Or buy an LG TV :smiley:

2 Likes

@ndbroadbent did you find a solution for this?