Python Plugin: Samsung TV

Python and python framework
Calzor Suzay
Posts: 132
Joined: Tuesday 08 July 2014 15:10
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: UK
Contact:

Re: Python Plugin: Samsung TV

Post by Calzor Suzay » Monday 12 March 2018 15:06

I gave up for now trying to get it working, just kept killing Domoticz.

When the beta goes live stable I might look to try again.

AndreDomoticz
Posts: 1
Joined: Monday 12 March 2018 22:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by AndreDomoticz » Tuesday 13 March 2018 0:28

Does some one have the plug in functioning on the raspberry with raspbian ?

installation of the plugin went smoothly

the Samsung hardware can be selected

after filling out the information the devices are created
and commands are accepted by the TV
the logs look like:

2018-03-11 22:59:07.502 (Samsung TV) Initialized version 2.0.1, author 'zak45'
2018-03-11 22:59:07.509 (Samsung TV) Debug log level set to: 'true'.
2018-03-11 22:59:07.509 (Samsung TV) 'Port':'8001'
2018-03-11 22:59:07.510 (Samsung TV) 'Key':'SamsungTV'
2018-03-11 22:59:07.510 (Samsung TV) 'Name':'Samsung TV'
2018-03-11 22:59:07.510 (Samsung TV) 'Author':'zak45'
2018-03-11 22:59:07.510 (Samsung TV) 'Mode2':'samsungctl'
2018-03-11 22:59:07.510 (Samsung TV) 'Mode6':'Debug'
2018-03-11 22:59:07.510 (Samsung TV) 'HomeFolder':'/home/domoticz/plugins/SamsungTV/'
2018-03-11 22:59:07.510 (Samsung TV) 'Version':'2.0.1'
2018-03-11 22:59:07.510 (Samsung TV) 'Mode1':'websocket'
2018-03-11 22:59:07.510 (Samsung TV) 'Address':'192.168.1.29'
2018-03-11 22:59:07.511 (Samsung TV) 'Mode4':'5'
2018-03-11 22:59:07.511 (Samsung TV) 'HardwareID':'9'
2018-03-11 22:59:07.511 (Samsung TV) Device count: 4
2018-03-11 22:59:07.511 (Samsung TV) Device: 1 - ID: 89, Name: 'Samsung TV - Status', nValue: 1, sValue: 'Samsung On'
2018-03-11 22:59:07.511 (Samsung TV) Device ID: '89'
2018-03-11 22:59:07.511 (Samsung TV) Device Name: 'Samsung TV - Status'
2018-03-11 22:59:07.511 (Samsung TV) Device nValue: 1
2018-03-11 22:59:07.512 (Samsung TV) Device sValue: 'Samsung On'
2018-03-11 22:59:07.512 (Samsung TV) Device LastLevel: 0
2018-03-11 22:59:07.512 (Samsung TV) Device: 2 - ID: 90, Name: 'Samsung TV - Source', nValue: 10, sValue: '10'
2018-03-11 22:59:07.512 (Samsung TV) Device ID: '90'
2018-03-11 22:59:07.512 (Samsung TV) Device Name: 'Samsung TV - Source'
2018-03-11 22:59:07.512 (Samsung TV) Device nValue: 10
2018-03-11 22:59:07.512 (Samsung TV) Device sValue: '10'
2018-03-11 22:59:07.512 (Samsung TV) Device LastLevel: 0
2018-03-11 22:59:07.512 (Samsung TV) Device: 3 - ID: 91, Name: 'Samsung TV - Volume', nValue: 10, sValue: '10'
2018-03-11 22:59:07.512 (Samsung TV) Device ID: '91'
2018-03-11 22:59:07.512 (Samsung TV) Device Name: 'Samsung TV - Volume'
2018-03-11 22:59:07.513 (Samsung TV) Device nValue: 10
2018-03-11 22:59:07.513 (Samsung TV) Device sValue: '10'
2018-03-11 22:59:07.513 (Samsung TV) Device LastLevel: 0
2018-03-11 22:59:07.513 (Samsung TV) Device: 4 - ID: 92, Name: 'Samsung TV - Input', nValue: 10, sValue: '10'
2018-03-11 22:59:07.513 (Samsung TV) Device ID: '92'
2018-03-11 22:59:07.513 (Samsung TV) Device Name: 'Samsung TV - Input'
2018-03-11 22:59:07.513 (Samsung TV) Device nValue: 10
2018-03-11 22:59:07.513 (Samsung TV) Device sValue: '10'
2018-03-11 22:59:07.513 (Samsung TV) Device LastLevel: 0
2018-03-11 22:59:07.514 (Samsung TV) Connecting to: 192.168.1.29:8001
2018-03-11 22:59:07.515 (Samsung TV) isAlive status :True
2018-03-11 22:59:07.515 (Samsung TV) Devices are connected - Initialisation

