mckael / samtv Goto Github PK
View Code? Open in Web Editor NEWsamtvcli -- Network CLI remote for Samsung TVs (models 2014-2015)
Home Page: https://lilotux.net/~mikael/pub/samtv/
License: MIT License
samtvcli -- Network CLI remote for Samsung TVs (models 2014-2015)
Home Page: https://lilotux.net/~mikael/pub/samtv/
License: MIT License
TV is a K series (UE49K5500AKXXU).
samtvcli version is v1.0.1.
Debug reads as follows:
INFO[0000] Using config file: /home/cgar/.config/samtvcli/samtvcli.yaml
DEBU[0000] Fetch URL: http://192.168.1.101:8000/socket.io/1/?t=1573533303580
DEBU[0000] Reading WS message...
DEBU[0000] Read message (type 1): `1::`
DEBU[0000] Got greetings from TV
DEBU[0000] Sending SmartView handshake...
DEBU[0000] Sending WS message: `1::/com.samsung.companion` ...
DEBU[0000] Reading WS message...
DEBU[0000] Read message (type 1): `1::/com.samsung.companion`
DEBU[0000] SmartView handshake completed
DEBU[0000] Reading WS message...
DEBU[0000] sendMessage('KEY_MUTE')
DEBU[0000] Sending WS message: `5::/com.samsung.companion:{"name":"callCommon","args":[{"Session_Id":1,"body":"[51, 227, 27, 153, 230, 186, 142, 253, 138, 35, 155, 147, 91, 112, 35, 205, 40, 164, 155, 63, 52, 39, 247, 108, 194, 145, 45, 190, 244, 206, 75, 234, 37, 81, 126, 23, 88, 63, 115, 156, 22, 245, 192, 215, 38, 105, 85, 160, 25, 10, 218, 165, 181, 174, 165, 84, 58, 135, 76, 235, 240, 20, 13, 83, 52, 3, 153, 202, 146, 167, 127, 21, 25, 163, 56, 182, 243, 5, 74, 104, 187, 250, 19, 36, 139, 227, 225, 171, 112, 222, 48, 236, 114, 116, 83, 198, 3, 185, 2, 16, 76, 209, 18, 241, 154, 188, 95, 159, 152, 97, 221, 189, 162, 64, 202, 28, 41, 143, 76, 82, 192, 210, 34, 7, 165, 169, 88, 83, 161, 139, 171, 20, 2, 157, 120, 127, 62, 40, 252, 155, 212, 41, 82, 224, 63, 191, 10, 124, 9, 6, 108, 34, 165, 11, 224, 18, 72, 73, 118, 51, 250, 112, 197, 218, 212, 175, 24, 121, 211, 31, 31, 213, 15, 135, 152, 121]"}]}` ...
DEBU[0000] Read message (type 1): `5::/com.samsung.companion:{"name":"receiveCommon","args":"{\"type\":\"Buffer\",\"data\":[161,68,134,81,213,12,158,20,48,53,211,65,200,103,198,84,32,52,60,225,226,101,21,17,251,200,223,155,116,167,231,208,103,241,105,190,132,91,253,169,237,95,30,37,84,44,109,159,204,71,240,95,81,7,250,162,20,136,74,252,213,67,60,114]}"}`
DEBU[0000] SmartView message received
ERRO[0000] Could not parse message: cannot parse encrypted response: json: cannot unmarshal object into Go value of type []uint8
DEBU[0000] Reading WS message...
ERRO[0005] Cannot send key 'KEY_MUTE': no reply from TV
samtvcli pair --pin 0077
Error: invalid argument "0077" for "--pin" flag: strconv.ParseInt: parsing "0077": invalid syntax
Hi there,
When trying to download samtvcli via go I get following errors, which prevents me from building samtvcli:
go get -u github.com/McKael/samtv/samtvcli
package github.com/McKael/samtv/samtvcli
imports github.com/McKael/samtv
imports github.com/McKael/smartcrypto
imports github.com/pkg/errors
imports github.com/gorilla/websocket
imports context: unrecognized import path "context"
package github.com/McKael/samtv/samtvcli
imports github.com/McKael/samtv
imports github.com/McKael/smartcrypto
imports github.com/pkg/errors
imports github.com/gorilla/websocket
imports net/http/httptrace: unrecognized import path "net/http/httptrace"
uname -a
Linux rasp_zerow 4.4.50+ #970 Mon Feb 20 19:12:50 GMT 2017 armv6l GNU/Linux
go version
go version go1.3.3 linux/arm
This tool, samtvcli, is the only tool communicating with my TV, so I'm grateful already. But, it would be even better is it was possible to set a volume level. Of course KEY_VOLDOWN and KEY_VOLUP are there, but you need feedback to be able to adjust the volume to a certain level. The samsungctl tool has an command line option --volume for this. Unfortunately samsungctl doesn't work for me at all.
Would it be possible to add this option to samtvcli?
Hi!
I just wanted to leave a short thank you note for creating and open-sourcing samtvcli. I've spend the last year or so sporadically looking for a way to easily automate some basic actions on my UE48H6200AW Samsung TV. This is the first tool I've encountered that doesn't require me to write code myself to get the job done (which wasn't something I wanted to spend time on).
Having done some open-source work myself in the past, I know how much time and effort it costs to create and maintain small projects like these. Please know that you've made a random internet stranger's day!
Thank you!!
First of all, thank you for your library which helped me, my TV model is UA78KU6900JXXZ, after successful pairing I tried to send the keys but it reported an error, what is the reason for this?
Is it because of the failure of decryption?
(venv) samtv/samtvcli master ± ./samtvcli --debug --config /Users/simonwang/.config/samtvcli.yaml key send KEY_MENU
INFO[0000] Using config file: /Users/simonwang/.config/samtvcli.yaml
DEBU[0000] Fetch URL: http://192.168.35.116:8000/socket.io/1/?t=1687853451622
DEBU[0000] Reading WS message...
DEBU[0000] Read message (type 1): 1::
DEBU[0000] Got greetings from TV
DEBU[0000] Sending SmartView handshake...
DEBU[0000] Sending WS message: 1::/com.samsung.companion
...
DEBU[0000] Reading WS message...
DEBU[0000] Read message (type 1): 1::/com.samsung.companion
DEBU[0000] SmartView handshake completed
DEBU[0000] Reading WS message...
DEBU[0000] sendMessage('send')
DEBU[0000] Sending WS message: 5::/com.samsung.companion:{"name":"callCommon","args":[{"Session_Id":2,"body":"[135, 131, 149, 59, 124, 48, 134, 236, 18, 166, 239, 191, 38, 142, 236, 164, 116, 157, 146, 108, 185, 146, 120, 217, 190, 50, 25, 117, 201, 55, 215, 68, 139, 223, 35, 96, 65, 126, 134, 96, 194, 42, 192, 101, 230, 120, 176, 244, 38, 246, 73, 239, 116, 31, 87, 92, 179, 116, 106, 97, 209, 235, 164, 55, 208, 142, 184, 167, 80, 96, 83, 215, 16, 193, 114, 122, 50, 30, 54, 84, 146, 73, 24, 115, 107, 5, 116, 145, 97, 124, 152, 48, 216, 113, 241, 66, 160, 61, 94, 153, 145, 23, 20, 249, 72, 71, 65, 135, 158, 165, 186, 121, 6, 49, 237, 223, 174, 235, 10, 207, 251, 71, 188, 100, 237, 20, 164, 21, 163, 145, 129, 52, 172, 152, 173, 195, 32, 34, 186, 240, 101, 198, 95, 48, 241, 101, 119, 154, 168, 12, 13, 114, 209, 126, 185, 125, 30, 8, 77, 50, 209, 20, 198, 149, 141, 74, 241, 207, 39, 20, 180, 110, 53, 11, 73, 61]"}]}
...
DEBU[0000] Read message (type 1): 5::/com.samsung.companion:{"name":"receiveCommon","args":"{\"type\":\"Buffer\",\"data\":[138,236,222,172,138,17,113,65,75,30,153,51,130,19,35,241,175,31,16,185,28,105,209,7,96,36,49,144,63,29,186,167,18,149,190,209,125,182,159,1,49,53,79,171,153,239,248,77,38,185,38,14,169,7,17,251,210,154,81,6,123,224,39,54]}"}
DEBU[0000] SmartView message received
ERRO[0000] Could not parse message: cannot parse encrypted response: json: cannot unmarshal object into Go value of type []uint8
DEBU[0000] Reading WS message...
ERRO[0005] Cannot send key 'send': no reply from TV
I've tried the tool with the UE32J5200AWXXN model, but am unable to pair:
$ ./samtvcli --config .samtvcli.yaml --debug pair
INFO[0000] Using config file: .samtvcli.yaml
DEBU[0000] Initiating step #0
DEBU[0000] PIN page is stopped
INFO[0000] Requesting PIN page popup...
DEBU[0000] PIN page response: `http://192.168.1.122:8080/ws/apps/CloudPINPage/run`
DEBU[0000] Fetch URL: http://192.168.1.122:8080/ws/pairing?step=0&app_id=samtvcli&device_id=samtv&type=1
DEBU[0000] Pairing request response: `{"auth_data":""}
`
Would you be able to help me with this?
Hello,
Successfully working on my samtvcli UE55JU6900. Most of the keys command work but the only one that i'm unable to send is the power key ( by sending POWER key like KEY_POWEROFF or KEY_POWEROFF2 or KEY_POWER ).
The TV does nothing.
This is the debug log of KEY_POWEROFF command :
INFO[0000] Using config file: /home/me/.config/samtvcli/samtvcli.yaml DEBU[0000] Fetch URL: http://tvip:8000/socket.io/1/?t=1545597519531 DEBU[0000] Reading WS message... DEBU[0000] Read message (type 1):
1:: DEBU[0000] Got greetings from TV DEBU[0000] Sending SmartView handshake... DEBU[0000] Sending WS message:
1::/com.samsung.companion... DEBU[0000] Reading WS message... DEBU[0000] Read message (type 1):
1::/com.samsung.companion DEBU[0000] SmartView handshake completed DEBU[0000] Reading WS message... DEBU[0000] sendMessage('KEY_POWEROFF') DEBU[0000] Sending WS message:
5::/com.samsung.companion:{"name":"callCommon","args":[{"Session_Id":1,"body":"[28, 252, 219, 239, 245, 241, 57, 50, 160, 29, 68, 84, 218, 132, 176, 134, 187, 58, 225, 199, 214, 222, 235, 56, 216, 108, 143, 245, 4, 228, 118, 71, 200, 179, 195, 111, 18, 10, 183, 7, 94, 134, 85, 5, 165, 132, 188, 15, 130, 162, 154, 120, 78, 206, 64, 59, 70, 242, 41, 12, 220, 11, 154, 0, 71, 154, 205, 47, 137, 34, 62, 139, 95, 80, 182, 253, 121, 213, 208, 136, 170, 185, 45, 207, 22, 113, 18, 221, 127, 134, 67, 132, 112, 168, 56, 253, 236, 253, 17, 221, 110, 205, 149, 15, 155, 92, 231, 45, 143, 241, 102, 143, 42, 28, 95, 253, 252, 120, 179, 144, 104, 179, 73, 20, 45, 72, 138, 32, 130, 3, 241, 135, 3, 191, 182, 20, 179, 92, 195, 204, 255, 250, 214, 109, 210, 241, 55, 165, 154, 69, 207, 39, 108, 198, 167, 173, 202, 103, 226, 75, 170, 72, 7, 94, 207, 236, 19, 106, 164, 52, 103, 204, 169, 172, 5, 140]"}]}... DEBU[0001] Read message (type 1):
5::/com.samsung.companion:{"name":"receiveCommon","args":"[222,188,199,108,97,96,91,176,23,173,149,216,225,156,86,55,48,90,240,13,255,82,50,231,208,253,167,115,215,183,37,26,133,112,55,74,47,144,224,111,65,192,149,43,112,202,38,92,49,211,86,53,54,200,110,252,134,152,54,147,218,123,231,252]"} DEBU[0001] SmartView message received DEBU[0001] data: 22726573756c74223a7b7d7d04040404 DEBU[0001] padlen: 04 DEBU[0001] plain text: []byte{0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x7b, 0x7d, 0x7d} DEBU[0001] Successfully decrypted response: [34 114 101 115 117 108 116 34 58 123 125 125] DEBU[0001] SmartView message: "result":{}} DEBU[0001] Reading WS message... DEBU[0001] TV message:
"result":{}}`
DEBU[0001] Closing websocket
`
Is there a way to set the logrus log level per Environment variable?
Or do i need to recompile it with a hard coded log level?
Hello,
I want to use your app on my raspberry, to connect with my domotic app.
When I compile source code, I receive an error :
$ go build
github.com/McKael/samtv/cmd
../../src/github.com/McKael/samtv/cmd/tui_keybindings.go:95: undefined: strings.Builder
My version of go :
$ go version
go version go1.7.4 linux/arm
Have you a solution to compile with this version ?
(I know go since yesterday ^^)
Thx
Hi thanks for the efforts putting this together.
On the first pair, i save the key to the config file and keys work successfully. On power off and immediate power on, the same key still works.
However after a couple of days, it no longer works resulting in the below error messages
Using config file: /data/samtvcli/samtvcli.yaml"
time="2020-07-14T21:31:09Z" level=error msg="Could not parse message: cannot decrypt response: invalid padding"
time="2020-07-14T21:31:13Z" level=error msg="Cannot send key 'send': no reply from TV"
Then it works again when i repair it.
Is this the expected experience?
I see that to send the remote key below is used:
{"method":"POST","body":{"plugin":"RemoteControl","param1":"uuid:
+
s.uuid + ","param2":"Click","param3":"
+ keyPressed +
","param4":false,"api":"SendRemoteKey","version":"1.000"}}
Similarly, I want to know how to how send mouse movement update
Below is example for latest TVs by I needed similar api for 2014 and 2015 tvs {"method":"ms.remote.control","params":{"Cmd":"Move","Position":{"x":0,"y":0,"Time":"
+ ts() + `"},"TypeOfRemote":"ProcessMouseDevice"}}
Where can we find the RemoteControl plugin apis syntax details?
Hey,
i wanted to start porting this to js/node.
My first step for this was, to pair with your script and use the values in the config *.yml to establish a websocket connection and control the tv. Then i wanted to do the crypto stuff.
The problem is, i cant see where you load the config file and what you are do then with session_key
& session_id
then.
How/where do you build/establish a ws connection with the values from config?
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.