Detecting TellStick

Moderator: Telldus

Post Reply
PaulMcGowan
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Detecting TellStick

Post by PaulMcGowan »

Is there anyway I can check if a TellStick is connected without issuing an ON/OFF command ?

If I do a 'tdtool --list' I get a list of known switches whether or not the TellStick is connected.

Is there a 'tdtool --status' command that says whether a TellStick is connected ?

I'm currently having to read the USB device list for 'TellStick', but it would be nice if tdtool did this.
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Re: Detecting TellStick

Post by micke.prag »

There will be functions in the API for this in the next versions of the software. Currently there is no functions for it.
Micke Prag
Software
Telldus Technologies
PaulMcGowan
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: Detecting TellStick

Post by PaulMcGowan »

OK, thanks Micke.....

I downloaded the source and hacked a quick 'status' option into tdtool, it does what I need.

Code: Select all

C:\Program Files\Telldus\tdtool --status

TellStick connected
C:\
And when the TellStick is unplugged

Code: Select all

C:\Program Files\Telldus\tdtool --status

TellStick disconnected
C:\
I kept the output simple as I use PHP to run the script, and I get a simple 2 part array returned [0]=TellStick and [1]=connected/disconnected. Does just what I need.
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Re: Detecting TellStick

Post by micke.prag »

You could parhaps return one of the error-codes from tdtool?
TELLSTICK_SUCCESS if the TellStick is found, TELLSTICK_ERROR_NOT_FOUND if it's not.

That would make it even easier to parse from a script.
Micke Prag
Software
Telldus Technologies
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Re: Detecting TellStick

Post by micke.prag »

Micke Prag
Software
Telldus Technologies
Post Reply