Samsung Smart TV Plus
- kgschlosser
- Site Admin
- Posts: 4428
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Samsung Smart TV Plus
Samsung Smart TV IP Control +
v0.1.1b
REQUIRES EventGhost 0.5 RC4 or Newer
Ok it has been asked for. And i have done some serious brain crunching to get this going. But I am pretty confident that it will support ALL Samsung TV's that have the capability of being controlled over IP (I think any TV that you can attach or already has built in wifi or network)
This includes 2016 and Newer models as well.
Features
Almost fully automated. There is no need to enter an IP address. You can now set your TV to DHCP and this bad larry will still work.
It automatically handles how to communicate with the TV. No need to tell the plugin what TV you have. It knows.
You get Power On and Power Off events
Supports an unlimited number of TV's mixing new with old does not matter.
Has the most extensive set of key codes of any control made to date! this is a work in progress to map out the key codes to what they do. you can help out and tell me what key code does what. or if i have one of them mapped out wrong.
OK so here is the skinny on how this functions. when you turn the TV on (or start eg with the TV already on) you will be prompted if you want to add the TV to EG. if you do be sure you have the network remote control turned on in the TV settings menu. If you select No at this dialog you will not be asked again until you restart EG. If you select Yes another dialog will open asking for a description and a name this is a means of identifying the TV so if you have more then a single TV make them unique. Upon clicking the OK button it will add the TV. you will not be prompted to add the TV again. if for some reason you need to remove the TV. You will need to go into the TV menu under the network remote control section and select denied for the EG connection. then with the TV on start EG. this will remove the TV from the plugin.
It is about as automatic as I can get it. There are 246 actions one for each key code. Not all of the key codes are going to work. It is best to try each and every single one to see what the TV supports and what the actual key code does. Please let me know what is not right.
I do not have a 2016 or newer Samsung TV So have not been able to test that portion of it. If someone does and is willing to endure testing a bug fixing that portion of it that would be awesome.
I know on the older Samsung TV's you cannot turn the TV on via the IP control. It can only be done with either the remote or serial. So you will need to get an IR blaster and use the Vista MCE Remote plugin to blast the code to the TV to turn it on. I do not know if you can turn the TV over network control with the newer ones. or if maybe a wake on lan packet would work. These are things that can be tested.
***Update*** added v0.1.1b - Fixes threading import
v0.1.1b
REQUIRES EventGhost 0.5 RC4 or Newer
Ok it has been asked for. And i have done some serious brain crunching to get this going. But I am pretty confident that it will support ALL Samsung TV's that have the capability of being controlled over IP (I think any TV that you can attach or already has built in wifi or network)
This includes 2016 and Newer models as well.
Features
Almost fully automated. There is no need to enter an IP address. You can now set your TV to DHCP and this bad larry will still work.
It automatically handles how to communicate with the TV. No need to tell the plugin what TV you have. It knows.
You get Power On and Power Off events
Supports an unlimited number of TV's mixing new with old does not matter.
Has the most extensive set of key codes of any control made to date! this is a work in progress to map out the key codes to what they do. you can help out and tell me what key code does what. or if i have one of them mapped out wrong.
OK so here is the skinny on how this functions. when you turn the TV on (or start eg with the TV already on) you will be prompted if you want to add the TV to EG. if you do be sure you have the network remote control turned on in the TV settings menu. If you select No at this dialog you will not be asked again until you restart EG. If you select Yes another dialog will open asking for a description and a name this is a means of identifying the TV so if you have more then a single TV make them unique. Upon clicking the OK button it will add the TV. you will not be prompted to add the TV again. if for some reason you need to remove the TV. You will need to go into the TV menu under the network remote control section and select denied for the EG connection. then with the TV on start EG. this will remove the TV from the plugin.
It is about as automatic as I can get it. There are 246 actions one for each key code. Not all of the key codes are going to work. It is best to try each and every single one to see what the TV supports and what the actual key code does. Please let me know what is not right.
I do not have a 2016 or newer Samsung TV So have not been able to test that portion of it. If someone does and is willing to endure testing a bug fixing that portion of it that would be awesome.
I know on the older Samsung TV's you cannot turn the TV on via the IP control. It can only be done with either the remote or serial. So you will need to get an IR blaster and use the Vista MCE Remote plugin to blast the code to the TV to turn it on. I do not know if you can turn the TV over network control with the newer ones. or if maybe a wake on lan packet would work. These are things that can be tested.
***Update*** added v0.1.1b - Fixes threading import
- Attachments
-
- SamsungSmartTVPlus-0.1.1b.egplugin
- (203.14 KiB) Downloaded 55 times
-
- SamsungSmartTVPlus-0.1.0b.egplugin
- (203.16 KiB) Downloaded 25 times
-
- Experienced User
- Posts: 177
- Joined: Thu Dec 04, 2014 2:44 pm
Re: Samsung Smart TV Plus
Hi K,
Gave this a try in a blank file and it does discover my 2018 LED TV correctly but once added, I get this is the log :
19:04:32 ---> Welcome to EventGhost <---
19:04:33 Autostart
19:04:33 System.Monitor.On
19:04:33 Main.OnInit
19:04:33 System.PowerSource.Line
19:04:33 System.PowerSaving.Off
19:04:33 System.PowerProfile.HighPerformance
19:04:38 Setting Up Config
19:04:38 Done Setting Up Config
19:04:38 Plugin: Samsung Smart TV IP Control +
19:04:38 Reading Config
19:04:47 Traceback (most recent call last) (0.5.0-rc4):
19:04:47 File "wx\_core.pyc", line 16766, in <lambda>
19:04:47 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\__init__.py", line 255, in do
19:04:47 self.tvs[tv['serial_number']] = remote.Remote(self, **tv)
19:04:47 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote.py", line 71, in __init__
19:04:47 self.__sock = remote_websocket.Remote(self, plugin)
19:04:47 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 42, in __init__
19:04:47 self._send_event = threading.Event()
19:04:47 NameError: global name 'threading' is not defined
Gave this a try in a blank file and it does discover my 2018 LED TV correctly but once added, I get this is the log :
19:04:32 ---> Welcome to EventGhost <---
19:04:33 Autostart
19:04:33 System.Monitor.On
19:04:33 Main.OnInit
19:04:33 System.PowerSource.Line
19:04:33 System.PowerSaving.Off
19:04:33 System.PowerProfile.HighPerformance
19:04:38 Setting Up Config
19:04:38 Done Setting Up Config
19:04:38 Plugin: Samsung Smart TV IP Control +
19:04:38 Reading Config
19:04:47 Traceback (most recent call last) (0.5.0-rc4):
19:04:47 File "wx\_core.pyc", line 16766, in <lambda>
19:04:47 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\__init__.py", line 255, in do
19:04:47 self.tvs[tv['serial_number']] = remote.Remote(self, **tv)
19:04:47 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote.py", line 71, in __init__
19:04:47 self.__sock = remote_websocket.Remote(self, plugin)
19:04:47 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 42, in __init__
19:04:47 self._send_event = threading.Event()
19:04:47 NameError: global name 'threading' is not defined
- kgschlosser
- Site Admin
- Posts: 4428
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Samsung Smart TV Plus
Heh I forgot to add the import for threading. You can go into the remote_websocket.py file and after the line that states
from .websocket import WebsocketApp
Add the line.
Import threading.
That will fix that issue. There are going to be more issues I am sure because I have no way of testing the thing.
from .websocket import WebsocketApp
Add the line.
Import threading.
That will fix that issue. There are going to be more issues I am sure because I have no way of testing the thing.
- kgschlosser
- Site Admin
- Posts: 4428
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Samsung Smart TV Plus
It's a good thing the discovery works too. I was not sure if the newer TVs would respond to a upnp ssdp request. And if the data contained in the link provided in the response from the TV would be the same as the older TVs it was a crap shoot but it's nice that it works. The rest of it should be easier to get running
- kgschlosser
- Site Admin
- Posts: 4428
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Samsung Smart TV Plus
updated the plugin to fix the threading issue.
Re: Samsung Smart TV Plus
Hi,
thanks for this plugin, unfortunately my TV is not detected
it has an embedded network card, maybe the TV is too old ? it's from 2009...
here's the model # : UE40B7000WWXXC
is there a way to add it manually ?
thanks for this plugin, unfortunately my TV is not detected

