Ape / samsungctl

Remote control Samsung televisions via a TCP/IP connection
MIT License
711 stars 191 forks source link

Launch app on tv #75

Open Mcgurk125 opened 6 years ago

Mcgurk125 commented 6 years ago

Apologies, if this is not worth creating a new issue for... its more of a question.

The Samsung Smart View application - Link - has the ability to launch apps on the TV (Netflix, Plex etc.) - I was wondering if it was possible to replicate these calls?

skycryer commented 5 years ago

Is there a way to quit an app via api? Like with Curl Post and curl GET to start and get status another attribute maybe to exit an app by id?

Because when I open an app it is running in background also if I switch to another app, so the answer if it is running is evertime true. Thats why I search for a way to exit apps via command.

I could try to do it via Samsungctl but I hope I can exit apps in background when running another app.

kdschlosser commented 5 years ago

yes there is. replace YOUR_TV_IP with the IP address of your TV replace APPLICATION_ID with the app id

curl -X "DELETE" http://YOUR_TV_IP:8001/api/v2/applications/APPLICATION_ID
skycryer commented 5 years ago

That was fast, nice. But why is that only working for the Youtube app but not for Plex? I can start both and get the status of both, and both response with "ok" when using the DELETE command.

curl -X DELETE http://192.168.1.110:8001/api/v2/applications/kIciSQlYEM.plex curl -X DELETE http://192.168.1.110:8001/api/v2/applications/111299001912

Maybe because the plex app is not and number only ID?

kdschlosser commented 5 years ago

so if you use

curl -X "GET" http://YOUR_TV_IP:8001/api/v2/applications/APPLICATION_ID

the returned data is going to be a json object and one of the elements in the object is going to be "visible" the value of that element will be true or false. this is what you use to know if the application is running or not.

and you are correct as far as the application id goes.

the application id is going to also be in this data structure. I believe it has the name of "add_id"

skycryer commented 5 years ago

The Plex response is

{ "name": "Plex", "running": true, "version": "3.92.3", "visible": false, "id": "kIciSQlYEM.plex" }

but visible does not change no matter if I use the app or it is in the background while another app is running. I only have a field id but that shows the same id as I used to get this status or run the app.

The running data is showing if the app is running or not, but even if the app is in background it shows running true.

kdschlosser commented 5 years ago

I know there is also another element called "running" I am not sure how this plays into it. I know that applications can be background applications so I am not sure if this only references a background application.

when you connect to http://YOUR_TV_IP:8001/api/v2/applications/APPLICATION_ID this is actually handled by the individual applications and it is not dealt with directly by the OS on the TV. so if an application did not add the handling of the DELETE command to close the application then it is not going to work. and you will then at that point ask in a Plex forum if there is a way to do it. and if there is not ask them to add the ability.

kdschlosser commented 5 years ago

sorry about that crossed posts somewhat.

kdschlosser commented 5 years ago

I am also not sure if the DELETE command only removes the application GUI from being displayed. or if it will close the whole application (background service and all) This is something I have yet to mess about with.

This would be a huge help to me if you can ask them if they have an API for their Samsung TV application. Because the connection point http://192.168.1.110:8001/api/v2/applications/kIciSQlYEM.plex is also a websocket connection point. and the application can be controlled via that entry point. so long as we know what the API is. Again this is something that the developers of the Plex application would have coded into the application. The mechanism to close the app might be in the websocket API and not in the HTTP API

skycryer commented 5 years ago

Ok I will ask the Plex Forum for help. If I get new Info I will share it here.

kdschlosser commented 5 years ago

https://forums.plex.tv/t/noob-question-samsung-client-api-endpoint-not-available/143749

their application is closed source and does not have any public API endpoints.

skycryer commented 5 years ago

That means it is not possible to close the App or get the needed Information?

Bercolly commented 5 years ago

Hi,

Nice work ! Is there anyway to launch an app on a F series (legacy Tv) ? Which url and how to encode parameters.

Thanks Regards Bernard

adeeltahir98 commented 4 years ago

MyCodeRocks I am also struggling to get an image out of this url

"/opt/share/webappservice/apps_icon/FirstScreen/11101200001/250x250.png"

but unfortunately I can't. Did you somehow managed to do it. If yes, then please tell me.

hjm79 commented 4 years ago

Does anyone know tvplus id?

funnel20 commented 4 years ago

WebSockets also allow to launch/close/get-state of tv app, e.g:

