Plugins/SamsungTV.html
samsungctl integration into Domoticz
Samsung TV
This is the integration of the samsungctl python project into Domoticz.
Main goal is to try to made the integration of Samsung TV in Domoticz more user friendly than in the past when only scripting & manual device creation has been possible.
Thanks to Dnpwwo for the python framework devlopement.
Installation
For Windows users
Download [1] Setup.exe ( setup.exe /? for more options )
Run it as Administrator-- if something goes wrong screen will become "Red"
The download link provide to you all sources & necessary files.
For others
Because samsungctl depends python 3, so please make sure your pip is using python 3 version. To install pip3, run "sudo apt-get install python3-pip"
pip3 install samsungctl --> mandatory
pip3 install websocket-client --> optional
download plugin.py [2]
See technical area on what is necessary.
All
- validate the installation:
open cmd window execute samsungctl -i --host xx.xx.xx.xx or samsungctl -i --host xx.xx.xx.xx --method websocket (for 2016+ TVs)
where xx.xx.xx.xx is the television IP address
if all is ok, you should see the menu, just test some keys to see if remote command is working, press Q for exit:
Once all is ok, restart Domoticz and go to Domoticz / Setup / Hardware and select Samsung TV
NOTA: first time, you could see on your TV screen request to authorize access, just validate.
Configuration
for the configuration, lets focus on specific parameters to this plugin, for others, see Domoticz documentation.
- Name: Hardware name to give
- IP address : the IP address of your television, this one need to be static and should no change.
- Port: port number plugin will use to connect to the television (e.g. 192.168.1.10:55000), default to 55000.
- Method: Legacy / Websocket , depend of your television. Serie C - D use Legacy, not tested with Websocket.
- Name: remote controller name, this will be displayed on your television, requested to allow connection only the first time.
- ID: necessary, not really know the reason, do not modify.
- Timeout(wake up): time the wake up script could run to try to wake up television (in seconds) before abort. Lowest value is the best.
- NOTA: this will suspend full python system during this time
- The best option could be to use a shell command like that : start cmd /c C:\Domoticz\plugins\WanIPspeed\plugin.cmd
- in this way start will initate a new subprocess and return immediately to the main plugin system.
- Wake Up command (HTTP/shell): command to send to try to wake up television. If begin with Http:// this will execute a HTTP Get of provided URL otherwise a shell command will be launched. Blank is allowed and in this way nothing will be initiated by the plugin.
- Debug : False or True, this will put lots of informations into Domoticz log, use it for testing only. On production put it to False.
User Guide
There is no possibility in this version to know / pool TV status. So all information provided by in-builded device are 'supposed to be'. Several (4) devices will be created after you have added the 'Samsung TV' hardware. But you can also use the command line possibility to create custom device to suit your needs, this is the purpose of the plugin.cmd file.
Inside Domoticz
pre-defined devices
In Domoticz, if you go to Switches, you will found 4 devices created and at your disposal.
- xxx- Status
This one will show the TV status. You can also put On or Off the TV, PowerOff is managed internally but you need to find a way to initiate PowerOn as serie C TV, do not manage Wake On Lan. One possibility for that is to send, via Broadlink RM2 device, the IR code to wake up the TV.
- xxx- Source
You have 4 possibilities to change source display: TV, HDMI, HDMI1, HDMI2 self explanary...
- xxx- Volume
You can put on MUTE, increase (VOL+) or decrease (VOL-) volume.
- xxx- Input
with SOURCE option you go through all sources available and ENTER select and validate the choice. ANYNET : Samsung feature...
script
samsungctl provide command line feature that you can use with your scripts. This mean that this can be put on the on/off action of any Domoticz devices and also used to create your custom devices in a easy way. For this purpose the plugin.cmd is at disposal of windows users.
This very basic cmd file require two parameters : TV IP address & KEY to send (see Technical information)
Technical information
Devlopment/test platform
- Win 10 x64
- Python v 3.5.3 x86
- Domoticz Beta min: V3.7091
- Samsung TV C serie on legacy mode
Main module:
- samsungctl v 0.6.0 -> GitHub samsungctl
Additional modules:
- wheel needed to install
- curses-2.2-xy-none-win32.whl is used for interactive mode in windows (xy depend python version)
- websocket-client -> necessary for new TV Model >2016
All python modules installed by using : pip install <module name>
Environnement variable:
- HOME need to be defined to have command line working
Junction - Windows:
- link/junction need to be created for c:\program files(x86)\Domoticz to avoid space problem when call cmd file
Linux specific: example on debian
domoticz looks lib at
/usr/local/lib/python3.4/dist-packages/
this mean once
sudo pip3 install samsungctl
pip3 is use to install lib on Python 3
is done, you have to copy lib on the good dir :
sudo cp -r /usr/local/lib/python3.4/dist-packages/samsungctl/ /usr/lib/python3.4/
Then restart domoticz
sudo service domoticz restart
if you need websocket-client repeat same steps.
Plugin files
Files need to be located under plugins\SamsungTV folder
plugin.cmd
windows cmd file that will execute samsungctl --host xx.xx.xx.xx KEY
can be used as script for Domoticz device:
for example : script://c:/domoticz/plugins/samsungtv/plugin.cmd 192.168.1.20 KEY_MUTE
this will put on Mute television with IP address 192.168.1.20
plugin.py
main python program to manage television into Domoticz
links
[3]Samygo [4]Key codes [5]Github samsungctl [6]Pypi samsungctl [7] Plugin source files