Ape / samsungctl

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

QSeries #114

Open Cmac2016 opened 5 years ago

Cmac2016 commented 5 years ago

Will this code work on a 2018 Q series? I have been trying to get this code to run and cannot get thru all the errors that are happening for me.

cyclops1982 commented 4 years ago

Show what you have tried and which errors you get!

jbro commented 4 years ago

I've just tried the using samsungctl on a Q series:

If I do:

curl http://192.168.0.10:8001/api/v2

Then the TV pops up with a "Give smart device access prompt", if how ever I run samsungctl as below, no popup shows.

$ samsungctl --host 192.168.0.10 --method websocket KEY_MENU

Returns

Traceback (most recent call last): File "/home/jumbotron/.local/bin/samsungctl", line 11, in sys.exit(main()) File "/home/jumbotron/.local/lib/python3.6/site-packages/samsungctl/main.py", line 110, in main with Remote(config) as remote: File "/home/jumbotron/.local/lib/python3.6/site-packages/samsungctl/remote.py", line 11, in init self.remote = RemoteWebsocket(config) File "/home/jumbotron/.local/lib/python3.6/site-packages/samsungctl/remote_websocket.py", line 30, in init self._read_response() File "/home/jumbotron/.local/lib/python3.6/site-packages/samsungctl/remote_websocket.py", line 72, in _read_response raise exceptions.UnhandledResponse(response) samsungctl.exceptions.UnhandledResponse: {'event': 'ms.channel.unauthorized'}

Cmac2016 commented 4 years ago

This is basically the same things I have tried except I used Chrome web socket tool to send the commands. Get the same result however. It allows me to authorize but then all commands return: 'event': 'ms.channel.unauthorized

jbro commented 4 years ago

So I actually got something working, but without using samsungctl.

First off the remote control endpoint is only availiable on using secure websocket.

Secondly it needs ?token=<8 didgit number> added to the URL, where the eight digit number is returned after the device is allowed access using dialog the pop up on the tv.

Cmac2016 commented 4 years ago

using ws client I get an initial response of:

06:48:15 -> (json)

{ "data": { "clients": [ { "attributes": { "name": null }, "connectTime": 1567075825828, "deviceName": "Smart Device", "id": "1194e510-7e44-48f2-a15a-6c35d992d125", "isHost": false } ], "id": "1194e510-7e44-48f2-a15a-6c35d992d125" }, "event": "ms.channel.connect" }

but no commands i send after this seem to work. always get unauthorized.

cyclops1982 commented 4 years ago

@jbro - when exactly do you get that 8 digit number? What do you do to get that token?

jbro commented 4 years ago

If you connect to the remote control endpoint on secure websocket like:

$ wscat -n --connect wss://192.168.0.10:8002/api/v2/channels/samsung.remote.control

Then a little dialog pops up on the tv, that asks you if you want to allow the device, after pressing allow some json like below is returned containing the token:

> connected (press CTRL+C to quit)
< {"data":{"clients":[{"attributes":{"name":null},"connectTime":1567087962961,"deviceName":"Smart Device","id":"c8f69ec8-8379-4a29-8c80-43446c0a2c7","isHost":false}],"id":"c8f69ec8-8379-4a29-8c80-43446c0a2c7","token":"16131682"},"event":"ms.channel.connect"}
Cmac2016 commented 4 years ago

Thank you.

I will try this again today.

After getting the token and I am connected to the display can you please verify the format of the commands sent. I believe they are sent in a json format but want to confirm. Can you provide a sample of how the command is sent.

Thank you.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jesper Brix Rosenkilde notifications@github.com Sent: Thursday, August 29, 2019 10:16:05 AM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

If you connect to the remote control endpoint on secure websocket like:

$ wscat -n --connect wss://192.168.0.10:8002/api/v2/channels/samsung.remote.control

Then a little dialog pops up on the tv, that asks you if you want to allow the device, after pressing allow some json like below is returned containing the token:

connected (press CTRL+C to quit) < {"data":{"clients":[{"attributes":{"name":null},"connectTime":1567087962961,"deviceName":"Smart Device","id":"c8f69ec8-8379-4a29-8c80-43446c0a2c7","isHost":false}],"id":"c8f69ec8-8379-4a29-8c80-43446c0a2c7","token":"16131682"},"event":"ms.channel.connect"}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGTHY4H2KC4YRIA5PATQG7K2LA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5OUDVQ%23issuecomment-526205398&data=02%7C01%7C%7Cd4862d39c8804e36201508d72c8b6ec6%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637026849672283214&sdata=PGsQgd%2BB5Irqb8kw2U4Ucjp7ynLYNTXSTK90%2Bted%2Bn8%3D&reserved=0, or mute the threadhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGT6T6HO744ADTOLJRDQG7K2LANCNFSM4HQL6ZSQ&data=02%7C01%7C%7Cd4862d39c8804e36201508d72c8b6ec6%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637026849672283214&sdata=H%2BAI0q5gStA2DxjqwW%2B2siAK6o5gXycl6INydnEeXNY%3D&reserved=0.

jbro commented 4 years ago

This is what I'm using, it's not pretty but it works:

#!/usr/bin/env python3
import websocket
import ssl
import sys
import os

