Terra - a Telldus addon
#1
There are bits and pieces supporting Telldus home automaton scattered across the web, but none that really could do all I ever wanted. This addon supports USB sticks and Net devices as well as Telldus Live! and local binary. Individual dimmer and switcher control are supported as well as video playback automation.The available device are automatically extracted.

It should be platform independent, though it is not tested on Linux yet. Give it a spin - constructive feedback is always welcome.

The plugin is found here:
https://code.google.com/p/plugin-program...loads/list

Wish list / known issues - feel free to contribute:
- Full XBMC Telldus Live! integration for the authentication process. Right now a browser is opened. Mechanize or other libs could be leveraged.
- Dimmers are sometimes flaky after automatic setup. Do a manual change to switch, apply either on/off and then change back to dimmer to resolve.
- Dimmer icons changes glow on the left side when above 50%. Minor cosmetic issue.
Reply
#2
I tried this and it installs fine, but when I run "setup telldus Live!" I get error "script failed: deviceCtrl.py"

This is found in log:

Code:
12:35:59 T:2664   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IndexError'>
                                            Error Contents: list index out of range
                                            Traceback (most recent call last):
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra\resources\lib\terra_gui.py", line 63, in onInit
                                                self.applyNavigation()
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra\resources\lib\terra_gui.py", line 133, in applyNavigation
                                                self.setFocus(self.buttons[self.curLine])
                                            IndexError: list index out of range
                                            -->End of Python script error report<--
12:36:04 T:2664   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IndexError'>
                                            Error Contents: list index out of range
                                            Traceback (most recent call last):
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra\resources\lib\terra_gui.py", line 100, in onAction
                                                self.getControl(210+self.curLine-1).setImage(__img_path__+'/'+self.devices[self.curLine-1][2]+'.png')
                                            IndexError: list index out of range
                                            -->End of Python script error report<--
12:36:05 T:2664   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IndexError'>
                                            Error Contents: list index out of range
                                            Traceback (most recent call last):
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra\resources\lib\terra_gui.py", line 93, in onAction
                                                self.getControl(210+self.curLine+1).setImage(__img_path__+'/'+self.devices[self.curLine+1][2]+'.png')
                                            IndexError: list index out of range
                                            -->End of Python script error report<--
12:36:08 T:3744   ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.program.terra/
12:36:08 T:3744   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.program.terra/) failed
12:36:08 T:3244  NOTICE: Thread Background Loader start, auto delete: false
12:36:08 T:3744  NOTICE: Previous line repeats 2 times.
12:36:08 T:3744   ERROR: CLocalizeStrings::ClearBlock: Trying to clear non existent block C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra
12:36:18 T:3588  NOTICE: Thread XBPyThread start, auto delete: false
12:36:18 T:3588  NOTICE: -->Python Interpreter Initialized<--
12:36:19 T:3588   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IOError'>
                                            Error Contents: (2, 'No such file or directory', 'C:\\Users\\kayrune\\AppData\\Roaming\\XBMC\\/userdata/addon_data/plugin.program.terra/tdtool.conf')
                                            Traceback (most recent call last):
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra/resources/lib/deviceCtrl.py", line 98, in <module>
                                                telldusLiveAuthenticate()
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra/resources/lib/deviceCtrl.py", line 84, in telldusLiveAuthenticate
                                                key = tdtool.requestToken()
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra/resources/lib\tdtool.py", line 179, in requestToken
                                                saveConfig()
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra/resources/lib\tdtool.py", line 204, in saveConfig
                                                config.write()
                                              File "C:\Users\kayrune\AppData\Roaming\XBMC\addons\plugin.program.terra/resources/lib\configobj.py", line 2111, in write
                                                h = open(self.filename, 'wb')
                                            IOError: (2, 'No such file or directory', 'C:\\Users\\kayrune\\AppData\\Roaming\\XBMC\\/userdata/addon_data/plugin.program.terra/tdtool.conf')
                                            -->End of Python script error report<--
12:40:50 T:576  NOTICE: Thread CFileCache start, auto delete: false
Reply
#3
I rebooted the computer, set to debug plugin and changed to 8 devices, then it worked. Don't know what actually fixed it though.
Reply
#4
Ok, I got one step further. I can control all my light now, had to do the dimmer -> on/off change for some of them to get them working. and I can now dim all my light sources from the plugin.

So what are your continued plans for the plugin ? So far it's looking great.

I have some suggestions:

