Raw codes from TelldusCenter?

Moderator: Telldus

Post Reply
boxed
Posts: 5
Joined: Thu Jan 18, 2018 11:08 am

Raw codes from TelldusCenter?

Post by boxed » Thu Jan 18, 2018 11:08 am

I would like to write some custom software for my home automation devices with the tellstick, but the problem I am having is that there is a big disconnect between the things I see in TelldusCenter and what is available in the APIs I see on the open source part of the web page. In TelldusCenter it took me just a few seconds to configure my specific devices and everything works. In the API however I have no idea what matches to what. It would be extremely helpful if TelldusCenter could give me the protocol names and also device codes of certain commands to ease development.

For example I have bought some devices which say "Everflourish" on the back. But in TelldusCenter they are listed under GAO. This is a bit confusing and took some googling to understand it's the same thing. Then I figured out that the code to calculate the actual commands can be found in this file: http://developer.telldus.se/browser/tru ... ourish.cpp. It would be helpful if TelldusCenter could output the codes it sends at least to the console so I can just copy paste them from there and directly use in my own software. Or alternatively I can check that the commands my code generates are the same as those TelldusCenter produces.

micke.prag
Site Admin
Posts: 2216
Joined: Thu Jan 18, 2018 11:08 am
Location: Lund
Contact:

Re: Raw codes from TelldusCenter?

Post by micke.prag » Thu Jan 18, 2018 11:08 am

I can't really see how you are going to use the codes in your software?

You can get the protocol and the model from these API-calls:
tdGetProtocol()
tdGetModel()
Micke Prag
Software
Telldus Technologies

boxed
Posts: 5
Joined: Thu Jan 18, 2018 11:08 am

Re: Raw codes from TelldusCenter?

Post by boxed » Thu Jan 18, 2018 11:08 am

If I opened the device and sent the codes myself. There is a function tdSendRawCommand() after all.

Ok, so the devices configured in TelldusCenter will automatically be available from any script I write using your dlls? And the ID is what? A 0-based index from what I see in the GUI? Wouldn't that imply that the "IDs" that you send to functions like tdGetProtocol() are in fact not IDs but just an index, meaning that if you remove the first entry in your device list all the "IDs" now are changed by one?

micke.prag
Site Admin
Posts: 2216
Joined: Thu Jan 18, 2018 11:08 am
Location: Lund
Contact:

Re: Raw codes from TelldusCenter?

Post by micke.prag » Thu Jan 18, 2018 11:08 am

You cannot just simply send the protocol to tdSendRawCommand(). You must encode the protocol by yourself if you use tdSendRawCommad(). We greatly discourage you from using tdSendRawCommand() in your software. Using that function will make your users only use devices you implement in your software.
By using the preconfigured devices your software will be able to use all of the current (and future!) protocols implemented by Telldus.

The IDs are IDs and not indexes! You may not use the IDs as an index. The IDs are unique and is safe for storage and will not be reused, even if you remove a device.

Please have a look the following example (taken from here) how to list the devices:

Code: Select all

int intNumberOfDevices = tdGetNumberOfDevices();
 for (int i = 0; i < intNumberOfDevices; i++) {
   int id = tdGetDeviceId( index );
   char *name = tdGetName( id );
   printf("%d\t%s\n", id, name);
   tdReleaseString(name);
 }
Micke Prag
Software
Telldus Technologies

boxed
Posts: 5
Joined: Thu Jan 18, 2018 11:08 am

Re: Raw codes from TelldusCenter?

Post by boxed » Thu Jan 18, 2018 11:08 am

Ah ok. Thank you, that clarifies everything.

Post Reply