tv_ip = '192.168.0.10'

if sys.argv[1] == 'on':
    if os.system("ping -c 1 " + tv_ip) is 0:
        ws = websocket.create_connection('wss://192.168.0.10:8002/api/v2/channels/samsung.remote.control?name=anVtYm90cm9u&token=12368079', sslopt={"cert_reqs": ssl.CERT_NONE})
        ws.send('{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_POWER","Option":false,"TypeOfRemote":"SendRemoteKey"}}"')
        ws.send('{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_HDMI","Option":false,"TypeOfRemote":"SendRemoteKey"}}"')
    else:
        os.system('sudo etherwake -i enp4s0 c0:48:e6:19:4e:4e')

if sys.argv[1] == 'off':
    ws = websocket.create_connection('wss://192.168.0.10:8002/api/v2/channels/samsung.remote.control?name=anVtYm90cm9u&token=12368079', sslopt={"cert_reqs": ssl.CERT_NONE})
    ws.send('{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_POWER","Option":false,"TypeOfRemote":"SendRemoteKey"}}"')
Cmac2016 commented 4 years ago

Thank you.

I will try this with ws client tonight then try to get the code working.

So basically

  1. Connect and get token.
  2. Then disconnect
  3. Connect with name and token
  4. Then should be able to send the command json strings.

Does this sound correct?

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jesper Brix Rosenkilde notifications@github.com Sent: Thursday, August 29, 2019 10:21:57 AM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

This is what I'm using, it's not pretty but it works:

!/usr/bin/env python3

import websocket import ssl import sys import os

tv_ip = '192.168.0.10'

if sys.argv[1] == 'on': if os.system("ping -c 1 " + tv_ip) is 0: ws = websocket.create_connection('wss://192.168.0.10:8002/api/v2/channels/samsung.remote.control?name=anVtYm90cm9u&token=12368079', sslopt={"cert_reqs": ssl.CERT_NONE}) ws.send('{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_POWER","Option":false,"TypeOfRemote":"SendRemoteKey"}}"') ws.send('{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_HDMI","Option":false,"TypeOfRemote":"SendRemoteKey"}}"') else: os.system('sudo etherwake -i enp4s0 c0:48:e6:19:4e:4e')

if sys.argv[1] == 'off': ws = websocket.create_connection('wss://192.168.0.10:8002/api/v2/channels/samsung.remote.control?name=anVtYm90cm9u&token=12368079', sslopt={"cert_reqs": ssl.CERT_NONE}) ws.send('{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_POWER","Option":false,"TypeOfRemote":"SendRemoteKey"}}"')

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGVGAXNEQZZSYD3YYUDQG7LQLA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5OU2BA%23issuecomment-526208260&data=02%7C01%7C%7Cb52f2671a0f8477e6af708d72c8c40ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637026853195677448&sdata=H90iEXwLF8qllsUF3OLmQRmzVq3XuqRQOF%2BDLArkh5A%3D&reserved=0, or mute the threadhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGV4DRH7JNF4JD24QJLQG7LQLANCNFSM4HQL6ZSQ&data=02%7C01%7C%7Cb52f2671a0f8477e6af708d72c8c40ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637026853195687460&sdata=BJ8nSpXQLvnLAIUDpuHiCAuGNUAeFO07GvCpYUBc9jg%3D&reserved=0.

jbro commented 4 years ago

Sounds very reasonable, maybe you should use the name when getting the token, I don't know if it is a pair.

Cmac2016 commented 4 years ago

Sounds good. I will test this tonight and let you know how it works out for me.

Thank you for all your help on this. It’s been a painful process.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jesper Brix Rosenkilde notifications@github.com Sent: Thursday, August 29, 2019 10:30:11 AM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

Sounds very reasonable, maybe you should use the name when getting the token, I don't know if it is a pair.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGSFILRAYAGQOCQIPULQG7MPHA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5OVZZI%23issuecomment-526212325&data=02%7C01%7C%7C3ab0182974444bbbbbf908d72c8d66ac%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637026858126388573&sdata=ZCqDPu2CW42xeaKliyELX8mzM5vfTjNT%2BnXtimxwtoA%3D&reserved=0, or mute the threadhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGTVRN5WCYBFWT5GXATQG7MPHANCNFSM4HQL6ZSQ&data=02%7C01%7C%7C3ab0182974444bbbbbf908d72c8d66ac%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637026858126388573&sdata=COjZOhquL1YTnq9LkDYzggLeawF1ed%2FV%2FFlLHJATfgc%3D&reserved=0.

jbro commented 4 years ago

No problem, let me know when you have it in master, then I'll test it out :)

Cmac2016 commented 4 years ago

any time I try wss// it will not connect. I have to use ws// on port 8001

here are my results....sadly still no success

21:41:12 Connecting to "ws://10.0.0.244:8001/api/v2/channels/ms.remote.control?name="ChrisRemote""

21:41:12 Successfull connected to "ws://10.0.0.244:8001/api/v2/channels/ms.remote.control?name="ChrisRemote""

21:41:12 -> (json)