here's the model # : UE40B7000WWXXC
is there a way to add it manually ?
-
- Experienced User
- Posts: 177
- Joined: Thu Dec 04, 2014 2:44 pm
Re: Samsung Smart TV Plus
Hi,
That seemed to correct that error but on adding a command and testing it get this:
Also, where is the config stored so I can delete it and get it to re-discover ?
Thanks
11:41:38 ---> Welcome to EventGhost <---
11:41:45 Setting Up Config
11:41:45 Done Setting Up Config
11:41:45 Plugin: Samsung Smart TV IP Control +
11:41:45 Reading Config
11:41:58 Samsung Smart TV IP Control +: HDMI 1: KEY_HDMI1
11:41:58 Error in Action: "Samsung Smart TV IP Control +: HDMI 1: KEY_HDMI1"
11:41:58 Traceback (most recent call last) (0.5.0-rc4):
11:41:58 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
11:41:58 return self(*args)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\__init__.py", line 349, in __call__
11:41:58 return self.plugin.DoCommand(cmd, serial_number)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\__init__.py", line 328, in DoCommand
11:41:58 return self.tvs[serial_number].send(cmd)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote.py", line 88, in send
11:41:58 return self.__sock.send(key)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 79, in send
11:41:58 self.open()
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 55, in open
11:41:58 _serialize_string(self.remote.name)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 31, in _serialize_string
11:41:58 return base64.b64encode(data).decode("utf-8")
11:41:58 NameError: global name 'base64' is not defined
That seemed to correct that error but on adding a command and testing it get this:
Also, where is the config stored so I can delete it and get it to re-discover ?
Thanks
11:41:38 ---> Welcome to EventGhost <---
11:41:45 Setting Up Config
11:41:45 Done Setting Up Config
11:41:45 Plugin: Samsung Smart TV IP Control +
11:41:45 Reading Config
11:41:58 Samsung Smart TV IP Control +: HDMI 1: KEY_HDMI1
11:41:58 Error in Action: "Samsung Smart TV IP Control +: HDMI 1: KEY_HDMI1"
11:41:58 Traceback (most recent call last) (0.5.0-rc4):
11:41:58 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
11:41:58 return self(*args)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\__init__.py", line 349, in __call__
11:41:58 return self.plugin.DoCommand(cmd, serial_number)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\__init__.py", line 328, in DoCommand
11:41:58 return self.tvs[serial_number].send(cmd)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote.py", line 88, in send
11:41:58 return self.__sock.send(key)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 79, in send
11:41:58 self.open()
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 55, in open
11:41:58 _serialize_string(self.remote.name)
11:41:58 File "C:\ProgramData\EventGhost\plugins\SamsungSmartTVPlus\remote_websocket.py", line 31, in _serialize_string
11:41:58 return base64.b64encode(data).decode("utf-8")
11:41:58 NameError: global name 'base64' is not defined
-
- Experienced User
- Posts: 177
- Joined: Thu Dec 04, 2014 2:44 pm
Re: Samsung Smart TV Plus
OK, so I added
No commands work though, they appear in the log OK but no response from TV
Also getting this line every 3 seconds:
12:05:40 SamsungSmartTVPlus.1.Power.On
Doesn't change if TV is on or off
FYI, I currently use the python library "samsungctl" and this controls my TV OK, based on IP address and port number using websocket method
under the lineimport base64
and that stops the errorimport threading
No commands work though, they appear in the log OK but no response from TV
Also getting this line every 3 seconds:
12:05:40 SamsungSmartTVPlus.1.Power.On
Doesn't change if TV is on or off
FYI, I currently use the python library "samsungctl" and this controls my TV OK, based on IP address and port number using websocket method
- kgschlosser
- Site Admin
- Posts: 4428
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Samsung Smart TV Plus
This plugin uses the same mechanisms as the samsungctl library. Question tho. You mentioned port... Are you using a non standard port?
To delete the config open file %appdata%\ecentghost\config.py you are going to need to delete the whole class for the plugin.
When the plugin is functioning properly to delete a tv from the plugin you will need to deny the plugin on the tv side and restart eg. Then the plugin will remove the tv. Once that happens you will be prompted to add the tv again.
To delete the config open file %appdata%\ecentghost\config.py you are going to need to delete the whole class for the plugin.
When the plugin is functioning properly to delete a tv from the plugin you will need to deny the plugin on the tv side and restart eg. Then the plugin will remove the tv. Once that happens you will be prompted to add the tv again.
-
- Experienced User
- Posts: 177
- Joined: Thu Dec 04, 2014 2:44 pm
Re: Samsung Smart TV Plus
No, using 8001This plugin uses the same mechanisms as the samsungctl library. Question tho. You mentioned port... Are you using a non standard port?
OK done this and it does re-discover the TV, but the TV never asks for permission to connect, samsungctl does, should the TV ask for permission to connect to EG ?When the plugin is functioning properly to delete a tv from the plugin you will need to deny the plugin on the tv side and restart eg. Then the plugin will remove the tv. Once that happens you will be prompted to add the tv again.
Thanks
-
- Experienced User
- Posts: 177
- Joined: Thu Dec 04, 2014 2:44 pm
Re: Samsung Smart TV Plus
Not sure if it is related to this plugin, I turned on Debug logging and noticed I was missing the enum package. I've added that and that error has gone but this one remains in the log:
It appears only after the first instance of this (that repeats every 3 seconds):
15:36:18 SamsungSmartTVPlus.1.Power.On
15:36:18 Exception in thread WMI Thread:
15:36:18 Traceback (most recent call last):
15:36:18 File "threading.pyc", line 801, in __bootstrap_inner
15:36:18 File "C:\ProgramData\EventGhost\plugins\System\Device\Notifier.py", line 1525, in run
15:36:18 self._current_devices(guid, device, **dev)
15:36:18 File "C:\ProgramData\EventGhost\plugins\System\Device\Notifier.py", line 1488, in _current_devices
15:36:18 class_guid = device.ClassGuid.upper()
15:36:18 AttributeError: 'NoneType' object has no attribute 'upper'
15:36:18
15:36:21 SamsungSmartTVPlus.1.Power.On
15:36:24 SamsungSmartTVPlus.1.Power.On
15:36:27 SamsungSmartTVPlus.1.Power.On
It appears only after the first instance of this (that repeats every 3 seconds):
15:36:18 SamsungSmartTVPlus.1.Power.On
15:36:18 Exception in thread WMI Thread:
15:36:18 Traceback (most recent call last):
15:36:18 File "threading.pyc", line 801, in __bootstrap_inner
15:36:18 File "C:\ProgramData\EventGhost\plugins\System\Device\Notifier.py", line 1525, in run
15:36:18 self._current_devices(guid, device, **dev)
15:36:18 File "C:\ProgramData\EventGhost\plugins\System\Device\Notifier.py", line 1488, in _current_devices
15:36:18 class_guid = device.ClassGuid.upper()
15:36:18 AttributeError: 'NoneType' object has no attribute 'upper'
15:36:18
15:36:21 SamsungSmartTVPlus.1.Power.On
15:36:24 SamsungSmartTVPlus.1.Power.On
15:36:27 SamsungSmartTVPlus.1.Power.On
- kgschlosser
- Site Admin
- Posts: 4428
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Samsung Smart TV Plus
That error is from the system plugin I created. And not the Samsung plugin.
The plugin does ask for permission. Permission is when a dialog opens telling you that your TV was discovered and gives all the metrics for the TV. Like year produced. Model, serial number, stuff like that. When you press the yes button to add it another dialog should open where you can enter a name you want to give the TV as well as a description. When you press the OK button you telling the plugin to create a new connection to the TV. At this point I do not know what the TV is supposed to do. I do not own one. If it is like the legacy models then I would imagine a dialog would open up on the TV telling you that something (eg) is requesting access to it. And you will be given a choice to accept or decline. If you are not getting this message on the TV I believe it may be bacuse I forgot to add a step.
Close EG.
On the TV deny (not delete) the connection in the network remote menu.
Start EG. The TV should get removed from EventGhost. You will know this because you will get the TV found dialog for it.
Once the TV found dialog opens. Go back into the network remote settings on the TV and delete the connection you just denied.
Then continue with the adding of the TV in the plugin.
See if that goes. If it doesn't what I will do is I will modify the samsungctl library to spit out some debugging info. And see of what I have done comes out the same.
The plugin does ask for permission. Permission is when a dialog opens telling you that your TV was discovered and gives all the metrics for the TV. Like year produced. Model, serial number, stuff like that. When you press the yes button to add it another dialog should open where you can enter a name you want to give the TV as well as a description. When you press the OK button you telling the plugin to create a new connection to the TV. At this point I do not know what the TV is supposed to do. I do not own one. If it is like the legacy models then I would imagine a dialog would open up on the TV telling you that something (eg) is requesting access to it. And you will be given a choice to accept or decline. If you are not getting this message on the TV I believe it may be bacuse I forgot to add a step.
Close EG.
On the TV deny (not delete) the connection in the network remote menu.
Start EG. The TV should get removed from EventGhost. You will know this because you will get the TV found dialog for it.
Once the TV found dialog opens. Go back into the network remote settings on the TV and delete the connection you just denied.
Then continue with the adding of the TV in the plugin.
See if that goes. If it doesn't what I will do is I will modify the samsungctl library to spit out some debugging info. And see of what I have done comes out the same.
Re: Samsung Smart TV Plus
Hi Kevin,
have you read my message above ? maybe you missed it
just wondering if there is any hope to make it work on my TV 
Thanks
have you read my message above ? maybe you missed it