// launch app
ws.send(JSON.stringify({
    method: 'ms.application.start',
    id: Date.now(),
    params: {
        id: '11101200001',
    }
}));

The method can be:

  • ms.application.start
  • ms.application.get
  • ms.application.stop
  • ms.application.install
  • ms.channel.emit (for custom messaging with app)

They all are also from Tizen sources.

@vitalets Thanks for these commands. When I send the ms.application.XXX methods to my M-Series or K-Series TV, it responds with an ms.error:

{"data":{"message":"unrecognized method value : ms.application.stop"},"event":"ms.error"}

When using the GET/POST/DELETE messages from the SmartView API (see your comment) the TV acts as expected. 👍

However, the PUT command to show the installation page, responses with true (or "ok":true for the K-Series) but doesn't do anything on the TV. This is the case when using an app ID from an an app that is already installed on the TV. But this feature would be especially valuable when using an ID for an app that is not installed, since then the installation page makes sense. But in this case, the API response with error code 404 - Not Found.

Is there something that I do wrong? Or do you have any idea how to get to the installation page for an app that is not installed on the TV?

fi-sch commented 4 years ago

Does anyone know Apple TV or Tidal app_id?

vitalets commented 4 years ago

Does anyone know Apple TV or Tidal app_id?

We have several Apple TV ids on tizen 5:

Apple AirPlay                      NRi6kdBYJ0.AirPlayWebApp                     
Apple TV                           com.samsung.tv.aria-dummy                    
Apple TV                           com.samsung.tv.aria-video          
fi-sch commented 4 years ago

Does anyone know Apple TV or Tidal app_id?

We have several Apple TV ids on tizen 5:

Apple AirPlay                      NRi6kdBYJ0.AirPlayWebApp                     
Apple TV                           com.samsung.tv.aria-dummy                    
Apple TV                           com.samsung.tv.aria-video          

Thanks for your reply! I'm interested in Apple TV (and Tidal) app itself, not AirPlay service helper. I will test those that you provided during the upcoming weekend. However, I'm afraid that those will work only for AirPlay. I need the app_id number (like 11101200001 is for Netflix, 3201706012478 for HBO GO, and 111299001912 for YouTube, etc.).

holdestmade commented 4 years ago

If you go here:

https://graph-eu01-euwest1.api.smartthings.com/device/list

And log in, click on your device and then open the app you want the id for. Look at tvChannelName:

Thats the id for the app that is active

s-e-t-h commented 4 years ago

Does anyone know Apple TV or Tidal app_id?

We have several Apple TV ids on tizen 5:

Apple AirPlay                      NRi6kdBYJ0.AirPlayWebApp                     
Apple TV                           com.samsung.tv.aria-dummy                    
Apple TV                           com.samsung.tv.aria-video          

Does anyone know Apple TV or Tidal app_id?

We have several Apple TV ids on tizen 5:

Apple AirPlay                      NRi6kdBYJ0.AirPlayWebApp                     
Apple TV                           com.samsung.tv.aria-dummy                    
Apple TV                           com.samsung.tv.aria-video          

Thanks for your reply! I'm interested in Apple TV (and Tidal) app itself, not AirPlay service helper. I will test those that you provided during the upcoming weekend. However, I'm afraid that those will work only for AirPlay. I need the app_id number (like 11101200001 is for Netflix, 3201706012478 for HBO GO, and 111299001912 for YouTube, etc.).

Hey,

My post here may help.

https://www.reddit.com/r/homeassistant/comments/fxddeh/controlling_a_samsung_tv/

phukhanhlee commented 4 years ago

@freman Can you help me :) I can open web browser app with http post request http://192.168.1.14:8001/api/v2/applications/org.tizen.browser But I don't know how to set url to browser : example: open browser with url : google.com

About this: ws = new WebSocket('ws://10.10.1.21:8001/api/v2/channels/samsung.remote.control'); ws.onopen = function() {ws.send('{"method":"ms.channel.emit","params":{"event": "ed.apps.launch", "to":"host", "data":{"appId": "org.tizen.browser", "action_type": "NATIVE_LAUNCH"}}}')}; ws.onmessage = function(e) {console.log(e)}

I test with my TV and it's not working. I try to test connect to web socket successfully first with : https://websocketking.com/ with url : 'ws://192.168.1.14:8001/api/v2/channels/samsung.remote.control -> Could not connect

