Tellstick command delay

Moderator: Telldus

Post Reply
Mikahi
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am
Location: Mikkeli, Finland

Tellstick command delay

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

Hi,

I have a TellStick and Nexa receiver and environment is Ubuntu. If I send commands via Terminal, they work as I expect but they take a relative long time to finish. For example command tdtool --on 1 will take anything from 800ms to 2000ms to complete. I can see the execution time by using time command, like time tdtool --on 1. Is this normal and is there a way to avoid long execution time, right now my application freezes for that time period.

Thanks in advance!
Mika

polarlight
Posts: 4
Joined: Thu Jan 18, 2018 11:08 am
Location: Finland

Re: Tellstick command delay

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

In my single board Linux computer (Debian Squeeze, ARM9 @ 450MHz) there are similar results
as you can see below.
This is because the RF baud rate (or bit speed) is extremely low for these cheap 433.92MHz
RF-control devices. One study implied that Arctech protocol used by Nexa uses
air speed of 2.8ms/bit and 12+ bits are needed for one transmission..for self learning
protocol much more . Each packet is sent possibly four or more times. This adds up
into anything betweeen 140 - 1000 milliseconds easily.

root@tuxrail:~# time tdtool --off 3
Turning off device 3, Irtorasia - Success

real 0m1.599s
user 0m0.030s
sys 0m0.020s
root@tuxrail:~# time tdtool --on 3
Turning on device 3, Irtorasia - Success

real 0m1.598s
user 0m0.020s
sys 0m0.020s
---------
DreamPlug*2/Debian Squeeze (ARM9) , TuxRail*1/Debian Squeeze (ARM9), Win7 Ultimate 64-bit @Intel Core i7-980x, GA-X58A-UD7, 12GB DDR3, Intel510 250GB SSD, AMD HD 6990, 2TB WDGreen HD, APC SmartUPS 1500VA, 27"ACER LED, ...

Mikahi
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am
Location: Mikkeli, Finland

Re: Tellstick command delay

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

Hi,

Thanks for reply, seems that this is just a feature we must live with.

I managed to build a workaround for my case. I made a simple c program that will take advantage of a child process to handle this time consuming part. Fork() instruction is used. I can use it similar way as tdtool and it will take just 4-20ms to complete. Now calling application doesn't freeze anymore.
Mika

davka003
Posts: 187
Joined: Thu Jan 18, 2018 11:08 am
Location: Sweden
Contact:

Re: Tellstick command delay

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

Hi
In the Swedish part of the Linux forum I have experimented with this fork and no fork in the situation where I need to command several devices. Perhaps you are interested in that.

What I do i compare the different of:
tdtool --on 1
tdtool --on 1
... repeted 20 and 100 times

compared to
tdtool --on 1 --on 1 ... repeted 20 and 100 times

Time in seconds per command (average over 100 commands)
One instance of tdtool per command : 1.95
One instance of tdtool for all commands: 0.94

Time in seconds per command (average over 20 commands)
One instance of tdtool per command : 1.98
One instance of tdtool for all commands: 1.48

B.R.
David
My home automation software: Automagically @ Raspberry Pi http://automagically.weebly.com

Post Reply