Thanks
-
- Experienced User
- Posts: 177
- Joined: Thu Dec 04, 2014 2:44 pm
Re: Samsung Smart TV Plus
HI,kgschlosser wrote: ↑Fri Jun 15, 2018 1:09 amThat error is from the system plugin I created. And not the Samsung plugin.
The plugin does ask for permission. Permission is when a dialog opens telling you that your TV was discovered and gives all the metrics for the TV. Like year produced. Model, serial number, stuff like that. When you press the yes button to add it another dialog should open where you can enter a name you want to give the TV as well as a description. When you press the OK button you telling the plugin to create a new connection to the TV. At this point I do not know what the TV is supposed to do. I do not own one. If it is like the legacy models then I would imagine a dialog would open up on the TV telling you that something (eg) is requesting access to it. And you will be given a choice to accept or decline. If you are not getting this message on the TV I believe it may be bacuse I forgot to add a step.
Close EG.
On the TV deny (not delete) the connection in the network remote menu.
Start EG. The TV should get removed from EventGhost. You will know this because you will get the TV found dialog for it.
Once the TV found dialog opens. Go back into the network remote settings on the TV and delete the connection you just denied.
Then continue with the adding of the TV in the plugin.
See if that goes. If it doesn't what I will do is I will modify the samsungctl library to spit out some debugging info. And see of what I have done comes out the same.
OK I'll ignore the error, doesnt seem to be causing any issues
Yes all that works fine apart from it does not appear in my TV network menu. When I first run samsungctl the TV popped up and asked for permission and that is in the network devices allowed list. I tried deleting it and restarting samsungctl and that popped up again on the TV
Re: Samsung Smart TV Plus
Maybe it's because the TV just remebers the PC's MAC address? Can you try the following:holdestmade wrote: ↑Fri Jun 15, 2018 9:27 amYes all that works fine apart from it does not appear in my TV network menu. When I first run samsungctl the TV popped up and asked for permission and that is in the network devices allowed list. I tried deleting it and restarting samsungctl and that popped up again on the TV
- remove the TV from the plugin
- delete samsungctl from the TV (and other entrys that might link to the same PC)
- add the TV again in the plugin