Kodi Community Forum

Full Version: [REQUEST] Tellstick Script Addon - for home automation control via Telldus Tellstick?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
Anyone willing to build a plug-in, similar to the one for mediaportal?
http://forum.team-mediaportal.com/mediap...0-a-76036/
This was accomplished here somehow (http://forum.xbmc.org/showthread.php?tid=67546), but it will be nice to have additional options, like turn off (dimm) some lights and on some other if xbmc plays; dimm at 90% for movies and 50 % for tvshows, party mode dimm at 30 %... etc
Regards,
Tash
A plugin for the tellstick would be indeed very nice.
Would be enough a page with a few buttons for switch on/off devices.

Regards
Fux
Very good idea +1
I want this too! Big Grin
we all do
i got an python script a friend of mine code for me to turn the lights off/on when i play/stop/pause a movie, its just running in the bakgrund on the computer
The code is already made for Plex so if somebody could port it to xbmc would be nice and not that hard. https://github.com/eirikh/TellSticker/tr...r/Contents
'
Here is mine python script, its lookup the currently now playing every 5 sek works great:

# -*- coding: utf-8 -*-
# __ ______ __ __ ____ #
# \ \/ / __ )| \/ |/ ___|_ __ ___ #
# \ /| _ \| |\/| | | | '_ ` _ \ #
# / \| |_) | | | | |___| | | | | | #
# /_/\_\____/|_| |_|\____|_| |_| |_| #
# #
#-#-#-#-#-#-#-#-#-#-#-#-# SETTINGS #-#-#-#-#-#-#-#-#-#-#-#-#
# #
# url - The url to connect to.
#

url = 'http://aa:8080/xbmcCmds/xbmcHttp?command=getcurrentlyplaying'

#
# update_frequency - Number of seconds between updates
#

update_frequency = 5

#
# cmd_play2pause - Command to execute when XBMC playStatus goes from
# "playing" to "paused".
#

cmd_play2pause = 'tdtool.exe --on 7 --on 6'

#
# cmd_pause2play - Command to execute when XBMC playStatus goes from
# "paused" to "playing".
#

cmd_pause2play = 'tdtool.exe --off 6 --off 7'

#
# cmd_none2play - Command to execute when XBMC playStatus goes from
# none to "playing".
#

cmd_none2play = 'tdtool.exe --off 6 --off 7'

#
# cmd_play2none - Command to execute when XBMC playStatus goes from
# "playing" to none.
#

cmd_play2none = 'tdtool.exe --on 7'

#
# cmd_pause2none - Command to execute when XBMC playStatus goes from
# "paused" to none.
#

cmd_pause2none = '' #Don't do anything

# #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#-#-#-#-#-#-#-#-#-# CODE BELOW, DON'T EDIT #-#-#-#-#-#-#-#-#-#
#

import datetime
import os
import re
import subprocess
import sys
import time
import urllib

def log(message, output = sys.stdout):
ts = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
f = open(os.path.join(sys.path[0], 'xbmcm.log'), 'a')
#if VERBOSE:
print >> output, '[%s] %s' % (ts, message)
f.write('[%s] %s\n' % (ts, message))
f.close()

log('XBMXmonitor is starting...')

playstatus = -1
while True:
try:
data = urllib.urlopen(url).read()
data = re.sub(r'<[^>]+>', '', data).strip().split('\n')
status = {}
for x in data:
if ':' in x:
k, v = x.split(':', 1)
status[k.lower().strip()] = v.strip()
if playstatus == -1:
if 'playstatus' in status:
playstatus = status['playstatus']
else:
playstatus = None

else:
if 'playstatus' in status:
np = status['playstatus']
else:
np = None

if playstatus == 'Playing':
if np == None:
log('Status changed: Playing -> None')
subprocess.Popen(cmd_play2none.split(' '))
elif np == playstatus:
pass
else:
log('Status changed: Playing -> Paused')
subprocess.Popen(cmd_play2pause.split(' '))
elif playstatus == None:
if np == 'Playing':
log('Status changed: None -> Playing')
subprocess.Popen(cmd_none2play.split(' '))
else:
if np == None:
log('Status changed: Paused -> None')
subprocess.Popen(cmd_pause2none.split(' '))
elif np == 'Playing':
log('Status changed: Paused -> Playing')
subprocess.Popen(cmd_pause2play.split(' '))
playstatus = np
except Exception, e:
log('Unable to connect to xbmc %s. Retrying in 5 minutes' % e, sys.stderr)
time.sleep(4*60)
time.sleep(update_frequency)
I finally found a guide that works like a charm using my TellStick (even in Eden). Look here:

http://www.satheesh.net/2012/01/09/xbmc-lights/

Wink
Ive put together a scrip that might do the trick:

http://forum.xbmc.org/showthread.php?tid...pid1217316
Check out this thread if you have a Tellstick Net!

http://forum.xbmc.org/showthread.php?tid=142208

Best Regards
Henrik