2016-01-05, 01:52
UPDATE: https://github.com/jknight2014/Samsung-E...ree/master this is my initial version. If I have done things right it will toggle the tv when called directly. You can call it with a "mode" argument for dedicated on and off commands: plugin://plugin.script.samsung.control/?mode=on. I have not tested yet.
I am taking a crack at writing my own Kodi addon. I am starting this thread as I work for my impending questions. I have had a few simple python scripts that turn my samsung tv on and off. Switching to OpenElec has forced me to find a new method. OpenElec does not come compiled with the pyserial module. I have found a pyserial addon. But I can not import it directly from anywhere. So I would like to package it as an addon. So my few starter questions,
Is this best done as a script addon? Can one addon have multiple accessable scripts? I have several scripts, tvon, tvoff, and tvtoggle are the ones I want to include now. The only difference being the hex code sent to the tv.
This is my current script:
I am reading some howtos and I think just packaging it as a script. I use the XBMC Callbacks Plugin by pulli to turn the tv on and off automatically. So I just need to be able to run the script from there.
Suggestions and help apperiated! Once I start the base code I will upload to github and update this post.
I am taking a crack at writing my own Kodi addon. I am starting this thread as I work for my impending questions. I have had a few simple python scripts that turn my samsung tv on and off. Switching to OpenElec has forced me to find a new method. OpenElec does not come compiled with the pyserial module. I have found a pyserial addon. But I can not import it directly from anywhere. So I would like to package it as an addon. So my few starter questions,
Is this best done as a script addon? Can one addon have multiple accessable scripts? I have several scripts, tvon, tvoff, and tvtoggle are the ones I want to include now. The only difference being the hex code sent to the tv.
This is my current script:
Code:
import time, serial
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=9600, timeout=1)
resp=""
loop="true"
string="030cf100"
count=0
while loop:
if count == 10:
break
if string in resp:
print "found it"
break
ser.close()
else:
ser.write("\x08\x22\x00\x00\x00\x00\xd6")
data = ser.read(24)
resp=data.encode('hex')
print resp
count = count +1
time.sleep(1)
print "finished"
I am reading some howtos and I think just packaging it as a script. I use the XBMC Callbacks Plugin by pulli to turn the tv on and off automatically. So I just need to be able to run the script from there.
Suggestions and help apperiated! Once I start the base code I will upload to github and update this post.