{ "data": { "clients": [ { "attributes": { "name": "\"ChrisRemote\"" }, "connectTime": 1567129408905, "deviceName": "\"ChrisRemote\"", "id": "c2273afe-ce5f-426-a39-bfaee018976a", "isHost": false } ], "id": "c2273afe-ce5f-426-a39-bfaee018976a" }, "event": "ms.channel.connect" } 21:41:18 <- (json)

{ "method": "ms.remote.control", "params": { "Cmd": "Click", "DataOfCmd": "KEY_POWER", "Option": false, "TypeOfRemote": "SendRemoteKey" } } 21:41:18 -> (json)

{ "data": { "message": "unrecognized method value : ms.remote.control" }, "event": "ms.error" }

if I format the request using samsung.remote.control:

21:46:41 Connecting to "ws://10.0.0.244:8001/api/v2/channels/samsung.remote.control"

21:46:41 Successfull connected to "ws://10.0.0.244:8001/api/v2/channels/samsung.remote.control"

21:46:41 -> (json)

{ "event": "ms.channel.unauthorized" } 21:46:41 Connection to "ws://10.0.0.244:8001/api/v2/channels/samsung.remote.control" closed

21:46:41 Error: (1006)

jbro commented 4 years ago

Oh yeah forgot to mention wss runs on port 8002, see my code above.

Cmac2016 commented 4 years ago

I tried wss on port 8002.

Result:

06:15:09 Connecting to "wss://10.0.0.244:8002/api/v2/channels/samsung.remote.control"

06:15:09 Connection to "wss://10.0.0.244:8002/api/v2/channels/samsung.remote.control" closed

06:15:09 Error: (1006)

Seems my display actively refuses a connection on that port. Only port that does anything is 8001

jbro commented 4 years ago

I don't know if this is after a certain version of either the TV or firmware. My TV is a Q7 I think running the newest firmware as of last week.

Cmac2016 commented 4 years ago

Mine is a Q6. Firmware should be up to date

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jesper Brix Rosenkilde notifications@github.com Sent: Friday, August 30, 2019 9:39:33 AM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

I don't know if this is after a certain version of either the TV or firmware. My TV is a Q7 I think running the newest firmware as of last week.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGXKZBTCCU3UNZCS3ADQHEPJLA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5RVYZA%23issuecomment-526605412&data=02%7C01%7C%7C5301e0271956494ac9ff08d72d4f7e66%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637027691747897224&sdata=RvnGiCqONTZRw4%2Fl8lYMHOo9nqPqYgXtw8FrEe1HkSM%3D&reserved=0, or mute the threadhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGQKJQJF7AXRTGJZKHTQHEPJLANCNFSM4HQL6ZSQ&data=02%7C01%7C%7C5301e0271956494ac9ff08d72d4f7e66%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637027691747907241&sdata=n2EdgsMO5o8BnXmaioV0n4e1AWKhpdX%2Fg%2BEzjfHxo90%3D&reserved=0.

gbrissey commented 4 years ago

I have a Q8, and would like get this working on mine. Be happy to try it out on my Q8. I'm a bit confuse as to which branch and which repo I should actually pull from. (i.e. which is the latest)

There is the yours samsungctl , and one by Kdschlossar (which I believe a fork of yours)

I've been trying this on my linux machine to get it to work, but in the end I would like to get this working on my HASSIO based Home Assistant. planning to use the AppDaemon add-on so I can use python to call this package

I'm currently using your master branch. I'll try the wscat or ws I see if I can get the token.

Any other suggestion let me know. Thanks

cyclops1982 commented 4 years ago

HI,

So, i have a UE43RU7400UXXU. Which is officially a series 7 TV. My API version is 2.0.25. I've all other code that i've seen online not to work, as i never got a token.

Now, the below code seems to work.

To get a token:

const WebSocket = require('ws');

function base64Encode(aStr) {
    return Buffer.from(aStr).toString('base64');
};

var appname = base64Encode("SamsungTvRemote2");
var baseURL = "wss://192.168.1.22:8002/api/v2/channels/samsung.remote.control?name=" + appname

function getToken() {
    var uri = baseURL;
    console.log('URL: ' + uri)
    let ws = new WebSocket(uri, {
        rejectUnauthorized: false
    });

    ws.on('message', (response) => {
        console.log("SOCKET 1 RECEIVED: " + response);

        var data = JSON.parse(response);

        if (data.event === "ms.channel.connect") {
            console.log("YOUR TOKEN IS:" + data.data.token);
        }
    })
}

