![]() |
|
Samsung tivi remote control with json http code or TCP / UDP - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: Samsung tivi remote control with json http code or TCP / UDP (/showthread.php?tid=397) |
Samsung tivi remote control with json http code or TCP / UDP - phongvucba - 22.09.2016 people help me! I looked on google and could not find any information about this. Samsung TV can be controlled via TCP (or udp, http)? If anyone knows, please help me. I know you very well.! Thank all! RE: Samsung tivi remote control with json http code or TCP / UDP - Erwin van der Zwart - 22.09.2016 Hi, Check this sites for more information about Samsung TV control: http://sc0ty.pl/tag/samsung/ https://wiki.samygo.tv/index.php5/Samsung_TV_network_remote_control_protocol BR, Erwin RE: Samsung tivi remote control with json http code or TCP / UDP - phongvucba - 22.09.2016 Thank you very much! I have also read, but do not really understand! You can write a simple code on LM3 to select the HDMI sources? Info: https://www.samsungdforum.com/SamsungDForum/ForumView/7e2b7fa90012098b?forumID=5b7781214fc92220 Erwin ! very thank so much ! <3 RE: Samsung tivi remote control with json http code or TCP / UDP - Erwin van der Zwart - 22.09.2016 Hi, Here is a script i created a while ago for controlling Samsung. I never tested this as i have Sony TV (; Could be i'ts not working but you have a 99% solution that might need some small adjustments in the send (encoded) dataset. Check documentation i send as URL's in previous post to change it / correct it to the documented format when script does not work like expected. I have no time to do it for you .. Code: require('encdec')
tvip = "100.0.0.123"
myip = "100.0.0.112"
mymac = "00-0c-29-3e-b1-4f"
appstring = "iphone.iapp.samsung"
tvappstring = "iphone.UE55C8000.iapp.samsung"
remotename = "LUA Samsung Remote"
ipencoded = encdec.base64enc(myip)
macencoded = encdec.base64enc(mymac)
-- TCP Send Samsung TV
function sendKey(ip, skey)
host, port = tvip, 55000
socket = require("socket")
client = socket.tcp()
client:settimeout(1)
client:connect(host, port)
messagepart1 = string.char(0x64) .. string.char(0x00) .. string.char(string.len(ipencoded)) .. string.char(0x00) .. ipencoded .. string.char(string.len(macencoded)) .. string.char(0x00) .. macencoded .. string.char(string.len(encdec.base64enc(remotename))) .. string.char(0x00) .. encdec.base64enc(remotename)
part1 = string.char(0x00) .. string.char(string.len(appstring)) .. string.char(0x00) .. appstring .. string.char(string.len(messagepart1)) .. string.char(0x00) .. messagepart1
client:send(part1)
--log(lmcore.strtohex(part1))
result1 = client:receive()
messagepart2 = string.char(0xc8) .. string.char(0x00)
part2 = string.char(0x00) .. string.char(string.len(appstring)) .. string.char(0x00) .. appstring .. string.char(string.len(messagepart2)) .. string.char(0x00) .. messagepart2
client:send(part2)
--log(lmcore.strtohex(part2))
result2 = client:receive()
local messagepart3 = string.char(0x00) .. string.char(0x00) .. string.char(0x00) .. string.char(string.len(encdec.base64enc(skey))) .. string.char(0x00) .. encdec.base64enc(skey)
local part3 = string.char(0x00) .. string.char(string.len(appstring)) .. string.char(0x00) .. appstring .. string.char(string.len(messagepart3)) .. string.char(0x00) .. messagepart3
client:send(part3)
log(lmcore.strtohex(part3))
result3 = client:receive()
client:close()
return result1, result2, result3
end
--Now send the keys as you like, e.g.,
result1, result2, result3 = sendKey(tvip, "KEY_TOOLS")
log(result1, result2, result3)
os.sleep(1)
result1, result2, result3 = sendKey(tvip, "KEY_RIGHT")
log(result1, result2, result3)
os.sleep(1)
result1, result2, result3 = sendKey(tvip, "KEY_DOWN")
log(result1, result2, result3)
os.sleep(1)
result1, result2, result3 = sendKey(tvip, "KEY_RIGHT")
log(result1, result2, result3)
--[[
# Key Reference
# Normal remote keys
#KEY_0
#KEY_1
#KEY_2
#KEY_3
#KEY_4
#KEY_5
#KEY_6
#KEY_7
#KEY_8
#KEY_9
#KEY_UP
#KEY_DOWN
#KEY_LEFT
#KEY_RIGHT
#KEY_MENU
#KEY_PRECH
#KEY_GUIDE
#KEY_INFO
#KEY_RETURN
#KEY_CH_LIST
#KEY_EXIT
#KEY_ENTER
#KEY_SOURCE
#KEY_AD #KEY_PLAY
#KEY_PAUSE
#KEY_MUTE
#KEY_PICTURE_SIZE
#KEY_VOLUP
#KEY_VOLDOWN
#KEY_TOOLS
#KEY_POWEROFF
#KEY_CHUP
#KEY_CHDOWN
#KEY_CONTENTS
#KEY_W_LINK #Media P
#KEY_RSS #Internet
#KEY_MTS #Dual
#KEY_CAPTION #Subt
#KEY_REWIND
#KEY_FF
#KEY_REC
#KEY_STOP
# Bonus buttons not on the normal remote:
#KEY_TV
#Don't work/wrong codes:
#KEY_CONTENT
#KEY_INTERNET
#KEY_PC
#KEY_HDMI1
#KEY_OFF
#KEY_POWER
#KEY_STANDBY
#KEY_DUAL
#KEY_SUBT
#KEY_CHANUP
#KEY_CHAN_UP
#KEY_PROGUP
#KEY_PROG_UP
]]BR, Erwin RE: Samsung tivi remote control with json http code or TCP / UDP - phongvucba - 23.09.2016 ----------------- tvip = "192.168.1.98" --Add television myip = "192.168.1.10" --Address LM3 mymac = "00-00-54-FF-94-7F" appstring = "iphone.iapp.samsung" tvappstring = "iphone.UE55C8000.iapp.samsung" =============== Thank so much..Pro.! But Dear friends! appstring = "iphone.iapp.samsung" --What is it? tvappstring = "iphone.UE55C8000.iapp.samsung" --What is it? 2 string can change that? Love you! RE: Samsung tivi remote control with json http code or TCP / UDP - Erwin van der Zwart - 23.09.2016 Hi, appstring = "iphone.iapp.samsung" --What is it? Answer: This is just a identifier for the tv, now the tv thinks it's connected to a iPhone (: Don't change it. tvappstring = "iphone.UE55C8000.iapp.samsung" --What is it? Answer: This holds your tv model now you control a 55 inch C8000 model. If you have different model you need to change it. BR, Erwin van der Zwart RE: Samsung tivi remote control with json http code or TCP / UDP - Habib - 02.10.2016 Hi Erwin, is this script working for newer Samsung TV 2015- ? I treid it but I get only "nils" as return values. Code: Event for TV Tools-Taste (8/0/0) 02.10.2016 20:52:32
* arg: 1
* nil
* arg: 2
* nil
* arg: 3
* nil
Event for TV Tools-Taste (8/0/0) 02.10.2016 20:52:32
* string: 0013006970686F6E652E696170702E73616D73756E6711000000000C005330565A5831525054307854I think it's a authentication problem, or? |