2018-03-11 22:59:10.424 (Samsung TV) Send key : KEY_VOLDOWN
2018-03-11 22:59:10.425 (Samsung TV - Volume) Updating device from 10:'10' to have values 20:'20'.
2018-03-11 22:59:10.441 (Samsung TV) Update 20:'20' (Samsung TV - Volume)
2018-03-11 22:59:11.684 (Samsung TV) Send key : KEY_VOLUP
2018-03-11 22:59:11.685 (Samsung TV - Volume) Updating device from 20:'20' to have values 10:'10'.
2018-03-11 22:59:11.699 (Samsung TV) Update 10:'10' (Samsung TV - Volume)
2018-03-11 22:59:11.738 (Samsung TV) No ini file :/home/domoticz/plugins/SamsungTV/plugin_remote_9.ini
2018-03-11 22:59:11.738 (Samsung TV) Custom Commands for Remote not managed
2018-03-11 22:59:11.739 (Samsung TV) Heartbeat interval set to: 30.

The volume goes up and down as expected. So the access towards the Samsung TV is working.


but without touching the configuration the thread is stopped by the system.




restarting the system when the samsung hardware is enabled results in a crash....
(using python 3.5 on the latest raspbian release)


2018-03-11 22:41:04.828 (Samsung TV) Initialized version 2.0.1, author 'zak45'
2018-03-11 22:41:04.941 Error: Domoticz received fatal signal 11 !...
2018-03-11 22:41:04.965 Error: /home/domoticz/domoticz() [0x1cdc48]
2018-03-11 22:41:04.965 Error: /home/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1cdd00]
2018-03-11 22:41:04.965 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer+0) [0x76b216b0]



2018-03-11 22:41:04.828 (Samsung TV) Initialized version 2.0.1, author 'zak45'
2018-03-11 22:41:04.941 Error: Domoticz received fatal signal 11 !...
2018-03-11 22:41:04.965 Error: /home/domoticz/domoticz() [0x1cdc48]
2018-03-11 22:41:04.965 Error: /home/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1cdd00]
2018-03-11 22:41:04.965 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer+0) [0x76b216b0]

on beta I got:


2018-03-11 23:10:28.631 (Samsung TV) Initialized version 2.0.1, author 'zak45'
2018-03-11 23:10:28.684 Error: (Samsung TV) Failed to refresh Options dictionary for Hardware/Unit combination (9:2).
2018-03-11 23:10:28.689 Error: Domoticz received fatal signal 11 !...
2018-03-11 23:10:28.693 Error: /home/domoticz/domoticz() [0x1cdc48]
2018-03-11 23:10:28.693 Error: /home/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1cdd00]
2018-03-11 23:10:28.693 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer+0) [0x76ae16b0]






2018-03-11 23:21:03.667 (Samsung Smart TV) Initialized version 2.0.1, author 'zak45'
2018-03-11 23:21:03.681 (Samsung Smart TV) Devices created.
2018-03-11 23:21:03.682 (Samsung Smart TV) Connecting to: 192.168.1.29:8001
2018-03-11 23:21:03.692 (Samsung Smart TV) Update 1:'Samsung On' (Samsung Smart TV - Status)
2018-03-11 23:21:03.695 (Samsung Smart TV) Update 10:'10' (Samsung Smart TV - Source)
2018-03-11 23:21:03.699 (Samsung Smart TV) Update 10:'10' (Samsung Smart TV - Volume)
2018-03-11 23:21:03.702 (Samsung Smart TV) Update 10:'10' (Samsung Smart TV - Input)
2018-03-11 23:21:05.828 (Samsung Smart TV) Update 20:'20' (Samsung Smart TV - Volume)
2018-03-11 23:21:07.165 (Samsung Smart TV) Update 10:'10' (Samsung Smart TV - Volume)

after couple of restarts I see also before the samsung is starting the following:


2018-03-11 23:31:15.179 PluginSystem: Entering work loop.
2018-03-11 23:31:15.477 Python EventSystem: Module not found - Trying to initialize.
2018-03-11 23:31:15.478 Python EventSystem: Initalizing event module.






disabling the samsung hardware results in starting domoticz




someone has some suggestions or how I can enable some more debugging options to find out more details which might lead to the real root cause



thanks a lot

Andre'

zak45
Posts: 481
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.9056
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Sunday 18 March 2018 19:13

AndreDomoticz wrote:
Tuesday 13 March 2018 0:28
Does some one have the plug in functioning on the raspberry with raspbian ?
have seen some problem with some plugin on PI;
what you can test:
install 3.4 python and/or compile from source.

marcellom
Posts: 4
Joined: Sunday 18 March 2018 23:42
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by marcellom » Friday 23 March 2018 20:32

