mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
added: :noArg to setList-definitions
git-svn-id: https://svn.fhem.de/fhem/trunk@3626 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a0a8f0c718
commit
75e26e5595
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
#use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use POSIX;
|
use POSIX;
|
||||||
use CGI qw(:standard);
|
use CGI qw(:standard);
|
||||||
@ -72,7 +72,7 @@ sub LISTENLIVE_Undefine($$);
|
|||||||
sub HMT350_RCLayout();
|
sub HMT350_RCLayout();
|
||||||
sub HMT350_RCmakenotify($$);
|
sub HMT350_RCmakenotify($$);
|
||||||
|
|
||||||
%HMT350_RCtranslate = (
|
my %HMT350_RCtranslate = (
|
||||||
home => "HOME",
|
home => "HOME",
|
||||||
volplus => "VOLp",
|
volplus => "VOLp",
|
||||||
volmin => "VOLm",
|
volmin => "VOLm",
|
||||||
@ -148,7 +148,9 @@ LISTENLIVE_Set($@)
|
|||||||
my $cmdGroup = $a[1];
|
my $cmdGroup = $a[1];
|
||||||
my $cmd = $a[2];
|
my $cmd = $a[2];
|
||||||
|
|
||||||
my $usage = "Unknown argument, choose one of help statusRequest power:on,off audio:volp,volm,mute,unmute cursor:up,down,left,right,enter,exit,home,ok reset:power,mute,menupos app:weather raw user";
|
my $usage = "Unknown argument, choose one of help:noArg statusRequest:noArg ".
|
||||||
|
"power:on,off audio:volp,volm,mute,unmute cursor:up,down,left,right,enter,exit,home,ok ".
|
||||||
|
"reset:power,mute,menupos app:weather raw user";
|
||||||
|
|
||||||
given ($cmdGroup){
|
given ($cmdGroup){
|
||||||
|
|
||||||
@ -159,6 +161,7 @@ LISTENLIVE_Set($@)
|
|||||||
|
|
||||||
when("rc"){
|
when("rc"){
|
||||||
|
|
||||||
|
my ($c, $g);
|
||||||
$g = "raw";
|
$g = "raw";
|
||||||
# prüfen ob Befehl in Kleinbuchstaben,
|
# prüfen ob Befehl in Kleinbuchstaben,
|
||||||
# wenn ja => übersetzen!
|
# wenn ja => übersetzen!
|
||||||
@ -181,6 +184,7 @@ LISTENLIVE_Set($@)
|
|||||||
|
|
||||||
if(defined($cmd)){
|
if(defined($cmd)){
|
||||||
Log $loglevel, "LISTENLIVE $name input: $cmdGroup $cmd";
|
Log $loglevel, "LISTENLIVE $name input: $cmdGroup $cmd";
|
||||||
|
no strict 'refs';
|
||||||
$result = &{$cmd};
|
$result = &{$cmd};
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdate($hash, "lastCmd","$cmdGroup $cmd");
|
readingsBulkUpdate($hash, "lastCmd","$cmdGroup $cmd");
|
||||||
@ -240,6 +244,7 @@ LISTENLIVE_Set($@)
|
|||||||
|
|
||||||
when("power"){
|
when("power"){
|
||||||
|
|
||||||
|
my $xCmd;
|
||||||
Log $loglevel, "LISTENLIVE $name input: $cmdGroup $cmd";
|
Log $loglevel, "LISTENLIVE $name input: $cmdGroup $cmd";
|
||||||
if($pstat ne $cmd) {
|
if($pstat ne $cmd) {
|
||||||
$xCmd = $powerGroup{$cmd};
|
$xCmd = $powerGroup{$cmd};
|
||||||
@ -249,6 +254,9 @@ LISTENLIVE_Set($@)
|
|||||||
readingsBulkUpdate($hash, "lastCmd","$cmdGroup $cmd");
|
readingsBulkUpdate($hash, "lastCmd","$cmdGroup $cmd");
|
||||||
readingsBulkUpdate($hash, "lastResult",$result);
|
readingsBulkUpdate($hash, "lastResult",$result);
|
||||||
readingsBulkUpdate($hash, "power",$cmd);
|
readingsBulkUpdate($hash, "power",$cmd);
|
||||||
|
if($cmd eq "on"){
|
||||||
|
readingsBulkUpdate($hash, "mute", "off");
|
||||||
|
}
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
} else {
|
} else {
|
||||||
LISTENLIVE_rbuError($hash, $cmdGroup, $cmd);
|
LISTENLIVE_rbuError($hash, $cmdGroup, $cmd);
|
||||||
@ -267,15 +275,17 @@ LISTENLIVE_Set($@)
|
|||||||
|
|
||||||
Log $loglevel, "LISTENLIVE $name input: $cmdGroup $cmd";
|
Log $loglevel, "LISTENLIVE $name input: $cmdGroup $cmd";
|
||||||
if($mute ne $cmd) {
|
if($mute ne $cmd) {
|
||||||
$xCmd = $audioGroup{$cmd};
|
my $xCmd = $audioGroup{$cmd};
|
||||||
$result = LISTENLIVE_SendCommand($hash, $xCmd);
|
$result = LISTENLIVE_SendCommand($hash, $xCmd);
|
||||||
if($result =~ m/OK/){
|
if($result =~ m/OK/){
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdate($hash, "lastCmd","$cmdGroup $cmd");
|
readingsBulkUpdate($hash, "lastCmd","$cmdGroup $cmd");
|
||||||
readingsBulkUpdate($hash, "lastResult",$result);
|
readingsBulkUpdate($hash, "lastResult",$result);
|
||||||
#
|
if($cmd eq "mute"){
|
||||||
# ToDo: set mute state
|
readingsBulkUpdate($hash, "mute", "on");
|
||||||
#
|
} else {
|
||||||
|
readingsBulkUpdate($hash, "mute", "off");
|
||||||
|
}
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
} else {
|
} else {
|
||||||
LISTENLIVE_rbuError($hash, $cmdGroup, $cmd);
|
LISTENLIVE_rbuError($hash, $cmdGroup, $cmd);
|
||||||
@ -291,9 +301,9 @@ LISTENLIVE_Set($@)
|
|||||||
#
|
#
|
||||||
|
|
||||||
when("cursor"){
|
when("cursor"){
|
||||||
|
|
||||||
Log $loglevel, "LISTENLIVE: $name input: $cmdGroup $cmd";
|
Log $loglevel, "LISTENLIVE: $name input: $cmdGroup $cmd";
|
||||||
$xCmd = $cursorGroup{$cmd};
|
my $xCmd = $cursorGroup{$cmd};
|
||||||
$result = LISTENLIVE_SendCommand($hash, $xCmd);
|
$result = LISTENLIVE_SendCommand($hash, $xCmd);
|
||||||
if($result =~ m/OK/){
|
if($result =~ m/OK/){
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
@ -361,7 +371,7 @@ LISTENLIVE_Get($@){
|
|||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $address = $hash->{helper}{ADDRESS};
|
my $address = $hash->{helper}{ADDRESS};
|
||||||
my $response;
|
my ($response, $usage);
|
||||||
|
|
||||||
return "No Argument given" if(!defined($a[1]));
|
return "No Argument given" if(!defined($a[1]));
|
||||||
|
|
||||||
@ -409,7 +419,7 @@ LISTENLIVE_Define($$){
|
|||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $presence;
|
my ($cmd, $presence, $ret);
|
||||||
|
|
||||||
if(! @a >= 4){
|
if(! @a >= 4){
|
||||||
my $msg = "wrong syntax: define <name> LISTENLIVE <ip-or-hostname>[:<port>] [<interval>]";
|
my $msg = "wrong syntax: define <name> LISTENLIVE <ip-or-hostname>[:<port>] [<interval>]";
|
||||||
@ -610,13 +620,13 @@ LISTENLIVE_Undefine($$){
|
|||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub HMT350_RCmakenotify($$) {
|
sub HMT350_RCmakenotify($$) {
|
||||||
my $loglevel = GetLogLevel($name, 3) unless(defined($loglevel));
|
# my $loglevel = GetLogLevel($name, 3) unless(defined($loglevel));
|
||||||
my ($nam, $ndev) = @_;
|
my ($nam, $ndev) = @_;
|
||||||
my $nname="notify_$nam";
|
my $nname="notify_$nam";
|
||||||
my $cmd = "$nname notify $nam set $ndev rc \$EVENT";
|
my $cmd = "$nname notify $nam set $ndev rc \$EVENT";
|
||||||
my $ret = CommandDefine(undef, $cmd);
|
my $ret = CommandDefine(undef, $cmd);
|
||||||
if($ret) { Log 2, "remotecontrol ERROR $ret"; }
|
if($ret) { Log 2, "remotecontrol ERROR $ret"; }
|
||||||
else { Log $loglevel, "remotecontrol HMT350: $nname created as notify"; }
|
else { Log 3, "remotecontrol HMT350: $nname created as notify"; }
|
||||||
return "Notify created: $nname";
|
return "Notify created: $nname";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user