Do I miss anything to make this work ?

P/s : http://192.168.1.14:8001/api/v2/ -> return json successfully

casolorz commented 3 years ago

Is the PUT command to open the store supposed to work on all Tizen TVs? I have 2 where it pops up an error on the TV and I have 1 where it works just fine.

mystex commented 3 years ago

Found this on pastebin and can attest the Disneyplus code works, might be some on there to add to the list

https://pastebin.com/WP5Hc9GD

mystex commented 3 years ago

Found more here

https://github.com/kdschlosser/samsungctl/issues/25

s-e-t-h commented 3 years ago

Found this on pastebin and can attest the Disneyplus code works, might be some on there to add to the list

https://pastebin.com/WP5Hc9GD

lol, I made that ages ago. Let me know if need any help with it.

aisgdevteam commented 2 years ago

I request POST Data to http://192.168.1.110:8001/api/v2/applications/kIciSQlYEM.plex Please let me know how can i get data in tizen?

s-e-t-h commented 2 years ago

I request POST Data to http://192.168.1.110:8001/api/v2/applications/kIciSQlYEM.plex Please let me know how can i get data in tizen?

You need the IDE on a Mac, put the TV in developer mode and then download/see the app list. Which get the list I put into Pastebin above. @ me if you need help.

Andriod TV/Sony are far better and I have now moved away from Samsung after having to return 4 in one month due to buggy firmware. Never again.

s-e-t-h commented 2 years ago

Also, Postman is your friend :)

minh195 commented 2 years ago

Has anyone had the same problem when sending a request to get List app but no results are returned in onTextMessage on samsung TV 43inch model 2021 . Can anyone help me?

I/WebSocketModule: sendData: {"method":"ms.channel.emit","params":{"event":"ed.installedApp.get","to":"host"}}

image

ThatsMyCall commented 2 years ago

Has anyone had the same problem when sending a request to get List app but no results are returned in onTextMessage on samsung TV 43inch model 2021 . Can anyone help me?

I/WebSocketModule: sendData: {"method":"ms.channel.emit","params":{"event":"ed.installedApp.get","to":"host"}}

image

I think the only way to get app list from 2020+ models is trough Developer Mode the get Application List is no longer supported. Scroll up to see the comment mentioning it on how to do it. There is also a list of AppID's out already you can find it here. https://github.com/tavicu/homebridge-samsung-tizen/wiki/Applications

andriybilash commented 2 years ago

Has anyone had the same problem when sending a request to get List app but no results are returned in onTextMessage on samsung TV 43inch model 2021 . Can anyone help me? I/WebSocketModule: sendData: {"method":"ms.channel.emit","params":{"event":"ed.installedApp.get","to":"host"}} image

I think the only way to get app list from 2020+ models is trough Developer Mode the get Application List is no longer supported. Scroll up to see the comment mentioning it on how to do it. There is also a list of AppID's out already you can find it here. https://github.com/tavicu/homebridge-samsung-tizen/wiki/Applications

Does that mean that API for running applications is also removed from 2020+ models? I've tried to run Netflix using appId < 2020 {"method": "ms.channel.emit","params": {"event": "ed.apps.launch","to": "host","data": {"appId": "11101200001","action_type": "DEEP_LINK"}}} and appId for 2020+ {"method": "ms.channel.emit","params": {"event": "ed.apps.launch","to": "host","data": {"appId": "3201907018807","action_type": "DEEP_LINK"}}} But unfortunutally it;s not working for me.

mmenanno commented 2 years ago

Just to help others, this is from a Samsung QN88AA 65 TV:

{
  "Amazon Alexa": "3202004020626/AQKO41xyKP.AmazonAlexa",
  "Apple Music": "3201908019041/org.tizen.apple.applemusic",
  "Apple TV": "3201807016597/com.samsung.tv.ariavideo",
  "Disney+": "3201901017640/MCmYXNxgcu.DisneyPlus",
  "eManual": "20212100001/oKZtnuTBW8.emanual",
  "Gallery": "3201710015037/com.samsung.tv.gallery",
  "Google Assistant": "3202004020674/AkhP5nCr24.GoogleAssistant",
  "Google Duo": "3202008021439/IewQEY143t.GoogleDuoWeb",
  "Internet": "3202010022079/org.tizen.browser",
  "Kidoodle.TV": "3201910019457/LTqDGxS6NK.KidoodleTV",
  "Netflix": "3201907018807/org.tizen.netflixapp",
  "Plex": "3201512006963/kIciSQlYEM.plex",
  "Prime Video": "3201910019365/org.tizen.primevideo",
  "Samsung Health": "3201909019211/com.samsung.tv.samsunghealth",
  "Spotify": "3201606009684/rJeHak5zRg.Spotify",
  "Tubi": "3201504001965/3KA0pm7a7V.TubiTV",
  "YouTube": "111299001912/9Ur5IzDKqV.TizenYouTube"
}

