mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
37_harmony.pm: added duration to command
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@14318 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1404c2839e
commit
82ecb5fa62
@ -288,7 +288,8 @@ sub
|
||||
harmony_Set($$@)
|
||||
{
|
||||
my ($hash, $name, $cmd, @params) = @_;
|
||||
my ($param, $param2) = @params;
|
||||
my ($a, $h) = parseParams(\@params);
|
||||
my ($param, $param2) = @{$a};
|
||||
#$cmd = lc( $cmd );
|
||||
|
||||
my $list = "";
|
||||
@ -403,12 +404,17 @@ harmony_Set($$@)
|
||||
return "unknown command $param2" if( !$action );
|
||||
}
|
||||
|
||||
Log3 $name, 4, "$name: sending $action->{command} for ". harmony_labelOfDevice($hash, $action->{deviceId} );
|
||||
my $duration = $h->{duration};
|
||||
return "duration musst be numeric" if( defined($duration) && $duration !~ m/^([\d-.])+$/ );
|
||||
$duration = 0.1 if( !$duration || $duration < 0 );
|
||||
$duration = 5 if $duration > 5;
|
||||
|
||||
Log3 $name, 4, "$name: sending $action->{command} for ${duration}s for ". harmony_labelOfDevice($hash, $action->{deviceId} );
|
||||
|
||||
my $payload = "status=press:action={'command'::'$action->{command}','type'::'$action->{type}','deviceId'::'$action->{deviceId}'}:timestamp=0";
|
||||
harmony_sendEngineRender($hash, "holdAction", $payload);
|
||||
select(undef, undef, undef, (0.1));
|
||||
$payload = "status=release:action={'command'::'$action->{command}','type'::'$action->{type}','deviceId'::'$action->{deviceId}'}:timestamp=100";
|
||||
select(undef, undef, undef, ($duration));
|
||||
$payload = "status=release:action={'command'::'$action->{command}','type'::'$action->{type}','deviceId'::'$action->{deviceId}'}:timestamp=".$duration*1000;
|
||||
harmony_sendEngineRender($hash, "holdAction", $payload);
|
||||
|
||||
return undef;
|
||||
@ -1848,7 +1854,7 @@ harmony_decrypt($)
|
||||
switch to this activit and optionally switch to <channel></li>
|
||||
<li>channel <channel><br>
|
||||
switch to <channel> in the current activity</li>
|
||||
<li>command [<id>|<name>] <command><br>
|
||||
<li>command [<id>|<name>] <command> [duration=<duration>]<br>
|
||||
send the given ir command for the current activity or for the given device</li>
|
||||
<li>getConfig<br>
|
||||
request the configuration from the hub</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user