TellStick Duo

Questions and comments specific to a particular plugin should go here.

TellStick Duo

Postby krambriw » Tue Oct 18, 2011 7:33 am

This is a plugin for the TellStick Duo RF transceiver. More product information can be found here:
http://telldus.com/products/tellstick_duo

The plugin supports receiving of events as well as transmission of commands.

Latest version always here:
http://sto.hopto.org/Release/TellStickDuo/


Upgrade from earlier versions which might not be compatible:

Preferred way:
- disable the TellStickDuo plugin in EG, save and exit EG
- replace the files with the content of the zip-file
- restart EG
- open the configuration dialog for the TellStickDuo plugin
- make any modifications to the settings
- click OK, enable the plugin and it should start
- save EG

Brutal way:
- replace the files with the content of the zip-file
- restart EG
- you will see an error message that the plugin cannot start
- open the configuration dialog for the TellStickDuo plugin
- make any modifications to the settings
- click OK and it should start
- save EG

Setting up the filtering:
This is the sample default content that will accept messages from the listed sensor brands:
Code: Select all
def sensors_supported():
    list = [
        "mandolyn",
        "oregon",
        "fineoffset"
    ]
    return list

If you prefer, you can for instance filter down to types and even id level.This example would set the filtering to accept only Oregon sensors of type 1A2D:
Code: Select all
def sensors_supported():
    list = [
        "oregon|1A2D"
    ]
    return list

This filter would do the same for Oregon and UPM/ESIC sensors and in addition, only accept specified id's:
Code: Select all
def sensors_supported():
    list = [
        "oregon|1A2D|21",
        "oregon|1A2D|11",
        "oregon|1A2D|32",
        "mandolyn|temperaturehumidity|11",
        "mandolyn|temperaturehumidity|81"
    ]
    return list



Best regards, Walter
Last edited by krambriw on Fri Jan 16, 2015 5:21 pm, edited 31 times in total.
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2544
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Plugin: TellStick Duo

Postby bongolf » Wed Oct 19, 2011 6:09 pm