Tested and they all work for me. Got their IDs from the OP instructions of using Tizen Studio here https://www.reddit.com/r/homeassistant/comments/fxddeh/controlling_a_samsung_tv/

s-e-t-h commented 2 years ago

Just to help others, this is from a Samsung QN88AA 65 TV:

{
  "Amazon Alexa": "3202004020626/AQKO41xyKP.AmazonAlexa",
  "Apple Music": "3201908019041/org.tizen.apple.applemusic",
  "Apple TV": "3201807016597/com.samsung.tv.ariavideo",
  "Disney+": "3201901017640/MCmYXNxgcu.DisneyPlus",
  "eManual": "20212100001/oKZtnuTBW8.emanual",
  "Gallery": "3201710015037/com.samsung.tv.gallery",
  "Google Assistant": "3202004020674/AkhP5nCr24.GoogleAssistant",
  "Google Duo": "3202008021439/IewQEY143t.GoogleDuoWeb",
  "Internet": "3202010022079/org.tizen.browser",
  "Kidoodle.TV": "3201910019457/LTqDGxS6NK.KidoodleTV",
  "Netflix": "3201907018807/org.tizen.netflixapp",
  "Plex": "kIciSQlYEM.plex",
  "Prime Video": "3201910019365/org.tizen.primevideo",
  "Samsung Health": "3201909019211/com.samsung.tv.samsunghealth",
  "Spotify": "3201606009684/rJeHak5zRg.Spotify",
  "Tubi": "3201504001965/3KA0pm7a7V.TubiTV",
  "YouTube": "111299001912/9Ur5IzDKqV.TizenYouTube"
}

Tested and they all work for me. Got their IDs from the OP instructions of using Tizen Studio here https://www.reddit.com/r/homeassistant/comments/fxddeh/controlling_a_samsung_tv/

Glad my guide is still helping haha!

KnutSchweinfurth commented 2 years ago

RTL+ 3201908018988 Magenta TV 3201907018746 Pluto TV 3201808016802

18rrs commented 2 years ago

hbo go become hbo max.. the code is not the same anymore.. by any chance, anyone can get the code for HBO Max?

ivomarsan commented 1 year ago

hbo go become hbo max.. the code is not the same anymore.. by any chance, anyone can get the code for HBO Max?

Hello my friend, try using cj37Ni3qXM.HBONow to HBO Max

Neilshweky commented 1 year ago

@freman

here is a link to a slack chat I created for samsungctl. https://join.slack.com/t/samsungtvcontrol/shared_invite/enQtNTA0Nzc2MjY4MTgxLWNjNWI5ZjQwYTMzNzYxNjlkYTI5NTk1ZmJmMDU5ZjRmMDRhYTg4NGIzYWVjMzU3YzlmMzM5NWNjNWQ5MzU3NjA you seem to have a really good grasp of how the websocket portion of this works. as well as discovering new functionality. I want to share the Tizen source code with ya. It is to much for a single person to dig through to find the websocket commands. they are all over the place. The source is written in C and Java mostly. not sure if you are familiar with, but you will know what to look for anyway. the source is for Tizen versions 1.0 to 5.0 and includes subsets for TV's, wearables, phones and many other Samsung products. if you are interested join that slack chat and send me a message. My alias is drschlosser on the slack chat.

Hey there, does this slack still exist? Can you share a new invite link?

BarneyHam commented 1 year ago

Hi - Thank you for all app lists provided.

I am trying to find the numerical/alphumeric app ID for the BT Sport app - has anyone got this?

Bliksembaard commented 1 year ago

Here is a comprehensive list of app ID's:

https://github.com/tavicu/homebridge-samsung-tizen/wiki/Applications

fischrobi commented 1 year ago

The New streaming's (SkyShowTime) app name is: skysh0WTIM.SkyShowtime

OriginalCREart commented 3 months ago

For those who want Shahid from MBC group App details