Kodi Community Forum
[REQUEST] Tellstick Script Addon - for home automation control via Telldus Tellstick? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: [REQUEST] Tellstick Script Addon - for home automation control via Telldus Tellstick? (/showthread.php?tid=82708)



[REQUEST] Tellstick Script Addon - for home automation control via Telldus Tellstick? - tash - 2010-10-07

Hello,
Anyone willing to build a plug-in, similar to the one for mediaportal?
http://forum.team-mediaportal.com/mediaportal-plugins-47/tellstick-pause-2-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


- Fuxx - 2010-10-11

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


- Viald - 2010-12-16

Very good idea +1


- xelon - 2010-12-25

I want this too! Big Grin


- RaNaMaster - 2010-12-26

we all do


- sly_ - 2011-01-03

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


- Gabrielx - 2011-04-01

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/tree/master/Contents
'


- sly_ - 2011-04-03

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)


- unknown_inc - 2012-01-09

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


RE: [REQUEST] Tellstick Script Addon - for home automation control via Telldus Tellstick? - rbiez - 2012-10-19

Ive put together a scrip that might do the trick:

http://forum.xbmc.org/showthread.php?tid=143070&pid=1217316#pid1217316


RE: [REQUEST] Tellstick Script Addon - for home automation control via Telldus Tellstick? - henkepenka - 2012-10-21

Check out this thread if you have a Tellstick Net!

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

Best Regards
Henrik