Send Auth request to Q

General forum talking area for M/Q series TVs.

MQ7Rocks
Posts: 27
Joined: Mon Apr 30, 2018 5:15 pm

Send Auth request to Q

Post by MQ7Rocks » Tue May 15, 2018 3:41 pm

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


zoelechat
Official SamyGO Developer
Posts: 8193
Joined: Fri Apr 12, 2013 7:32 pm
Location: France

Re: Send Auth request to Q

Post by zoelechat » Tue May 15, 2018 8:57 pm

There's no special code, TV will ask user agreement as soon as it receives something acceptable.
I do NOT receive any PM. Please use forum.

MQ7Rocks
Posts: 27
Joined: Mon Apr 30, 2018 5:15 pm

Re: RE: Re: Send Auth request to Q

Post by MQ7Rocks » Tue May 15, 2018 9:07 pm

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


zoelechat
Official SamyGO Developer
Posts: 8193
Joined: Fri Apr 12, 2013 7:32 pm
Location: France

Re: Send Auth request to Q

Post by zoelechat » Tue May 15, 2018 9:25 pm

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 :)
I do NOT receive any PM. Please use forum.

MQ7Rocks
Posts: 27
Joined: Mon Apr 30, 2018 5:15 pm

Re: RE: Re: Send Auth request to Q

Post by MQ7Rocks » Tue May 15, 2018 9:40 pm

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


zoelechat
Official SamyGO Developer
Posts: 8193
Joined: Fri Apr 12, 2013 7:32 pm
Location: France

Re: Send Auth request to Q

Post by zoelechat » Tue May 15, 2018 9:48 pm

No official documentation, but much infos (more than I have) there on samsungctl github project page: https://github.com/Ape/samsungctl
I do NOT receive any PM. Please use forum.

MQ7Rocks
Posts: 27
Joined: Mon Apr 30, 2018 5:15 pm

Re: Send Auth request to Q

Post by MQ7Rocks » Wed May 16, 2018 8:46 am

zoelechat wrote:
Tue May 15, 2018 9:48 pm
No official documentation, but much infos (more than I have) there on samsungctl github project page: https://github.com/Ape/samsungctl
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.

zoelechat
Official SamyGO Developer
Posts: 8193
Joined: Fri Apr 12, 2013 7:32 pm
Location: France

Re: Send Auth request to Q

Post by zoelechat » Wed May 16, 2018 9:25 am

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 :mrgreen:
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.
I do NOT receive any PM. Please use forum.

MQ7Rocks
Posts: 27
Joined: Mon Apr 30, 2018 5:15 pm

Re: Send Auth request to Q

Post by MQ7Rocks » 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

sectroyer
Official SamyGO Developer
Posts: 5712
Joined: Wed May 04, 2011 5:10 pm

Re: Send Auth request to Q

Post by sectroyer » Wed May 16, 2018 5:30 pm

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 :)
I do NOT support "latest fw" at ALL. If you have one you should block updates on router and wait for it to STOP being "latest":)
If you want me to help you please paste FULL log(s) to "spoiler"/"code" bbcodes or provide link(s) to pasted file(s) on http://ctrlv.it/ Otherwise "NO HELP"!!!
If you want root DISABLE internet access to your device!!!!
DO NOT EVER INSTALL FIRMWARE UPGRADE !!!!

Post Reply

Return to “[M/Q] General”