From 271f779726ca4d2bec2d46c4fb0ce6e2d3366c34 Mon Sep 17 00:00:00 2001 From: tpoitzsch <> Date: Sat, 31 Jan 2015 13:06:18 +0000 Subject: [PATCH] FRITZBOX: get shellCommand git-svn-id: https://svn.fhem.de/fhem/trunk@7795 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/72_FRITZBOX.pm | 47 ++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm index 496291e71..73c2be1e7 100644 --- a/fhem/FHEM/72_FRITZBOX.pm +++ b/fhem/FHEM/72_FRITZBOX.pm @@ -131,7 +131,8 @@ sub FRITZBOX_Initialize($) $hash->{SetFn} = "FRITZBOX_Set"; $hash->{GetFn} = "FRITZBOX_Get"; $hash->{AttrFn} = "FRITZBOX_Attr"; - $hash->{AttrList} = "disable:0,1 " + $hash->{AttrList} = "allowShellCommand:0,1 " + ."disable:0,1 " ."defaultCallerName " ."defaultUploadDir " ."fritzBoxIP " @@ -418,7 +419,7 @@ sub FRITZBOX_Set($$@) ########################################## sub FRITZBOX_Get($@) { - my ($hash, $name, $cmd) = @_; + my ($hash, $name, $cmd, @val) = @_; my $returnStr; if (lc $cmd eq "ringtones") @@ -428,8 +429,14 @@ sub FRITZBOX_Get($@) $returnStr .= join "\n", sort values %ringTone; return $returnStr; } - + elsif ( lc $cmd eq "shellcommand" && int @val && AttrVal( $name, "allowShellCommand", 0 ) ) + { + my $shCmd = join " ", @val; + return FRITZBOX_Exec( $hash, $shCmd ); + } my $list = "ringTones:noArg"; + $list .= " shellCommand" + if AttrVal( $name, "allowShellCommand", 0 ); return "Unknown argument $cmd, choose one of $list"; } # end FRITZBOX_Get @@ -2676,13 +2683,26 @@ sub FRITZBOX_fritztris($)
Shows the list of ring tones that can be used.
+ +
  • get <name> shellCommand <Command> +
    + Runs the given command on the Fritz!Box shell and returns the result. + Can be used to run shell commands not included in this modul. +
    + Only available if the attribute "allowShellCommand" is set. +

  • Attributes Attributes