Page 1 of 2
Send Auth request to Q
Posted: Tue May 15, 2018 3:41 pm
by MQ7Rocks
Hi all
I want to ask does anyone have some. Sample. Code to get the TV to pop-up the Auth request for a app.
I am trying to code a LUA script for my home automation system. I have seen the other HTTP codes and how to determine TV's etc through /rcr call on the TV. Returns a xml unpn xml. File.
Would be really helpful.
Sent from my SM-N950F using Tapatalk
Re: Send Auth request to Q
Posted: Tue May 15, 2018 8:57 pm
by zoelechat
There's no special code, TV will ask user agreement as soon as it receives something acceptable.
Re: RE: Re: Send Auth request to Q
Posted: Tue May 15, 2018 9:07 pm
by MQ7Rocks
zoelechat wrote:There's no special code, TV will ask user agreement as soon as it receives something acceptable.
Thank you, I am looking for some sample code I could send to the TV to invoke this. I have limited protocols to use in LUA can use a network socket, HTTP request, Post.
I wanted to send Auth request of sort get the TV to prompt and I would accept so I could send it Key requests I. E. Up down etc
Sent from my SM-N950F using Tapatalk
Re: Send Auth request to Q
Posted: Tue May 15, 2018 9:25 pm
by zoelechat
Well, you can take websockets example in
rccli code.
If you want to do it manually you can use for example "Simple Web Socket Client" extension for Firefox (or Chrome), then use as URL:
Code: Select all
ws://YOUR_TV_IP:8001/api/v2/channels/samsung.remote.control?name=cmNjbGk=
(name= at the end is name of device in base64, here "rccli")
and as request, e.g. (even if TV should already have asked your agreement at this point...)
Code: Select all
{"method":"ms.channel.emit","params":{"event": "ed.installedApp.get", "to":"host"}}
You should get some json (installed) apps list as reply

Re: RE: Re: Send Auth request to Q
Posted: Tue May 15, 2018 9:40 pm
by MQ7Rocks
zoelechat wrote:Well, you can take websockets example in
rccli code.
If you want to do it manually you can use for example "Simple Web Socket Client" extension for Firefox (or Chrome), then use as URL:
Code: Select all
ws://YOUR_TV_IP:8001/api/v2/channels/samsung.remote.control?name=cmNjbGk=
(name= at the end is name of device in base64, here "rccli")
and as request, e.g. (even if TV should already have asked your agreement at this point...)
Code: Select all
{"method":"ms.channel.emit","params":{"event": "ed.installedApp.get", "to":"host"}}
You should get some json (installed) apps list as reply

Now we talking thank you so much! Json would be the best option, is there somewhere I could get a list of the controls I could send via JSON I could then use the HTTP Protocol via LUA
Sent from my SM-N950F using Tapatalk
Re: Send Auth request to Q
Posted: Tue May 15, 2018 9:48 pm
by zoelechat
No official documentation, but much infos (more than I have) there on samsungctl github project page:
https://github.com/Ape/samsungctl
Re: Send Auth request to Q
Posted: Wed May 16, 2018 8:46 am
by MQ7Rocks
Yeah I have researched this for a week now on the web. There are many many posts but they all end in one disappointment, there are ways to get the sender (app / http) to pair but then the session token returned is encrypted. One can use the DLLs from some of the decompiled code that is on the net
BUT this will only work if it is "an actual app".
What do I mean by this, if you trying to (as in my example) embed the calls into another interface (My Home Automation System) and its system only understand LUA code - it seems like you screwed. Is my assumption correct?
One additional question, I have coded many apps in .Net, LUA etc I know its noob however thought I would ask. For the rccli there are windows version. Do I need to compile it somehow for Windows or what environment do i run it in, CMD, Python?
On this example:
ws://YOUR_TV_IP:8001/api/v2/channels/samsung.remote.control?name=cmNjbGk=
Two questions for my understanding:
- 1. WS is websockets, in the previous TV's Samsung use to use 55xxx Port correct?
2. Have they now created a new port / interface for WebSockets on 8001?
3. So I just understand correctly - the name= xxxxx element - one takes the string i.e. FOO and uses the language (in my case LUA) function to encode it in base64? Is that a correct mechanism?
4. The JSon you showed below:
{"method":"ms.channel.emit","params":{"event": "ed.installedApp.get", "to":"host"}}
this is a great way to interface. Is there any list of ms.channel.emit - params I can reference - or is it a simple forum search / google search.
5. Also so I understand the construct, does one construct the JSon "method" and then POST it to the Websocket?
Thank you for all the help so far I really do appreciate it, don't want to give up on this as its super interesting and when I get it right want to give back to the community.
Looking forward to hearing from you.
Re: Send Auth request to Q
Posted: Wed May 16, 2018 9:25 am
by zoelechat
There must be a websockets implementation in LUA, nah? That's what you have to look for, now you have all infos you need. Can't help you about it, thought Lua was a compression format
MQ7Rocks wrote: ↑Wed May 16, 2018 8:46 am
For the rccli there are windows version. Do I need to compile it somehow for Windows or what environment do i run it in, CMD, Python?
Builds are included in archive and ready to use from commandline on platform of your choice.
MQ7Rocks wrote: ↑Wed May 16, 2018 8:46 am
1. WS is websockets, in the previous TV's Samsung use to use 55xxx Port correct?
Yes, and even older TVs didn't use websockets, but you don't care.
MQ7Rocks wrote: ↑Wed May 16, 2018 8:46 am
2. Have they now created a new port / interface for WebSockets on 8001?
As shown in sample request above.
MQ7Rocks wrote: ↑Wed May 16, 2018 8:46 am
3. So I just understand correctly - the name= xxxxx element - one takes the string i.e. FOO and uses the language (in my case LUA) function to encode it in base64? Is that a correct mechanism?
Unless you want TV to popup everytime, better define device name once for all
https://www.base64encode.org/
MQ7Rocks wrote: ↑Wed May 16, 2018 8:46 am
Is there any list of ms.channel.emit - params I can reference - or is it a simple forum search / google search.
Told you: no documentation, everything known on github (all over the place).
MQ7Rocks wrote: ↑Wed May 16, 2018 8:46 am
5. Also so I understand the construct, does one construct the JSon "method" and then POST it to the Websocket?
Up to you to "construct" but a predefined sequence of chars with wildcard field(s) can be ok too for such simple requests.
Re: Send Auth request to Q
Posted: Wed May 16, 2018 12:57 pm
by MQ7Rocks
Ok thank you will give it a go, will revert back maybe it will help. Someone one day
Re: Send Auth request to Q
Posted: Wed May 16, 2018 5:30 pm
by sectroyer
MQ7Rocks wrote: ↑Wed May 16, 2018 12:57 pm
Ok thank you will give it a go, will revert back maybe it will help. Someone one day
Well forunately you ONLY need to run this piece of code in lua shit:
Code: Select all
local t = os.execute("echo 'test'")
print(t)
Rest can be safely done in bash

Maybe even one of zoe's bins will work on your device