- Add more than 8 devices
- Make different behaviour depend on if you watch live-tv/tv-series/movie
- Make different behaviour depend on time of day (or maybe sun up/down)
Reply
#5
Hmm... seems like a race condition regarding folder and file creation for setup. I'll take a look at it.

The engine itself supports unlimited devices, it is the GUI that introduces the max 8 limit. This can certainly be implemented and was my intention. But it is practicalities. Firstly, it requires a custom GUI scroll implementation, the settings and layout would be a bit more challenging as it is XML and there is no preprocessor support for it. Meaning you cannot generate GUI objects at runtime. Feel free to contribute :-)
Reply
#6
my coding skills are one step below "hello world" level, so don't really think I can contribute.

I have another question though, is there, or can I add a shortcut for the light control view ?

about the gui limitation, how about auto control more devices, but choose the 8 you would like in the menu view ? would it be better/easy solution ?
tbh 8 devices works for me, what I really would like is the 2 other suggestions.
Reply
#7
I appreciate the feedback and pointers; it can definitely be done; but there is some work involved. I've added it to the project todo list.

I updated the installer to hopefully get a cleaner setup: rev 0.0.2

You can add programs as shortcuts in XBMC and they will be added to the favorites menu; i believe 'c' is the shortcut.
Reply
#8
Bumping in hopes of a kodi compatible version. Smile[/align]
Reply
#9
Haven't looked at the 14 API changes. But should be relatively straight forward to update, the code is organized in upper and lower levels. It will probably take several weeks before I get around to doing though - to much other stuff going o. Feel free to take a stab at the source.
Reply
#10
I have a slight problem with this addon. Don't know if its the right place to turn to but I'll give it a try anyway.
To begin with, I'm running openelec on Rpi2.

The problem is that I can't verify my telldus live account because of the lac of a browser in openelec Rpi2. I've been looking round to get the session URL and log in to it and verify it with my laptop but the only thing missing is the "token" I just can't find a way to see it before its "timed out" and "invalid". So is there a way to get/see the whole URL with the exact token for that session?
Tried to see if I would find something in the "terminal" with ssh. But can't say I've succeeded. Don't even really know that I'm doing not of the time. Don't even know if it's possible that way. Just a thought I had. So please help me.
Reply
#11
I don't have an up and running system myself as I just moved - things are a bit in flux.

But a couple of pointers: Have you enabled debug under settings? It should flush all information into the log (if I kept my tongue straight during implementation). The file called to initiate is deviceCtrl.py under resources/lib/. The telldusLiveAuthenticate() and telldusLiveConfirm() are the functions managing the authentication and they call upon functions in tdtool.py. xbmc.log() is a useful function in this. I'd really like to get the authentication piece rewritten into JSON that should in theory remove the need for a browser to do this step and handle it all through XBMC. Though I have not gotten to it - help welcome :-) Happy hunting - let me know how it goes.
Reply
#12
(2015-03-07, 02:04)snyft Wrote: Bumping in hopes of a kodi compatible version. Smile[/align]

In addon.xml I changed:
Code:
<import addon="xbmc.python" version="2.0"/>
to:
Code:
<import addon="xbmc.python" version="2.1.0"/>

Did not make the installer work, but after a manual copy of the addon files into kodi addon folder, it runs perfectly from within Kodi.
Reply
#13
(2015-03-24, 12:37)ekrangnes Wrote: I don't have an up and running system myself as I just moved - things are a bit in flux.

But a couple of pointers: Have you enabled debug under settings? It should flush all information into the log (if I kept my tongue straight during implementation). The file called to initiate is deviceCtrl.py under resources/lib/. The telldusLiveAuthenticate() and telldusLiveConfirm() are the functions managing the authentication and they call upon functions in tdtool.py. xbmc.log() is a useful function in this. I'd really like to get the authentication piece rewritten into JSON that should in theory remove the need for a browser to do this step and handle it all through XBMC. Though I have not gotten to it - help welcome :-) Happy hunting - let me know how it goes.
Had a friend to help me. Don't really know what he did but he fixed it for me. Works like a charm! Great add-on btw!

I'll try to make him write down what he did if someone here needs help in the future.
Reply
#14
I can get this halfway working. When I open it, a menu on the left shows up and let me controls my devices. However I can not understand how to automaticly control them when pause/playing video..

Any help?
Reply
#15
I have sent you a PM, could you please let me know how you are sending the commands to telldus live? I'm looking to do something similar and send GET commands over a browser URL. Could you help me, thank you!
Reply



Logout Mark Read Team Forum Stats Members Help
Terra - a Telldus addon2
This forum uses Lukasz Tkacz MyBB addons.