-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing the timeout fix #2
Comments
so yea you will need to checkout this branch then try to run this python command
|
tanks @eclair4151 |
Thanks. I'm not sure if I'm doing something wrong but I checked out that branch. Then saved the phython above as test.py and then ran it in Thonny. I got the following:
|
use this instead.
|
Hmm so I checked my tv is on and on the network and ran a scan to check the ip is correct. Then I ran the script above and get this:
|
I'm struggling a while with samsungctl. I'm pretty new with python and not a programmer for work. But I can read most of the code without problems. I want to help fixing this issue. I own a Samsung TV Q7F 2017 model. I run the 'program' samsungctl on a Raspberry pi. When i run the program i get the following output : { Looks like there is something going wrong with the Token but i'm not sure how to solve it. What am i doing wrong or could i test some code to fix this? |
Also nice to know, samsung isn't using smart view for their new tv's. They use smart things now to control the equipment they sell. I only own a TV. But i can check tonight if the smart things app sends some usefull information to the tv. I am not a star with wireshark, but i can try :) |
Hello ! |
I am working on the issue. I do not own a TV to be able to test with. I am going to set up a slack account for this repo. maybe someone would be willing to forward a few ports so I can have access to the TV. it would greatly speed up the development process not having to do the whole back and forth thing. adding would be so the IP can be sent to me. if there is anyone willing to do this for me let me know. At the same time I will also check remote button press responses and see if i can possibly leverage the TV to give me some other information/control as well. I am pretty sure I can get volume change notifications from the TV. and possibly channel change and input change. But i need to have access to the TV. after initial access I will request a few more ports be forwarded. but the ports I will not know until i connect with the TV |
I’m going to do some testing on my M series In about 40 min when I get home from work :) |
here is an invite link for the slack chat. the link is only good for a single day. |
@eclair4151 if you will be home in 40 minutes. join that slack chat. we can hash this thing out collectively. I know that the TV is capable of doing more over that web scoket we simply need to find out what exactly. I am going to write a version of the code that handles the socket connection differently. I want to keep the connection open in a manner that will allow for all messages to come in from the TV at any time, the websocket library has the ability to do this via the WebSocketApp class. |
ok so I wanted to let you all know where I am at. I still have not gotten a full test result as far as the websocket thing goes. I have however managed to extend the functionality of the package to include.
all of the below are direct input meaning
My TV is an older one. But I am sure these will all work with a newer TV a guy I know tested a few of them with success. It is going to be a very large amount of code that has to be added to support all of the above, I can do it in a dynamic nature which on the back end of it I am. But I am going to hard code most of the interface. this way it is IDE compatible and not a complete mystery how to use. But I bet you will all like to see volume the current volume or channel data in your favorite HA program eh?? Once I am done with it will be up to you to get the authors of those programs to add that functionality. I am keeping the current API in tact so the package will function as it did before. I am just extending onto it. I have sorted the issues with the discovery process which is a + |
Breaking news : In fact it seems to work properly if I run it as a sudoer ("sudo samsungctl -i --host xxx.xxx.xxx.xxx --port 8002 --method websocket --timeout 10")... Now it remains to make it work through Domoticz... to be continued. |
Good news. I'm able again to control the volume through domoticz ... It remains to adapt the keys. For now, I can't turn the tv off. I have a post 2016 ue49mu6105k model ... Do you think I need to edit the interactive.py file? |
Yesterday my router died, so had something else to do ;) But i'm online again. Can i test the lastest code? Not sure which one to clone though... |
I can confirm though that executing the samsungctl with sudo works! I tried it with the old version, but not yet with the version couple of days ago. After 1 button press it stops working though, have to CTRL+C the program and start it again for the next command. Just figured out that also without the Sudo it works now. Not sure why .... |
well it is good to know that it is in fact working to some extent. so we know the solution is viable. just have to work out some of the bugs. I have the back end for the added controls finished up. I am adding the methods at this point. I am looking for that one single things that will tell me what the firmware version is or something to that effect. it will make the selection of using ssl or not much easier. instead of a try and if it fails then do something else routine. |
Did you see my comment on slack? I think I have found a good way to detect to use ssl or not |
I did want to post my progress. I now have a plethora of output from the TV. all kinds of goodies.
so now we can get notification if anything on the TV changes. woo yah! I am able to set the channel and volume all the things I stated. |
ok here is the version I have been working on. https://github.com/kdschlosser/samsungctl/tree/upnp_features |
When I try to "git clone" the repositories, I have no UPNP directory, nor example.py file... |
Make sure you checkout the correct branch |
Thanks @kdschlosser. I've tried git clone but get an error for some reason. I can git clone the main branch fine but just not this one. not sure why? I uninstalled git and reinstalled it but still no joy. This is the error I get:
|
Yeah just tried on my laptop too, the above was on my pi. And I get the same issue. |
try |
when i run it i get
|
Still no luck I'm afraid, it can't find the branch:
|
Actually looks like I just needed to cd up to the SamsungCtl folder and then switch branch. Ran the discover.py file and get this:
|
also try this URL
|
http://TV IP:8001/api/v2/applications/ExtraService Returns: {"id":"3201512006912","name":"Extra","running":true,"version":"3.172.52","visible":false} |
is it smartview that is doing the logging or is it the TV? even if smartview is enabling you to see the logs did you have to enable the developer or debugging mode on the TV?? |
OK I am not sure what the extra thing is. but i am sure we will need it somehow. |
Here are the log events for the extraService call
|
try sending this down the websocket and see what happens
|
also can you change the TV channel from smartview?? if so do it and log it. let me see those logs Not a channel up or down. a direct input of the channel |
I believe this is going to be the key for activating the TV's voice control. I am going to add that to the library. so you folks that have a hard on for all things Alexa (or whatever else is voice controlled) you will be able to tell that thing to have the TV listen for a voice command. here is the key KEY_BT_VOICE |
if someone wants to test that to see if it is in fact for enabling the voice input that would help me a lot |
Returns: |
Here is a log for hitting most of the smartview "remote control" commands, including voice input mic:
|
YES!!!!!! that is what I wanted I made the data a little easier to read. then you will understand why I wanted to have this data |
here are the 2 that are specific for the voice. it is a press and release.
Which is cool. because the buttons show a 'Pressed' and a 'Released' which means that you can most likely use the same commands for all buttons on the remote. Another project that I develop for is superb handling of PC based remote controls / gamming controllers. pretty much any kind of an input device. and how it generates notifications one can use that pressed and released feature to mimic holding a button down. |
I am wondering what these URI's are /remoteControl/voiceStatus/standby |
also I am wondering if the query to http://TV IP:8001/api/v2/applications/ExtraService is what lets us know if the TV supports Eden apps. in the log you posted a ways back that URI gets accessed right before the calls using the websocket to ed.edenApp.get |
Not sure.. but when you hit the voice mic button it puts a menu up on the screen and waits for a voice command, so “standby”. Hit the voice button again it hides that menu. The logs seem to confirm this |
I did want to let you know that if you launch samsungctl from a script and not the command line you can keep the socket connection open to see if there is anything that is sent out the websocket when you do various things on the TV, if you use this script it will print out debugging message if any messages come in the websocket import samsungctl
import logging
import threading
logger = logging.getLogger('samsungctl')
logger.setLevel(logging.DEBUG)
config = {
"name": "samsungctl",
"description": "PC",
"id": "",
"host": "192.168.0.10",
"port": 8002,
"method": "websocket",
"timeout": 0,
}
event = threading.Event()
with samsungctl.Remote(config) as remote:
try:
event.wait()
except KeyboardInterrupt:
pass |
at any rate. It is time for me to go and watch some TV and lay down. it is 2:30 AM here. I have only had 4 hours sleep in the last 3 days. I think I am about due to sleep for a solid 8 hours |
@Murph24 {"method":"ms.channel.emit","params":{"data":{"action_type":"DEEP_LINK","appId":"11101200001","checkUpdate":false,"deepLink":"netflix","metaTag":"m=60000901&trackId=254080000&&source_type_payload=groupIndex%3D2%26tileIndex%3D6%26action%3Dmdp%26movieId%3D60000901%26trackId%3D254080000"},"event":"ed.apps.launch","to":"host"}} I've received the Data:101 response on trying to get the icondata, I suspect is means something like missing information. So far I have been unsuccessful locating any of the .cpp files involved ... so that will be the task of the day. |
@dcorsus yes I was thinking the same thing but had to quit last night. Just tried this morning and it does in fact work (need to put "checkupdate": false in quotes). Your request above successfully launched The Grinch on netlfix. Response was
|
ok folks i got my 8 hours sleep in.. feeling better. |
@kdschlosser Yes I've been wondering if any other events get fired on the socket. If I get some time later I'll run this and see. I don't think we'll see much given I don't see much in the log, but its worth a try. |
ok. so far we now have the voice control buttons.. YAY!!!! and we now have a mechanism to lst off some of the content available from the eden applications. we still do not know if the TV only responds to commends from the websocket or if it ever does any broadcasts to the websocket at all. we do know that the broadcast does exist and that it will send out through all connections we just do not know if the TV actually uses this at all. |
i have my work cut out for me. I need to create a wrapper class for the applications. and also another for the content. with properties and methods for starting the content/application . checking if it is running or not, getting the icons. I need to add methods for starting and stopping the voice recognition. turning on the mouse pointer and moving it as well as clicking the buttons. |
ok i added the voice recognition controls and the mouse controls there are separate branches for each. I still have to update the docs for the mouse. I have some errands I have to run today. I will be back in a few hours and I will work on this some more. The applications and content are going to take a few days to add. these are going to be pretty sizeable code additions. |
Edit: Nevermind...downgrading websocket-client to 0.48.0 worked. (See other thread #5) @kdschlosser I ran your script. Looks like it connects and then the websocket closes right away (or at least the message alludes to that). The program is still running although. Is this the expected behavior?
|
Ok so the websocket does get some events periodically, but not much. The only events I get from using the standard remote is from the voice control button. Nothing else (channel, volume, power off, etc.) seems to fire an event. Which brings up another potential issue...how does this library handle the tv being powered off by standard remote input? Right now the library thinks it has a connection after the tv is off. Maybe I'm missing something? The other is a periodic Eden app update, which I guess is just publishing that an updated apps\programming list is available. Some of these Eden events below may have been triggered when I started the netflix app, but I'm not sure. I'll leave the websocket open this afternoon and see if anything good comes through.
|
The problem with the websocket client should now be fixed. you will need to rerun setup.py this is force the installation of the latest version of the websocket-client. |
OK I have created 3 new branches. I am moving conversation for these branches to #9 so check there |
{"device":{"FrameTVSupport":"false","GamePadSupport":"true","ImeSyncedSupport":"true","OS":"Tizen","TokenAuthSupport":"true","VoiceSupport":"true","countryCode":"US","description":"Samsung DTV RCR","developerIP":"0.0.0.0","developerMode":"0","duid":"uuid:935b5c12-2769-4e4f-b75c-04035523e7a2","firmwareVersion":"Unknown","id":"uuid:935b5c12-2769-4e4f-b75c-04035523e7a2","ip":"192.168.0.2","model":"17_KANTM_UHD_BASIC","modelName":"UN55MU6300","name":"[TV] CMMU6300","networkType":"wireless","resolution":"3840x2160","smartHubAgreement":"true","ssid":"1c:49:7b:f6:3d:89","type":"Samsung SmartTV","udn":"uuid:935b5c12-2769-4e4f-b75c-04035523e7a2","wifiMac":"68:27:37:4D:4F:B4"},"id":"uuid:935b5c12-2769-4e4f-b75c-04035523e7a2","isSupport":"{"DMP_DRM_PLAYREADY":"false","DMP_DRM_WIDEVINE":"false","DMP_available":"true","EDEN_available":"true","FrameTVSupport":"false","ImeSyncedSupport":"true","TokenAuthSupport":"true","remote_available":"true","remote_fourDirections":"true","remote_touchPad":"true","remote_voiceControl":"true"}\n","name":"[TV] CMMU6300","remote":"1.0","type":"Samsung SmartTV","uri":"http://192.168.0.2:8001/api/v2/","version":"2.0.25"} |
Thanks for putting in a fix for the timeout @kdschlosser. I can see you’ve added the LG logging to the file. To test this with my 2017/2018 tv I’m guessing I’ll need to checkout this timeout branch and call the method. What command should I issue? When I tried using this library earlier today diectlty it was giving me errors about bytes so I’m guessing I was missing some parameters.
The text was updated successfully, but these errors were encountered: