Page 1 of 1

Detecting TellStick

Posted: Fri Mar 17, 2023 9:45 am
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.

Re: Detecting TellStick

Posted: Fri Mar 17, 2023 9:45 am
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.

Re: Detecting TellStick

Posted: Fri Mar 17, 2023 9:45 am
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.

Re: Detecting TellStick

Posted: Fri Mar 17, 2023 9:45 am
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.

Re: Detecting TellStick

Posted: Fri Mar 17, 2023 9:45 am
by micke.prag