This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Samsung / Tizen TV API v2
#12
(27.02.2023, 15:49)admin Wrote: Add comments to this check:
Code:
-- if type(resp) ~= 'table' or resp.event ~= 'ms.channel.connect' then
--   log('invalid response', data, err)
--   client:close()
--   return
-- end

I have a working script now using wss over port 8002. Only issue is that the TV keeps asking to accept the connection and it seems the token is changing all the time as i got a new one so now and then while testing.

Code:
host = '192.168.126.54'
port = 8002
name = 'MyRemote'
token = 16687249

b64 = require('encdec').base64enc
ws = require('user.websocket')
json = require('json')

url = 'wss://' .. host .. ':' .. port .. '/api/v2/channels/samsung.remote.control?name=' .. b64(name) .. '&token=' .. token


client, err = ws.client('sync', 10)
res, err = client:connect(url)


key = 'KEY_MUTE'
payload = json.encode({
  method = 'ms.remote.control',
  params = {
    Cmd = 'Click',
    DataOfCmd = key,
    Option = 'false',
    TypeOfRemote = 'SendRemoteKey'
  }
})

client:send(payload)

data, _, _, opcode, err = client:receive()
resp = json.pdecode(data)
log(resp)

client:close()
Reply


Messages In This Thread
Samsung / Tizen TV API v2 - by Joep - 24.02.2023, 13:59
RE: Samsung / Tizen TV API v2 - by admin - 24.02.2023, 14:13
RE: Samsung / Tizen TV API v2 - by Joep - 24.02.2023, 14:45
RE: Samsung / Tizen TV API v2 - by admin - 27.02.2023, 06:58
RE: Samsung / Tizen TV API v2 - by Joep - 27.02.2023, 13:23
RE: Samsung / Tizen TV API v2 - by admin - 27.02.2023, 13:40
RE: Samsung / Tizen TV API v2 - by Joep - 27.02.2023, 14:57
RE: Samsung / Tizen TV API v2 - by admin - 27.02.2023, 14:58
RE: Samsung / Tizen TV API v2 - by Joep - 27.02.2023, 15:36
RE: Samsung / Tizen TV API v2 - by admin - 27.02.2023, 15:49
RE: Samsung / Tizen TV API v2 - by Joep - 27.02.2023, 16:06
RE: Samsung / Tizen TV API v2 - by Joep - 23.02.2024, 11:16

Forum Jump: