Page 2 of 12

Re: Samsung Smart TV Plus

Posted: Sat Jun 16, 2018 12:12 am
by kgschlosser
alas a B series TV i do not believe has an IP control protocol. :( I believe it starts at the C series.


sorry about that i thought i posted this last night..

Re: Samsung Smart TV Plus

Posted: Sat Jun 16, 2018 12:24 am
by kgschlosser
OK. to delete the TV from the plugin. open %appdata%\eventghost\config.py file

Look for a section that is similar to the code below

Code: Select all

        class SamsungSmartTVPlus:
            class SN_20090804RCR:
                description = 'TestTV'
                ip = '192.168.1.63'
                model = 'UN55D8000'
                name = 'TestTV'
                region = 'North America'
                resolution = 'HD'
                serial_number = '20090804RCR'
                series = '8000'
                size = 55
                type = 'LED'
                year = 2011

where you see

Code: Select all

class SN_20090804RCR:
the SN means Serial Number. so the 20090804RCR is the Serial Number of my TV. you will see an entry just like that and it will have the serial number for your TV.

and below that is all of the meta data for your TV. You will need to have EG closed then edit the file and delete this whole section then delete EG from the TV

You are using the websocket end of the plugin and it obviously has some glitches that need to be worked out. I really do wish that i had access to one of these TV's. if someone would be willing to allow me to test using a teamviewer session or a VPN connection it would make this process a whole lot easier.

Re: Samsung Smart TV Plus

Posted: Mon Jun 18, 2018 9:01 am
by holdestmade
The version of websocket that comes with EG doesn't work for me with samsunctl, I had to use v0.44. I tried the version you shipped with this plugin (v0.47) and that works with samsunctl too, had to replace the one in sitepackages folder.

Tried deleting and removing from TV, still same

Re: Samsung Smart TV Plus

Posted: Mon Jun 18, 2018 4:37 pm
by kgschlosser
OK I am going to look at the code some more. the fact that you do get the authorization means it is working. I need to figure out why it is not sending the commands. I also need to work out what the response is for a denied authorization. In a few hours i will post a version that has alot of extra debugging information to see what is going on.

Re: Samsung Smart TV Plus

Posted: Mon Jun 18, 2018 6:42 pm
by holdestmade
OK sounds good.

I got it to print out the URL it's sending to check, it's below. It matches the samsungctl one apart from "name"

18/6/18 7:41:11 PM ws://192.168.1.215:8001/api/v2/channels/samsung.remote.control?name=U2Ftc3VuZyA0SyBUVg==

Re: Samsung Smart TV Plus

Posted: Mon Jun 18, 2018 6:46 pm
by holdestmade
If it helps, this is the discovered model:

Code: Select all

            class SN_20090804RCR:
                description = 'Office'
                ip = '192.168.1.215'
                model = 'UE40MU6120'
                name = 'Samsung 4K TV'
                region = 'Europe'
                resolution = 'HD'
                serial_number = '20090804RCR'
                series = 'U6120'
                size = 40
                type = 'LED'
                year = 2017
Resolution should be UHD.

Re: Samsung Smart TV Plus

Posted: Tue Jun 19, 2018 11:10 am
by kgschlosser
ok so here goes. I believe i found the issue with the websockets. This version is going to spit out data to the log each and every time a command is sent.

I also fixed the issue with the incorrect reporting of the resolution. :D

There could be a timing issue with how fast you are able to send off commands. The samsungctl library used a half a second wait time. which i think is a bit large. so what I have done is created a sort of lock that will hold up sending a command if one was sent and a response from the TV has not yet been received. this should maximize the speed in which commands can be issued in succession. the person that built the samsungctl library only checked for an answer when authenticating. so I do not even know if the TV responds when a command is issued. So i guess we will find out.


If you could PM me a copy of your log. in it's entirety i want to see all data being sent in and out for the commands you test with. this way if there are variations in the response due to the command that was sent I can make adjustments accordingly.

This also fixes a potential issue with the config

THIS VERSION IS NOT BACKWARDS COMPATIBLE.

Re: Samsung Smart TV Plus

Posted: Tue Jun 19, 2018 11:15 am
by kgschlosser
and that is a really odd thing both of our TV's have the same serial number????
very very strange. I am guessing that the UPNP SSDP response has a hard coded serial for some reason. and the folks over at Samsung have not stumbled across this in 6 years?!!??!

one of the reasons i stopped buying Samsung products.

I am going to have to find some other marker to use for the TV.

Re: Samsung Smart TV Plus

Posted: Tue Jun 19, 2018 4:12 pm
by holdestmade
HI,

No difference, still doesnt seem to work, I've PMd you my log. Starting from start up, installing the plugin and trying to execute some commands.

The resolution is indeed fixed:

Code: Select all

            class SN_SHCHC5ZTTO2RS:
                description = 'Office'
                device_id = 'SHCHC5ZTTO2RS'
                ip = '192.168.1.215'
                model = 'UE40MU6120'
                name = '4k TV'
                region = 'Europe'
                resolution = 'UHD'
                serial_number = '20090804RCR'
                series = 'U6120'
                size = 40
                type = 'LED'
                year = 2017

Re: Samsung Smart TV Plus

Posted: Tue Jun 19, 2018 4:23 pm
by holdestmade
Also, I needed to add

import base64

to remote_websocket.py

Re: Samsung Smart TV Plus

Posted: Tue Jun 19, 2018 7:09 pm
by holdestmade
Just tried this on my main 4K TV (2018 QLED) and it doesn't detect it.

Strange, but samsungctl controls it fine, popup appears asking me to allow samsungctl access.

Re: Samsung Smart TV Plus

Posted: Tue Jun 19, 2018 11:34 pm
by kgschlosser
ok what we need to do is we need to start from scratch here. we want to make sure there is no latent data kicking about that may cause an issue.

close eg.
open the config.py file
delete the SamsungSmartTVPlus class and all of it's contents
delete the plugin folder
start EG
double click the egplugin file to install the plugin.
add the plugin to your tree.

I did not update the version number in this one. i basically copied the samsungctl into this one. so if it was working there it should be working here as well.

there is going to be some data that gets printed out. same as before i need to see that data.

Re: Samsung Smart TV Plus

Posted: Wed Jun 20, 2018 1:31 pm
by holdestmade
HI

Did all that, got an error about URL not defined in remote_websocket.py, changed URL_FORMAT in line 24 to URL and that got past that one. Then another exception:

20/6/18 2:29:51 PM Exception in thread SamsungTVScan:
20/6/18 2:29:51 PM Traceback (most recent call last):
20/6/18 2:29:51 PM File "threading.pyc", line 801, in __bootstrap_inner
20/6/18 2:29:51 PM File "threading.pyc", line 754, in run
20/6/18 2:29:51 PM File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\__init__.py", line 200, in _scan_loop
20/6/18 2:29:51 PM tv.open()
20/6/18 2:29:51 PM File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote.py", line 85, in open
20/6/18 2:29:51 PM self.__sock.open()
20/6/18 2:29:51 PM File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 55, in open
20/6/18 2:29:51 PM self._read_response()
20/6/18 2:29:51 PM File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 58, in _read_response
20/6/18 2:29:51 PM response = self.connection.recv()
20/6/18 2:29:51 PM AttributeError: 'Remote' object has no attribute 'connection'
20/6/18 2:29:51 PM

Re: Samsung Smart TV Plus

Posted: Wed Jun 20, 2018 3:52 pm
by kgschlosser
i swear i am brain dead sometimes.

give it a shot

Re: Samsung Smart TV Plus

Posted: Wed Jun 20, 2018 8:02 pm
by holdestmade
Yep that works great !

Pop up on TV asking for permission

Only problem is it won't add a TV.

I had to copy the class from an old config.py for my TV and it worked straight away !

This is the log from a MUTE command:

20/6/18 9:00:34 PM {u'data': {u'clients': [{u'isHost': False, u'attributes': {u'name': u'NGsgVFY='}, u'id': u'4738d4a5-93ef-488c-9f80-99c54757692', u'connectTime': 1529524829677L, u'deviceName': u'NGsgVFY='}], u'id': u'4738d4a5-93ef-488c-9f80-99c54757692'}, u'event': u'ms.channel.connect'}