Hi all, im a newbie and my name is Marcello.
I discover Domoticz as Docker and now i have installed it in a rpi2. Is really funny and works very well... :)
I have a Samsung tv F series and the samsungctl pluging works (thanks :)) , but only after some troubles: every time i pushed a "samsung switch" my tv asked for authorization...
At the end the problem was with the empty id field, when I did the first plugin configuration.
Now, with the id field filled... my tv store (and dont forget) the authorization.
But i have a problem: some buttons in the preconfigured switchs dont works as aspected (hdm2 open a window menù, as example ) and i'd like do a modification in the key configuration to match the switch button with the buttons in my remote control.
Could someone tell me how to do?
Thanks in advance :)
PS I know... my english is bad.. :/


zak45
Posts: 481
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.9056
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Friday 23 March 2018 23:52

marcellom wrote:
Friday 23 March 2018 20:32
But i have a problem: some buttons in the preconfigured switchs dont works as aspected (hdm2 open a window menù, as example ) and i'd like do a modification in the key configuration to match the switch button with the buttons in my remote control.
Could someone tell me how to do?
Hi, just edit plugin.py and replace the KEY_XXX by what you want :

Code: Select all

            if (Unit == 2):  # Source selector                    
                if (Level == 10): SamsungSend("KEY_TV",Unit,Level)
                if (Level == 20): SamsungSend("KEY_HDMI",Unit,Level)
                if (Level == 30): SamsungSend("KEY_HDMI1",Unit,Level)
                if (Level == 40): SamsungSend("KEY_HDMI2",Unit,Level)
            elif (Unit == 3):   # Volume control                    
                if Devices[Unit].nValue == 0:
                    numberMute += 1
                if (Level == 10): SamsungSend("KEY_VOLUP",Unit,Level)
                if (Level == 20): SamsungSend("KEY_VOLDOWN",Unit,Level)
            elif (Unit == 4): # Source input selector                    
                if (Level == 10): SamsungSend("KEY_SOURCE",Unit,Level)
                if (Level == 20): SamsungSend("KEY_ANYNET",Unit,Level)                    
                if (Level == 30): SamsungSend("KEY_ENTER",Unit,Level)
and here you can found key code :
https://github.com/Ape/samsungctl

marcellom
Posts: 4
Joined: Sunday 18 March 2018 23:42
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by marcellom » Saturday 24 March 2018 0:04

Hi Zak :) I thank you very very much :)
Ill try and report :)

marcellom
Posts: 4
Joined: Sunday 18 March 2018 23:42
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by marcellom » Saturday 24 March 2018 20:46

Wow... it works :) For now just for ch+ and ch-.
I am a total newby in Domotocz and phyton, but your clear answer give me a big help!
Thanks again Zak, well done :)
Ehm... just a stupid question...
Anyone can share his Samsung key code table with comments?
I have discovered that KEY_EXT30, in my F series tv, runs Netflix app...
KEY_EXTxx, i think, launch the installed applications.
XX is a number between 1 and 40.
Anyone knows Plex code number? Youtube? :)

Smiggel
Posts: 10
Joined: Friday 23 March 2018 18:29
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by Smiggel » Friday 20 April 2018 10:30

I installed the plugin before I found out that my TV is not supported "SAMSUNG UE40JU6400".

I could reach the tv using the terminal, but no commands were accepted. Also I never got to see the authorize screen as well. I could add the hardware to my Domoticz system. That worked and even could see in the logs that it detects when my tv is on and off. However, the switch in Domoticz did not work. It always said the tv was on, when I could see in the logs that it detected when it was off.

Like some others here, the script crashed my Domoticz too. When I have my TV on and reboot my system, I could no longer access Domoticz. When I turn of my tv and reboot, I could access the webinterface again. :-)

It's really too bad the script is not working for every TV. Will keep an eye on this script. Hopefully it will be able to work in the future with more tv's.

lbuijk
Posts: 4
Joined: Friday 14 July 2017 22:00
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by lbuijk » Wednesday 09 May 2018 23:41

My challenge:

Domoticz Bèta
Python 3.5
samsungctl (tested with 0.7.x and 0.6.x)
websocket-client
wheel
six
...
well...all that is already mentoined.

When I activate the hardware in domoticz it freezes. System still running...Domoticz offline.
When I rename websocket map in /usr/bin/python3.5 and restart the domoticz service its all working again

What to do?

zak45
Posts: 481
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.9056
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Saturday 12 May 2018 10:59

lbuijk wrote:
Wednesday 09 May 2018 23:41
My challenge:

Domoticz Bèta
Python 3.5
samsungctl (tested with 0.7.x and 0.6.x)
websocket-client
wheel
six
...
well...all that is already mentoined.

When I activate the hardware in domoticz it freezes. System still running...Domoticz offline.
When I rename websocket map in /usr/bin/python3.5 and restart the domoticz service its all working again

What to do?
maybe try to compile Domoticz from source. (info should be on wiki)

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests