diff --git a/fhem/CHANGED b/fhem/CHANGED index 8cdece604..bdf91c5eb 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -2,8 +2,8 @@ # Do not insert empty lines here, update check depends on it. - feature: mailcheck: allow user and pssword as perl expression - feature: netatmo: support for public stations - - feature: PRESENCE: new set command "powerOn" to execute a Perl function - which power on the checked device (given via attribute) + - feature: PRESENCE: new set command "power" to execute a FHEM command + which can power on or off the checked device (given via attribute) - feature: readingsGroup: added valueColumn attribute - feature: readingsGroup: added ...,@,... argument format - feature: 52_I2C_PCF8574.pm: added attribute OnStartup diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm index c4701f5a9..1fda641ef 100755 --- a/fhem/FHEM/73_PRESENCE.pm +++ b/fhem/FHEM/73_PRESENCE.pm @@ -51,7 +51,7 @@ PRESENCE_Initialize($) $hash->{DefFn} = "PRESENCE_Define"; $hash->{UndefFn} = "PRESENCE_Undef"; $hash->{AttrFn} = "PRESENCE_Attr"; - $hash->{AttrList}= "do_not_notify:0,1 disable:0,1 fritzbox_repeater:0,1 ping_count:1,2,3,4,5,6,7,8,9,10 powerOnFn ".$readingFnAttributes; + $hash->{AttrList}= "do_not_notify:0,1 disable:0,1 fritzbox_repeater:0,1 ping_count:1,2,3,4,5,6,7,8,9,10 powerCmd ".$readingFnAttributes; } @@ -260,8 +260,8 @@ PRESENCE_Set($@) my $usage = "Unknown argument ".$a[1].", choose one of statusRequest"; - my $powerOnFn = AttrVal($name, "powerOnFn", undef); - $usage .= " powerOn" if(defined($powerOnFn)); + my $powerCmd = AttrVal($name, "powerCmd", undef); + $usage .= " power" if(defined($powerCmd)); if($a[1] eq "statusRequest") { @@ -283,7 +283,7 @@ PRESENCE_Set($@) } } } - elsif(defined($powerOnFn) && $a[1] eq "powerOn") + elsif(defined($powerCmd) && $a[1] eq "power") { my %specials= ( "%NAME" => $name, @@ -291,20 +291,20 @@ PRESENCE_Set($@) "%ARGUMENT" => $a[2] ); - $powerOnFn= EvalSpecials($powerOnFn, %specials); + $powerCmd= EvalSpecials($powerCmd, %specials); - Log3 $name, 5, "PRESENCE ($name) - executing powerOnFn: $powerOnFn"; - eval $powerOnFn; + Log3 $name, 5, "PRESENCE ($name) - executing powerCmd: $powerCmd"; + my $return = AnalyzeCommandChain(undef, $powerCmd); - if($@) + if($return) { - Log3 $name, 3, "PRESENCE ($name) - executed powerOnFn failed: ".$@; - readingsSingleUpdate($hash, "powerOnFn", "failed",1); - return "executed powerOnFn failed: ".$@; + Log3 $name, 3, "PRESENCE ($name) - executed powerCmd failed: ".$return; + readingsSingleUpdate($hash, "powerCmd", "failed",1); + return "executed powerCmd failed: ".$return; } else { - readingsSingleUpdate($hash, "powerOnFn", "executed",1); + readingsSingleUpdate($hash, "powerCmd", "executed",1); } return undef; @@ -1133,7 +1133,7 @@ Options: Set
@@ -1165,18 +1165,24 @@ Options: Possible values: 0 => Use default recognition, 1 => Use repeater-supported recognition
Default Value is 0 (Use default recognition)

-
  • powerOnFn

  • - Define a Perl statement, which powers on the device.

    +
  • powerCmd

  • + Define a FHEM command, which powers on or off the device.

    - When executing the powerOnFn (set command: powerOn) following placeholders will be replaced by there corresponding values:

    + When executing the powerCmd (set command: power) following placeholders will be replaced by there corresponding values:


    - Example: powerOn("%ADDRESS", "username", "password") + Example FHEM commands:

    + +
    @@ -1185,7 +1191,7 @@ Options: General Events:



    Bluetooth specific events:


    @@ -1427,7 +1439,7 @@ Options: Generelle Events:



    Bluetooth-spezifische Events: