Get started

Moderator: Telldus

Post Reply
Wickedtunez
Posts: 4
Joined: Fri Mar 17, 2023 9:45 am
Location: Amsterdam, the Netherlands

Get started

Post by Wickedtunez »

Hi,

Could you tell me where to find documentation about programming TellStick? The Telldus Center works fine, and I would like to create and control stuff from code. I use the TellStick.Net project as base. How do I create a new KlikAanKlikUit device and set the device-group to 'K'? Can this be done outside telldus center?

Thanks,

Jeroen.
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Post by micke.prag »

Micke Prag
Software
Telldus Technologies
Wickedtunez
Posts: 4
Joined: Fri Mar 17, 2023 9:45 am
Location: Amsterdam, the Netherlands

Post by Wickedtunez »

Thanks. What I was looking for was the documentation on how to create a new KlikAanKlikUit device and set the device-group to 'K' from code, not the setup. I create a new interface around the management of devices using c#, can this work:

int deviceId = TellStick.Native.devAddDevice();
TellStick.Native.devSetArguments(deviceId, new int[] { SOMETHINGHERE }, .. );

Which arguments are used for KlikAanKlikUit and how do I set the group to K?

Best regards,

Jeroen.
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Post by micke.prag »

As you can see here, there is no functions called devSetArguments() and devAddDevice(). Those are only in our 1.x API.

I strongly advice you not to add your own devices in the software. This is stated in the documentation:
All of the devices used by TellStick must be predefined before they can be used in any software. Under all platforms this can be done with the software TelldusCenter but under Linux this can also be done by editing the file /etc/tellstick.conf with your favorite text editor.

Having the devices preconfigured is an advantage to both the developer and the end user.
  • The end user might use more then one program for controling his/hers TellStick. By having the devices preconfigured he/she doesn't have to reconfigure the same devices twice. If some settings changes in one of the devices, this change will affect all softwares using Telldus TellStick SDK.
  • Telldus is adding support for new devices constantly. If every software defines it's own devices it will also mean that the developer has to keep it's software up to date with all the new devices and settings Telldus implements. By querying Telldus Tellstick SDK all the new devices will be available automaticly to the end user.
Especially the last item. If you only support KlikAanKlikUit, users of other types of devices cannot use your software.

If you still insist on adding a KlikAanKlikUit-device, this is how it can be done:

Code: Select all

int id = tdAddDevice();
tdSetName(id, "Dummy device");
tdSetProtocol(id, "arctech");
tdSetModel(id, "codeswitch");
tdSetDeviceParameter(id, "house", "K");
tdSetDeviceParameter(id, "unit", "1");
This is C-code, how to do the same in C# is up to you to figure out.

Please also not that using functions outside the documentation is unsupported and the behavior could be changed without notice.
Micke Prag
Software
Telldus Technologies
Wickedtunez
Posts: 4
Joined: Fri Mar 17, 2023 9:45 am
Location: Amsterdam, the Netherlands

Post by Wickedtunez »

Thanks, this is exactly what I was looking for. I understand the implications of using this approach, but it is needed for the solution I provide as a lot more types of devices are supported and I do not want our users to have to learn a separate configuration environment for all those devices.

Is there any documentation on the available protocols, models etc. Would it be possible to create enums instead of those String values? I cannot find this in the sourcecode.

Would you be willing to support an interfae which telldus center uses and developers like me can use in their solutions? If you supply the necessary information I will create the interface and implementation in C#, you could use this a base for a C++ version.

Best regards,

Jeroen.
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Post by micke.prag »

Wickedtunez wrote:Is there any documentation on the available protocols, models etc. Would it be possible to create enums instead of those String values? I cannot find this in the sourcecode.
Unfortunatly we do not have that documentation today. You may get an idea by looking at the the function Manager::getDevice()

We cannot use an enum either since the implementation is different depending on the platform you are using. Linux, for example, uses a plain config file which uses the strings directly.
Micke Prag
Software
Telldus Technologies
Wickedtunez
Posts: 4
Joined: Fri Mar 17, 2023 9:45 am
Location: Amsterdam, the Netherlands

Post by Wickedtunez »

I have created a C# wrapper around tellduscore.dll and am working on some classes to make it easier to work with telldus from C#. If there are other users who can use this, it might help to add this project to your codebase..

example:

Code: Select all

TelldusCoreWrapper.RemoveAllDevices();

TDDevice device = new TDDeviceNexa("LivingRoom", "K", 3);
device.AddDevice();

device.TurnOn();
Thread.Sleep(1000);
device.TurnOff();
Regards,

Jeroen
Post Reply