` When you run this, the TV will ask you for 'permission' for the app. The name will be the same as above "SamsungTvRemote2". After you approve that (click Allow), then you'll get the token from the K2. It can also time-out at this point, so don't be slow as a snail :)

After that, the following code will work to do 'volume down' const WebSocket = require('ws');

function base64Encode(aStr) {
    return Buffer.from(aStr).toString('base64');
};

var appname = base64Encode("SamsungTvRemote2");
var baseURL = "wss://192.168.1.22:8002/api/v2/channels/samsung.remote.control?name=" + appname
var token = 22936467; # REPLACE WITH YOUR TOKEN

function doStuff() {

    uri = baseURL+"&token="+token;
    console.log('URL: ' + uri)
    ws = new WebSocket(uri, {
        rejectUnauthorized: false
    });

    ws.on('message', (response) => {
        console.log("SOCKET 2 RECEIVED:" + response);

        var data = JSON.parse(response);

        var cmd = {
            method: 'ms.remote.control',
            params: {
                Cmd: 'Click',
                DataOfCmd: 'KEY_VOLDOWN',
                Option: 'false',
                TypeOfRemote: 'SendRemoteKey'
            }
        }
        var str = JSON.stringify(cmd);
        console.log('SOCKET 2 SEND:' + str);
        ws.send(str);

    });

}

doStuff();

For me, this works. I'm not sure how long this token lasts. I tend to power down the TV every night, not sure if it forgets the code. THe token i got last week didn't work.

gbrissey commented 4 years ago

cyclops1982,

I was all excited to try this out, until I realized this wasn't python. Darn. What language is this? Go?

I'll see if I can convert it to python and get it to work.

Cmac2016 commented 4 years ago

I will try to convert to C# for my application. Seems very straight forward. I will try it first in a ws client and see if it connects and get a token. Will keep everyone posted.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Brissey notifications@github.com Sent: Sunday, September 8, 2019 12:01:37 PM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

cyclops1982,

I was all excited to try this out, until I realized this wasn't python. Darn. What language is this? Go?

I'll see if I can convert it to python and get it to work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGSFEDGESAQYHPYLG5LQIUOWDA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6FTG2Q%23issuecomment-529216362&data=02%7C01%7C%7C1c0f5bd555b14782785608d73475d49e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637035552985279565&sdata=x867fdMQQvdBdPSpwEsoW1DebsT1jknqIud6CDRmGb8%3D&reserved=0, or mute the threadhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGTEWW26AX3B66IHZVLQIUOWDANCNFSM4HQL6ZSQ&data=02%7C01%7C%7C1c0f5bd555b14782785608d73475d49e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637035552985289576&sdata=W97rMP%2FkU%2BHG%2FHC%2BkGPgiSE0Ib6GilSP7qgT7fqW5Wc%3D&reserved=0.

Cmac2016 commented 4 years ago

My display refuses any connection on port 8002.

Can connect to port 8001 but no command seems to work using WS client.

I connect but any time a connection is successful I get:

21:14:06 Connecting to "ws://10.0.0.80:8001/api/v2/channels/ms.remote.control"

21:14:06 Successfull connected to "ws://10.0.0.80:8001/api/v2/channels/ms.remote.control"

21:14:06 -> (json)

{

"data": {

    "clients": [

        {

            "attributes": {

                "name": null

            },

            "connectTime": 1567991805347,

            "deviceName": "Smart Device",

            "id": "2d7bc5e3-782d-4f94-bbb-32322b828c9d",

            "isHost": false

        }

    ],

    "id": "2d7bc5e3-782d-4f94-bbb-32322b828c9d"

},

"event": "ms.channel.connect"

}

This is the most I have ever been able to get from the display.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10


From: Chris M Sent: Sunday, September 8, 2019 8:36:27 PM To: Ape/samsungctl reply@reply.github.com; Ape/samsungctl samsungctl@noreply.github.com Cc: Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

I will try to convert to C# for my application. Seems very straight forward. I will try it first in a ws client and see if it connects and get a token. Will keep everyone posted.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Brissey notifications@github.com Sent: Sunday, September 8, 2019 12:01:37 PM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

cyclops1982,

I was all excited to try this out, until I realized this wasn't python. Darn. What language is this? Go?

I'll see if I can convert it to python and get it to work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGSFEDGESAQYHPYLG5LQIUOWDA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6FTG2Q%23issuecomment-529216362&data=02%7C01%7C%7C1c0f5bd555b14782785608d73475d49e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637035552985279565&sdata=x867fdMQQvdBdPSpwEsoW1DebsT1jknqIud6CDRmGb8%3D&reserved=0, or mute the threadhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGTEWW26AX3B66IHZVLQIUOWDANCNFSM4HQL6ZSQ&data=02%7C01%7C%7C1c0f5bd555b14782785608d73475d49e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637035552985289576&sdata=W97rMP%2FkU%2BHG%2FHC%2BkGPgiSE0Ib6GilSP7qgT7fqW5Wc%3D&reserved=0.

gbrissey commented 4 years ago

Cyclops1982, et.al.,

Based on your code I cobbled together a python 3.X web-client to see if I could get a token back from my Samsung Q8FN

I can now get my TV to display the pop-up to give permission for my device to be connected. And when I do I do get a token back!!! (got to be fast on that remote button press to allow)

response: {"data":{"clients":[{"attributes":{"name":"SamsungTvRemote2"},"connectTime":1568005339390,"deviceName":"SamsungTvRemote2","id":"81177dfe-2c84-4ec9-a614-7f2a4a81fad","isHost":false}],"id":"81177dfe-2c84-4ec9-a614-7f2a4a81fad","token":"14517545"},"event":"ms.channel.connect"}

I still have a few issues, when I go to the external device list (on the TV) for devices that have been allowed to connect. The entry which should have the name of the device shows [Invalid UTF-8] So I either forgot some option or the encoding is not quite right. The code is just gets the the token

I also noticed, in my case at least, the TV must be TV source (i.e. not in app like YouTube or Netflix for the pop-up to occur. I also had my AVR off as well (may not be necessary)

If you run this code more than once be sure to delete the device from the Samsung's TV External Device List! Otherwise you'll probably get some sort of connection refused error.

here is the python code:

import base64 import sys import re try: import thread except ImportError: import _thread as thread import time import websocket import ssl

appname = 'SamsungTvRemote2' baseURL = "wss://192.168.1.23:8002/api/v2/channels/samsung.remote.control?name=" + appname

def on_message(ws, message): print('on_message') print(message)

def on_error(ws, error): print('on_error') print(error)

def on_close(ws): print('on_close') print("### closed ###")

def on_open(ws): def run(*args): for i in range(3): time.sleep(1) ws.send("Hello %d" % i) time.sleep(2) ws.close() print("thread terminating...") thread.start_new_thread(run, ())

if name == "main": websocket.enableTrace(True) uri = baseURL; print('URL: ' + uri) print("") ws = websocket.WebSocketApp(uri, on_message = on_message, on_error = on_error, on_close = on_close)

ws.on_open = on_open
# disable of the SSL Cert requirement
ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}) 

Hope this help others, and maybe someone can tell me why I get Invalid UTF-8 for a device in the TV external device list

gbrissey commented 4 years ago

For some reason all the indenting for the python got removed in the post. Sorry about that.

Cmac2016 commented 4 years ago

Do you know of any reason my display would refuse connection on wss port 8002. I can only connect ws on port 8001 and can never get a token.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Brissey notifications@github.com Sent: Monday, September 9, 2019 2:46:56 AM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

For some reason all the indenting for the python got removed in the post. Sorry about that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGU242SFLQWMXCMCZKTQIXWOBA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6GNJPI%23issuecomment-529323197&data=02%7C01%7C%7C74ce0c7332e1489ab6a908d734f18235%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637036084178682335&sdata=Zg1PNIfdWl%2BE1vMfaxYuRIdo6Pk9fzgqiOMnWOrG4s4%3D&reserved=0, or mute the threadhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGRH33WK6MGPDWLPG2DQIXWOBANCNFSM4HQL6ZSQ&data=02%7C01%7C%7C74ce0c7332e1489ab6a908d734f18235%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637036084178692344&sdata=2%2BDMFh9PCR%2BbVCjDtbkdW2oPgFUyN3IIZ7U4flbz7o0%3D&reserved=0.

gbrissey commented 4 years ago

I'm not exactly sure except when I tried connected to 8002 it always refused connection until I specified the websocket not use use SSL Certificate. e.g. sslopt={"cert_reqs": ssl.CERT_NONE}. You don't have that port blocked by your router (not that it should). As I mentioned before my TV had to be in a specific configuration to observe the pop-up..... Also on occasion I need to power off and power on the TV before I get the prompt TV is a QN65Q8FNB My software version displayed is: T-KTM2AKUC-1270.6, BT-S if that is any help.....

gbrissey commented 4 years ago

Here's a example python that sends the KEY_MENU to the TV

I know, the indentation are all gone. Somebody tell how to get them to stay. Looks fine before I submit.

python 3.X code

``# -- coding: utf-8 -- import sys import re try: import thread except ImportError: import _thread as thread import time import websocket import ssl import json

def sendCmd(ws,keycmd): ''' json cmd format cmd = { 'method' : 'ms.remote.control', 'params': { 'Cmd': 'Click', 'DataOfCmd': 'KEY_MENU', 'Option': 'false', 'TypeOfRemote': 'SendRemoteKey' } } ''' cmddict = { 'method' : 'ms.remote.control' } paramdict = { 'Cmd': 'Click', 'DataOfCmd': 'Bogus_KEY', 'Option': 'false','TypeOfRemote': 'SendRemoteKey'} paramdict['DataOfCmd'] = keycmd cmddict['params'] = paramdict; json_str = json.dumps(cmddict) print(json_str) ws.send(json_str);

if name == "main": websocket.enableTrace(True) appname = "SamsungTvRemote2" base_url = "wss://192.168.1.23:8002/api/v2/channels/samsung.remote.control?name={}&token={}" token = "57216234" url = base_url.format(appname,token) # e.g. name=SamsungTvRemote2&token=47216513 print(url) ws = websocket.create_connection(url, sslopt={"cert_reqs": ssl.CERT_NONE})

ws = None

# bring up menu
sendCmd(ws,'KEY_MENU')
time.sleep(5)
# close the menu
sendCmd(ws,'KEY_MENU')
ws.close()
cyclops1982 commented 4 years ago

@gbrissey The appname that you use, needs to be a base64 encoded string. That's why it's complaining about the UTF-8 issue. The javascript has a little base64encode method and that's waht's being used.

Once you have the token, does it stay the same? I've noticed that i can send a few commands but then it just responds with No Authorization. I've also noticed that turning off the TV and then ON again seems to 'forget' the previous code. Ideally - i'd like to just get one code once.

I wonder if it has to do with the fact that we use a websocket and/or not close it properly, or something like that?

About the code formatting: https://help.github.com/en/articles/creating-and-highlighting-code-blocks

Cmac2016 commented 4 years ago

Finally started to make some progress. I was using the WSC client in chrome to try and test connections and commands and could never get it to work. Built a simple connection in C# and now I can connect and get the token. Now just have to get logged back in with token and see if it will respond to any commands. Will post some code once I have something real to show.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Ruben notifications@github.com Sent: Tuesday, September 10, 2019 2:56:25 AM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

@gbrisseyhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgbrissey&data=02%7C01%7C%7C9b02935e62e142081e4808d735bbff57%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637036953860094596&sdata=Y69wEQq8e6ygEoxWX3Hk0RPymET5VJIT%2BOkxRm8ZFeM%3D&reserved=0 The appname that you use, needs to be a base64 encoded string. That's why it's complaining about the UTF-8 issue. The javascript has a little base64encode method and that's waht's being used.

Once you have the token, does it stay the same? I've noticed that i can send a few commands but then it just responds with No Authorization. I've also noticed that turning off the TV and then ON again seems to 'forget' the previous code. Ideally - i'd like to just get one code once.

I wonder if it has to do with the fact that we use a websocket and/or not close it properly, or something like that?

About the code formatting: https://help.github.com/en/articles/creating-and-highlighting-code-blockshttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhelp.github.com%2Fen%2Farticles%2Fcreating-and-highlighting-code-blocks&data=02%7C01%7C%7C9b02935e62e142081e4808d735bbff57%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637036953860094596&sdata=HabV6p%2B%2Fyqkp0G7qjjokKsIDkjPnePzD6n30b1T%2B1Gg%3D&reserved=0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGRO5KSRUWAGXPCQEMLQI5AJTA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6KBRHQ%23issuecomment-529799326&data=02%7C01%7C%7C9b02935e62e142081e4808d735bbff57%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637036953860104600&sdata=GPCyiA2wNl76jGHh48%2FzplYNH5JbDrf3TJTTiYCGwQw%3D&reserved=0, or mute the threadhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGSU2YCVWXNZ3ZOXEU3QI5AJTANCNFSM4HQL6ZSQ&data=02%7C01%7C%7C9b02935e62e142081e4808d735bbff57%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637036953860104600&sdata=Sw1aPR82F4AogujNpna%2B1KwcF%2BBD9SsxWLUoNVGwabw%3D&reserved=0.

gbrissey commented 4 years ago

Ah, base64 encoding, python has something for that as well. I'll try that this evening and see what happens. I believe that token is forever as long as it's the same device and name. On my Q8 if I go to Setting -> General -> External Device Manager there is a device list that shows all devices that have been allowed or refused to connect. You can delete them and view them. Doesn't show the issued token though, that would of been nice. Not sure why your are experiencing your connection issue.

Thanks for the replay.

cyclops1982 commented 4 years ago

I know the list, and have cleaned it a few times already. I don't know why the token doesn't work after a while. Maybe there is some protection against overflow or something. I've also noticed that if you keep multiple websockets open than you'll see it when other websockets connect. So there's quite a bit going on there. I also wonder how you correctly close a connection with that regards.

I personally would have liked a simple HTTP 1.1 call (POST or something) for a keypress, but it seems websockets are what we need to use.

gbrissey commented 4 years ago

@cyclops1982 strange you ask about a POST/GET interface There is one. once you TV is on try this: POST this http://192.168.1.23:8080/ws/app/Netflix this should start up Netflix on the TV I was using Postman to POST or GET from the TV. This might be easier t use if it weren't for having to figure out all the commands yourself.

gbrissey commented 4 years ago

@cyclops1982 I'm now seeing the behavior you are reporting. Each command to the TV generates a pop-up to allow. Very odd indeed. Very inconsistent behavior. Not sure what's going on here. And if I convert my UTF-8 string to base64 the websocket throws an error

Cmac2016 commented 4 years ago

I finally have some basic functions working in C#. I do not get the prompt each time a command is sent so not sure what you are seeing. Going to try and add more basic commands and test. Is there any way to get a status that you know of. For example: power status or input status.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Brissey notifications@github.com Sent: Wednesday, September 11, 2019 2:46:39 AM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

@cyclops1982https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcyclops1982&data=02%7C01%7C%7Ca37fcb2128c546d4a92a08d73683ccfb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637037812010125612&sdata=zrskNX%2FCJ4%2FQwDJRxaXV54P4k4%2BwT0QQFAXnxYpMTl8%3D&reserved=0 I'm now seeing the behavior you are reporting. Each command to the TV generates a pop-up to allow. Very odd indeed. Very inconsistent behavior. Not sure what's going on here. And if I convert my UTF-8 string to base64 the websocket throws an error

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGRBVUJJFSW6ED23SALQJCH47A5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6NOTJQ%23issuecomment-530246054&data=02%7C01%7C%7Ca37fcb2128c546d4a92a08d73683ccfb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637037812010135617&sdata=os7Q5aKX3Plzzu%2BXKmruIVo37TEf1L3%2FPk4eNiq0QQo%3D&reserved=0, or mute the threadhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGQRRY6FQLZUU5BSFSDQJCH47ANCNFSM4HQL6ZSQ&data=02%7C01%7C%7Ca37fcb2128c546d4a92a08d73683ccfb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637037812010135617&sdata=5QJkEAX%2FOD35smKN7yywOgyMm7YbcxpWWNRIBOY358o%3D&reserved=0.

raydog153 commented 4 years ago

There was a ton of work on fork of this repo that addressed the websocket logic you guys are working thru. I think you should try out the develop branch here https://github.com/kdschlosser/samsungctl/tree/develop

gbrissey commented 4 years ago

@raydog153 I've tried this repo and both the develop and master branch. The development gave me python errors and the master hung without appearing to do anything. i didn't see any responses to posted issues, so I wasn't sure if this was still an active project.

Have you been successful with this samsungvtl ?

raydog153 commented 4 years ago

Sad to say I have one of those 2014 TVs that are next to impossible to get working if firmware was updated. I do not have port 8001/8002 enabled at all, only very few ports open. I do have port 8080 so some of the UPNP stuff I can get to work, change volume, WOL. My model number is UN40H5203.

I was helping to debug it for a while, then life happened and I gave up for the moment. Need to be careful depending on which python version you run. The repo owner was quite active, put a ton of work into it, and would be the best starting point. Could also look at the closed/open issues for help in understanding the logic too...

Cmac2016 commented 4 years ago

Just an update:

Have tested and verified the following commands on my Q6 Series. Still adding to the list:

KEY_MENU KEY_HOME KEY_VOLUP KEY_VOLDOWN KEY_MUTE KEY_POWER KEY_GUIDE KEY_CHUP KEY_CHDOWN KEY_CH_LIST KEY_PRECH KEY_LEFT

KEY_RIGHT

KEY_UP

KEY_DOWN

KEY_ENTER

KEY_RETURN

KEY_TOOLS

KEY_1

KEY_2

KEY_3

KEY_4

KEY_5

KEY_6

KEY_7

KEY_8

KEY_9

KEY_0

Do you know if there are any commands for launching the apps?

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10


From: raydog153 notifications@github.com Sent: Wednesday, September 11, 2019 11:55:08 PM To: Ape/samsungctl samsungctl@noreply.github.com Cc: Cmac2016 chrmac68@hotmail.com; Author author@noreply.github.com Subject: Re: [Ape/samsungctl] QSeries (#114)

Sad to say I have one of those 2014 TVs that are next to impossible to get working if firmware was updated. I do not have port 8001/8002 enabled at all, only very few ports open. I do have port 8080 so some of the UPNP stuff I can get to work, change volume, WOL. My model number is UN40H5203.

I was helping to debug it for a while, then life happened and I gave up for the moment. Need to be careful depending on which python version you run. The repo owner was quite active, put a ton of work into it, and would be the best starting point. Could also look at the closed/open issues for help in understanding the logic too...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FApe%2Fsamsungctl%2Fissues%2F114%3Femail_source%3Dnotifications%26email_token%3DAGA5EGQE2F5WBXBAZ4V3HWDQJG4RZA5CNFSM4HQL6ZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6QSECY%23issuecomment-530653707&data=02%7C01%7C%7C24046c8280034283280108d73735012b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637038573093439933&sdata=63ypGL1j23i86WKmD%2F0mBf1qqJgk5%2FSc2j%2B8R9jYRzY%3D&reserved=0, or mute the threadhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGA5EGVDCLC737NA3WZB2SLQJG4RZANCNFSM4HQL6ZSQ&data=02%7C01%7C%7C24046c8280034283280108d73735012b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637038573093439933&sdata=6wDnts81mtUTdbDXJPaRSsNi4tFbfPAvMmFuIR6Ndik%3D&reserved=0.

gbrissey commented 4 years ago

@raydog153 I've been trying to get Kdschosser repo samsungctl to work, got his development branch to run, but it seems to heavly rely on UPNP to discover the TV even when given the ip of the TV. However UPNP relies (someone correct me if I'm wrong) on UDP port 1900 which is not open on my TV, I'm guessing Samsung decided this was a security issue and closed this port. Thus the samsungctl will never find the TV. It's too bad all that work is now blocked. Not sure I can unravel the UPNP from te rest.

My biggest issue is is obtaining a token that will last between sessions (power down then up of the TV) I can get a token but it only lasts the one session. Can anybody help us.

gbrissey commented 4 years ago

@Cmac2016 Can you share your C# code, and have you been able to get a token that last even after turning the TV on/off/on?

gbrissey commented 4 years ago

I've solved the token not lasting between power cycles of the TV. On My Q8FN it's merely a setting on the TV, that a bit embarrassing. TV settings and find "external devices manager", "devices connection manager" or similar. There should be option for "confirmation message". Choose "first time only" or "never".

xchwarze commented 4 years ago

@gbrissey try https://github.com/xchwarze/samsung-tv-ws-api And this is the HA integration https://github.com/xchwarze/ha-samsungtv-custom/

gbrissey commented 4 years ago

@xchwarze Hey thanks for posting back to me. I definitely will check out your api and component

jametron commented 4 years ago

Thanks @gbrissey, @Cmac2016 and @jbro for the discussion! I used bits of your code above with the token and ssl setting to get it to work on my NU7120 using port 8002. Oddly enough I never get pop-ups on the TV screen or any changes to the list of external devices.

I'm a little bit disappointed that this WebSocket only enables you to emulate the buttons that already exist on the IR remote (and the SmartThings app) - what I really want is to have a QWERTY keyboard to speed up searching for programmes in Netflix etc. Can anybody point me in the direction of a repo that does that?

Lastly, a noob question: why are a lot of people hiding the TV's IP address in their posts? Is it really a security risk stating it explicitly?

Thanks!

ooii commented 4 years ago

Lastly, a noob question: why are a lot of people hiding the TV's IP address in their posts? Is it really a security risk stating it explicitly?

I'm not a security expert but I don't think publishing the internal IP addresses is a security risk. I'd say that if someone enters your network, discovering the IP addresses will be easy. However, when I send logs, I edit/hide my IP addresses :) Probably to do like all the people or not to show how am I configuring my network. That statement does not change what I said before but just reveals how stupid I am.

Galicarnax commented 3 years ago

I tried to control Samsung The Frame 75'' QLED 4K with samsungctl, without success. I then tried to track down the problem connecting directly via websocket:

wscat -c "ws://192.168.0.140:8001"

I had authorized my Linux desktop before that, so I recieved the answer:

Connected (press CTRL+C to quit)
< {"data":{"clients":[{"attributes":{"name":null},"connectTime":1611729559806,"deviceName":"Smart Device","id":"72507a17-aa93-4440-bb76-aa36467585a","isHost":false}],"id":"72507a17-aa93-4440-bb76-aa36467585a"},"event":"ms.channel.connect"}

However, when I try to send control commands, I get the response unrecognized method value:

> {"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_POWER","Option":false,"TypeOfRemote":"SendRemoteKey"}}"
< {"data":{"message":"unrecognized method value : ms.remote.control"},"event":"ms.error"}

After googling, I found another possible method to send (ms.channel.emit), and tried it:

> {"method":"ms.channel.emit","params":{"event": "ed.installedApp.get", "to":"host"}}

The TV doesn't send any response to this (and nothing happens on the TV), but apprantly it knows the method ms.channel.emit.

So my problem seems to be not authorization, but new method names. I failed to find them in Samsung API docs. Is it possible to ask the TV to list all avaialble methods?

Galicarnax commented 3 years ago

Ok, got it working, following jbro's comments (using manual secure websocket connection, not via samsungctl)

AleksandarDev commented 3 years ago

@Galicarnax I got response from TV (QE65Q70RATXXH) for {"method":"ms.channel.emit","params":{"event": "ed.installedApp.get", "to":"host"}} . Here's the sample response:

{
  "data": {
    "data": [
      {
        "appId": "111299001912",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/111299001912/250x250.png",
        "is_lock": 0,
        "name": "YouTube"
      },
      {
        "appId": "org.tizen.browser",
        "app_type": 4,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/webbrowser/250x250.png",
        "is_lock": 0,
        "name": "Internet"
      },
      {
        "appId": "11101200001",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/11101200001/250x250.png",
        "is_lock": 0,
        "name": "Netflix"
      },
      {
        "appId": "3201710015016",
        "app_type": 1,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/3201710015016/250x250.png",
        "is_lock": 0,
        "name": "SmartThings"
      },
      {
        "appId": "3201511006428",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/3201511006428/250x250.png",
        "is_lock": 0,
        "name": "Rakuten TV"
      },
      {
        "appId": "3201512006785",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/3201512006785/250x250.png",
        "is_lock": 0,
        "name": "Prime Video"
      },
      {
        "appId": "121299000101",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/121299000101/250x250.png",
        "is_lock": 0,
        "name": "TuneIn"
      },
      {
        "appId": "3201803015852",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/3201803015852/250x250.png",
        "is_lock": 0,
        "name": "Flying Fish 2"
      },
      {
        "appId": "org.tizen.example.STVOpenTKApp1",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/org.tizen.example.STVOpenTKApp1/250x250.png",
        "is_lock": 0,
        "name": "STVOpenTKApp1"
      },
      {
        "appId": "3201710015037",
        "app_type": 1,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/3201710015037/250x250.png",
        "is_lock": 0,
        "name": "Gallery"
      },
      {
        "appId": "20192100002",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/20192100002/250x250.png",
        "is_lock": 0,
        "name": "e-Manual"
      },
      {
        "appId": "3201601007250",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/3201601007250/250x250.png",
        "is_lock": 0,
        "name": "Google Play Movies"
      },
      {
        "appId": "3201909019271",
        "app_type": 2,
        "icon": "/opt/share/webappservice/apps_icon/FirstScreen/3201909019271/250x250.png",
        "is_lock": 0,
        "name": "PrivacyChoices"
      }
    ]
  },
  "event": "ed.installedApp.get",
  "from": "host"
}

STVOpenTKApp1 is my custom app.

Galicarnax commented 3 years ago

Yes, thanks, I was misguided by TV not responding with any output (which in Linux world stands for "OK" by default :) ) The only thing I'm still struggling with is how I get current TV status, e.g., if it's powered on or off (i.e. in the Art mode). Would appreciate hints.