I'm having problems activating this plugin. When I try the log says:
19:58:09 Traceback (most recent call last) (1540):
19:58:09 File "C:\Program Files\EventGhost\eg\Classes\PluginInstanceInfo.py", line 153, in CreateInstance
19:58:09 plugin.__init__()
19:58:09 File "C:\Program Files\EventGhost\plugins\TellStickDuo\__init__.py", line 158, in __init__
19:58:09 self.callbackId_1 = self.dll.tdRegisterDeviceChangeEvent(
19:58:09 File "ctypes\__init__.pyc", line 366, in __getattr__
19:58:09 File "ctypes\__init__.pyc", line 371, in __getitem__
19:58:09 AttributeError: function 'tdRegisterDeviceChangeEvent' not found

Software
Program Version: 0.4.1.r1540
Build Time: on, 24 aug 2011 07:20:58
Python Version: Stackless Python 2.6.5 final 0
wxPython Version: 2.8.12.0

System
Operating System: Microsoft Windows 7 Professional, 32-bit (build 7600)
CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz
RAM: 2046 MB

USB-Devices
USB-UIRT Device: USB\VID_0403&PID_F850
USB Composite Device: USB\VID_05A4&PID_1000
USB Input Device: USB\VID_05A4&PID_1000&MI_00
USB Input Device: USB\VID_05A4&PID_1000&MI_01
Telldus TellStick: USB\VID_1781&PID_0C30
Generic USB Hub: USB\VID_1A40&PID_0101

Any suggestions of what I can do to fix this?
bongolf
Experienced User
 
Posts: 58
Joined: Tue Jan 19, 2010 12:37 pm

Re: Plugin: TellStick Duo

Postby krambriw » Wed Oct 19, 2011 7:35 pm

Do you have a TellStick Duo or the old TellSTick? What version of Telldus Center are you using? I am using 2.1.0

Best regards, Walter
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2544
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Plugin: TellStick Duo

Postby bongolf » Wed Oct 19, 2011 8:47 pm

I have the TellStick Duo (well I have the old TellStick as well, but it is not connected now) and I am also using TelldusCenter 2.1.0.

And it works just fine controlling the switches from TelldusCenter.
bongolf
Experienced User
 
Posts: 58
Joined: Tue Jan 19, 2010 12:37 pm

Re: Plugin: TellStick Duo

Postby krambriw » Thu Oct 20, 2011 8:19 am

Strange, it works fine here. What is happening is that the plugin fails when getting the entry point to the function in the dll.

Old dll?

You have not manually copied the TelldusCore.dll to some EventGhost folder, have you?

You can try this test version where I have disabled the change event callback so we can see if the rest is working
__init__.py
(22.05 KiB) Downloaded 384 times

Best regards, Walter
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2544
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Plugin: TellStick Duo

Postby bongolf » Thu Oct 20, 2011 3:54 pm

Thank you for trying to help me here!

I have tried with the attached .py-file but it looks exactly the same...

I haven't moved any DLLs manually.
The TelldusCore.dll-file is only located in c:/Program Files/Telldus
Under properties/details for the file it says that the version is 2.1.0.0
bongolf
Experienced User
 
Posts: 58
Joined: Tue Jan 19, 2010 12:37 pm

Re: Plugin: TellStick Duo

Postby krambriw » Thu Oct 20, 2011 4:04 pm

It cant be that it is exactly the same problem, I guess it fails on the next entry point in the dll or what?

It works however for me (and several other users).

I have the same version of EG as you but only XP and Vista

I'm sorry, don't know what this could be...
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2544
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Plugin: TellStick Duo

Postby bongolf » Thu Oct 20, 2011 7:53 pm

Sorry, I wasn't looking close enough...
This is what it says now:
17:38:24 Traceback (most recent call last) (1540):
17:38:24 File "C:\Program Files\EventGhost\eg\Classes\PluginInstanceInfo.py", line 153, in CreateInstance
17:38:24 plugin.__init__()
17:38:24 File "C:\Program Files\EventGhost\plugins\TellStickDuo\__init__.py", line 166, in __init__
17:38:24 self.callbackId_3 = self.dll.tdRegisterSensorEvent(
17:38:24 File "ctypes\__init__.pyc", line 366, in __getattr__
17:38:24 File "ctypes\__init__.pyc", line 371, in __getitem__
17:38:24 AttributeError: function 'tdRegisterSensorEvent' not found
bongolf
Experienced User
 
Posts: 58
Joined: Tue Jan 19, 2010 12:37 pm

Re: Plugin: TellStick Duo

Postby krambriw » Thu Oct 20, 2011 8:34 pm

Yes, for some strange reason, the plugin fails in getting the entry point functions in the TelldusCore.dll

Try the script below and check what response you get

(New macro, eventghost, python scrript, copy & paste the script below, apply, ok, save and then run)

Code: Select all
import time, winsound, logging, os
from ctypes import(
   windll, WINFUNCTYPE, POINTER, string_at,
   wstring_at, c_char_p, c_int, c_ubyte, c_void_p,
)
from datetime import datetime

try:
    dll = windll.LoadLibrary("TelldusCore.dll")
except:
    raise eg.Exception("Error loading TelldusCore.dll")
dll.tdInit()

try:
    numDevices = dll.tdGetNumberOfDevices()
except:
    numDevices = 0
selected = 0

for i in range(numDevices):
    id = dll.tdGetDeviceId(i)
    name = (c_char_p(dll.tdGetName(id))).value
    print i, id, name
   
#dll.tdClose()

My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2544
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Plugin: TellStick Duo

Postby bongolf » Fri Oct 21, 2011 12:32 pm

14:25:30 Python Script
14:25:30 0 1 Vardagsrum Orange
14:25:30 1 2 Matsalen
14:25:30 2 4 Vardagsrum
14:25:30 3 5 Vardagsrum Green
14:25:30 4 6 Gillestuga

And that's the 5 switches I currently have installed.
bongolf
Experienced User
 
Posts: 58
Joined: Tue Jan 19, 2010 12:37 pm

Re: Plugin: TellStick Duo

Postby krambriw » Sat Oct 22, 2011 12:16 pm

OK, try now this extended script.

Only start it once, otherwise EG will crash. After the test you need to restart EG

If it starts with "success", try to generate the various events and you should see them in the EG log window

Best regards, Walter

Code: Select all
import time, winsound, logging, os
from ctypes import(
   windll, WINFUNCTYPE, POINTER, string_at,
   wstring_at, c_char_p, c_int, c_ubyte, c_void_p,
)
from datetime import datetime

try:
    dll = windll.LoadLibrary("TelldusCore.dll")
except:
    raise eg.Exception("Error loading TelldusCore.dll")
dll.tdInit()

try:
    numDevices = dll.tdGetNumberOfDevices()
except:
    numDevices = 0
selected = 0

for i in range(numDevices):
    id = dll.tdGetDeviceId(i)
    name = (c_char_p(dll.tdGetName(id))).value
    print i, id, name
   

DEVICEEVENTPROC = WINFUNCTYPE(
                                        c_void_p,
                                        c_int,
                                        c_int,
                                        POINTER(c_ubyte),
                                        c_int,
                                        c_void_p
                     )

SENSOREVENTPROC = WINFUNCTYPE(
                                        c_void_p,
                                        POINTER(c_ubyte),
                                        POINTER(c_ubyte),
                                        c_int,
                                        c_int,
                                        POINTER(c_ubyte),
                                        c_int,
                                        c_int,
                                        c_void_p
                     )

DEVICECHANGEEVENTPROC = WINFUNCTYPE(
                                        c_void_p,
                                        c_int,
                                        c_int,
                                        c_int,
                                        c_int,
                                        c_void_p
                    )

RAWDEVICEEVENTPROC = WINFUNCTYPE(
                                        c_void_p,
                                        POINTER(c_ubyte),
                                        c_int,
                                        c_int,
                                        c_void_p
                     )


def deviceEventCallback(deviceId, method, p1, i3, p2):
    deviceName = (c_char_p(dll.tdGetName(deviceId))).value
    deviceType = (c_char_p(dll.tdGetModel(deviceId))).value
    print(
        "EventCallback from script: "
        + deviceName
        + deviceType
    )


def sensorEventCallback(
    protocol,
    model,
    id,
    dataType,
    value,
    timestamp,
    callbackId,
    context
):
    TELLSTICK_TEMPERATURE = 1
    TELLSTICK_HUMIDITY = 2
    strProtocol = string_at(protocol)
    strModel = string_at(model)
    strValue = string_at(value)
    dType = ''
    if(dataType == TELLSTICK_TEMPERATURE):
        dType = "Temperature:"
    elif(dataType == TELLSTICK_HUMIDITY):
        dType = "Humidity:"
   
    print(
        "SensorEventCallback from script: "
        +strProtocol
        +'.'
        +strModel
        +'.'
        +str(id)
        +'.'
        +dType
        +'.'
        +strValue
        +'.'
        +str(datetime.fromtimestamp(timestamp))
        )


def deviceChangeEventCallback(deviceId, changeEvent, i3, i4, p1):
    deviceName = (c_char_p(dll.tdGetName(deviceId))).value
    deviceType = (c_char_p(dll.tdGetModel(deviceId))).value
    print(
        "ChangeEvent from script: "
        + deviceName
        + deviceType
    )


def deviceRawEventCallback(p1, i1, i2, p3):
    strData = string_at(p1)
    if (strData == ""):
        return
    print(
        "RawEvent from script: "
        + strData
        + "Duo_ID:"
        + str(i2)
    )


deviceEventProc = DEVICEEVENTPROC(
                                deviceEventCallback
                       )
deviceChangeEventProc = DEVICECHANGEEVENTPROC(
                                deviceChangeEventCallback
                             )
deviceRawEventProc = RAWDEVICEEVENTPROC(
                                deviceRawEventCallback
                          )
sensorEventProc = SENSOREVENTPROC(
                                sensorEventCallback
                       )
try:
    callbackId_0 = dll.tdRegisterDeviceEvent(
                                deviceEventProc,
                                0
                    )
    print "Success", callbackId_0
except:
    print "Failed"


try:
    callbackId_1 = dll.tdRegisterDeviceChangeEvent(
                                    deviceChangeEventProc,
                                    0
                        )       
    print "Success", callbackId_1
except:
    print "Failed"

try:
    callbackId_2 = dll.tdRegisterRawDeviceEvent(
                                    deviceRawEventProc,
                                    0
                        )       
    print "Success", callbackId_2
except:
    print "Failed"

try:
    callbackId_3 = dll.tdRegisterSensorEvent(
                                    sensorEventProc,
                                    0
                        )       
    print "Success", callbackId_3
except:
    print "Failed"




#dll.tdClose()

My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2544
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Plugin: TellStick Duo

Postby bongolf » Sun Oct 23, 2011 8:57 am

Here comes the result:
10:54:23 Python Script
10:54:23 0 1 Vardagsrum Orange
10:54:23 1 2 Matsalen
10:54:23 2 4 Vardagsrum
10:54:23 3 5 Vardagsrum Green
10:54:23 4 6 Gillestuga
10:54:23 Success 3
10:54:23 Failed
10:54:23 Success 4
10:54:23 Failed
10:56:01 TellStickDuo: Turn on Vardagsrum Orange
10:56:01 Retry nbr: 1
10:56:02 Retry nbr: 2
10:56:02 Retry nbr: 3
10:56:02 Retry nbr: 4
10:56:02 An error occurred while trying to transmit
bongolf
Experienced User
 
Posts: 58
Joined: Tue Jan 19, 2010 12:37 pm

Re: Plugin: TellStick Duo

Postby krambriw » Sun Oct 23, 2011 11:10 am

This is very odd, partly working, it must be a version problem of some kind.

- Have you downloaded the latest plugin (note I made a change later the same day I first published it)?
- Have you tried the TS2 plugin for EG (It should work with Duo for transmissions) and do you get the same problem?
- Have you tried re-install Telldus Center?
- Have you possibility to try in another PC or in a virtual machine like VMWare?

Best regards, Walter
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2544
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Plugin: TellStick Duo

Postby krambriw » Wed Oct 26, 2011 5:13 am

New version uploaded in first post.

"# 2011-10-26 Blocking repeated events within 0.3 seconds"
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2544
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Plugin: TellStick Duo

Postby bjca » Thu Oct 27, 2011 8:15 am

Think it would be good if this "blocking" period was configurable.

The Nexa motion sensors, magnet sensors and even wall senders create bursts of events during up to 3 sec... at least according to the log in EG.
bjca
 
Posts: 5
Joined: Sun Sep 25, 2011 6:07 am

Next

Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 5 guests