I'm interested in controlling my tv and I also don't have a ST hub. What is the mac and Pi doing and what software do you have on those. That said, I don't have a mac only windows, linux and pi's.
Also, what did you install on the Hubitat?
Can you be a bit more specific, as I'd like to try this if I can!!!!
So far on the Hubitat I have the HubConnect Server for Hubitat and the HubConnect Remote Client. I also installed the Remote Server (if memory serves, I don't have the Pi booted up right now) on a secondary instance of Hubitat on the Pi. I added the TV as a Hubitat virtual device (HubConnect AVR) but that's where I'm stuck. I can't get the TV to respond. I don't know if I need to add something to the Device ID, or what. I'm not sure that it matters having Mac vs Windows since we're adding apps, etc in the cloud. The caution I'll share is that if you go to GitHub or some other location to pick up the app code and device code, when you copy and paste it into Hubitat, it will paste in with a space and you'll get an error or won't be able to save it. Scan through it til you find the space, back space it out and you should be fine.
Let me know if you have success. I tried one other thing this afternoon and I'll let you know if it works.
I have just tried to search for "Remote Server Raspberry pi Hubitat" and can't find anything.
Do you have links that will point me in the right direction for all the installs?
You'll want the Installation Instructions. When you click on them you can view them but you can't copy the code for the files. Download it and then you should be able to copy and paste the code. The info I can see says that while 2.0 is available, 1.6 is the stable release and 2.0 should only be used by developers with experience. Which I am NOT, so I went with 1.6.
Since my TV is pre-2016, I get the following expected results:
Connect is successful
The command returns an illegal method with the sent method "ms.remote.control"
But, I think the code will work with 2016 and later TVs. Any testers??
Below is the code and the explicit test keys for testing. You will have to enter the IP in preferences. If it works, I can point you to GitHub key codes (a lot of them in one list) to choose to control the device.
Cal, thanks for the assist. The message indicates that the code is working (it returns an error event from the method. This may be due to the TV mode (i.e., you use volume while using the soundbar).
Which key code did you try this with? It looks like code that translated to code 1005 which is reserved. Did you try others? Particularly KEY_TOOLS, KEY_SOURCE, or KEY_SOURCE that work regardless of external source or sound sink.
Results w a 2014(?) Samsung TV dev:21312020-10-11 09:15:06.748 am debugwebSocketStatus: status: closing
dev:21312020-10-11 09:15:01.695 am infoparse: {"event":"ms.error","data":{"message":"unrecognized method value : ms.remote.control"}}
dev:21312020-10-11 09:15:01.360 am infoparse: {"event":"ms.channel.connect","data":{"id":"bf7cd270-2327-11b2-9f26-31ddfd4a529d","clients":[{"id":"bf7cd270-2327-11b2-9f26-31ddfd4a529d","connectTime":586551576,"attributes":{},"isHost":false}]}}
dev:21312020-10-11 09:15:01.345 am debugwebSocketStatus: status: open
dev:21312020-10-11 09:15:01.048 am tracesendCmd: {"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_MUTE","Option":"false","TypeOfRemote":"SendRemoteKey"}}, 192.168.1.153
dev:21312020-10-11 09:15:01.044 am tracetest: KEY_MUTE
I was doing some reading on some other forums, and it seems like you can connect over websocket, but first you have to obtain the Name of the TV convert to Base64, connect and obtain the token for future connection. This is far as I could get.
"Token":"12345678" <-8 Character Token will be displayed in the output
Now, you can connect to the TV securely using the Token by going to: wscat -n -c https://TVIPADDRESS:8002/api/v2/channels/samsung.remote.control?token=<8 digit token> and issue commands. By using the token in the URL, the TV will no longer prompt you to accept the remote device connection each time you send a command.
All of the remote control commands can be now sent, and they all work on the TV if they are in the format below
Several things.
Control you is how I control my Samsung Wifi Speakers. Quite simple, so can do. Your Step 3: We will have to capture name and uri. Yours uses 8002 as the final port, mine 8001. Step 6: Base 64: name.encodeAsBase64().toString()
Step 9: Just a parameter to catch
Step 10: Easy
So, yes. What you want should be able to be done. Let me update my test driver some to capture the various data.
Cal,
I created a test driver (no polish, not final version). Tested all but getting token and sending key (but coded those functions.
Step 1: GetData (gets the name of the TV
Step 2: Get token
Step 3: Send Key with key name entry.
I am very interested in what the output for a Send Key is. That should be an event and I want to know if it reports volume for KEY_VOLDOWN.
If this works, I will code further with agreed keys; including the Samsung recommended minimum keys.
Updated code at same site to fix one error found this am. Also, now working on port 8002 only. Added commands for key (no longer need to enter) and updated logging.
Close device
Replace code
Open device
Get Data
Get Token
Menu
At some point, you may need to allow the device on your TV. I have seen this on my UPnP efforts where I can control volume, mute, source, play, pause and etc. I actually plan to include these on the final update (particularly calling the explicit source and volume).
This is great with the latest code now under preferences showing the TV Name, Base64 Name and placeholder for Token.
I did another test today while the TV had gone into deep sleep overnight. TV does not accept connections while it's been off for a while.
However, installed Boot Me Up Scottie Wake on LAN app with a virtual switch. TV wakes right away and then you can start sending commands to it. TV is connected to WiFi and not a wired connection.
Also here are the logs using the latest code and then pressing the keys: