diff --git a/fhem/FHEM/98_telnet.pm b/fhem/FHEM/98_telnet.pm
index e3c9b4a42..fd91ff5e3 100644
--- a/fhem/FHEM/98_telnet.pm
+++ b/fhem/FHEM/98_telnet.pm
@@ -383,14 +383,17 @@ telnet_ActivateInform($)
IAC requests to supress echo while entering the password.
Also all returned lines are terminated with \r\n.
Example:
+
attr tPort password secret
- attr tPort password {use FritzBoxUtils;;FB_checkPw("localhost","$password") }
-
- or if you defined multiple users on the Fritzbox:
-
- attr tPort password {use FritzBoxUtils;;FB_checkPw("localhost","$user", "$password") }
+ attr tPort password {"$password" eq "secret"}
+
+ Note: if this attribute is set, you have to specify a password as the
+ first argument when using fhem.pl in client mode:
+
+ perl fhem.pl localhost:7072 secret "set lamp on"
+
diff --git a/fhem/docs/commandref_frame.html b/fhem/docs/commandref_frame.html
index aee2cb857..aa8fdc902 100644
--- a/fhem/docs/commandref_frame.html
+++ b/fhem/docs/commandref_frame.html
@@ -178,7 +178,7 @@ telnet) or single client command (via fhem.pl). Example:
or
- fhem.pl <fhemhost>:7072 "<command>..."
+ fhem.pl <fhemhost>:7072 "<fhem-command>" "..."
diff --git a/fhem/fhem.pl b/fhem/fhem.pl
index 89492bd25..2157d828c 100755
--- a/fhem/fhem.pl
+++ b/fhem/fhem.pl
@@ -286,10 +286,10 @@ $readingFnAttributes = "event-on-change-reading event-on-update-reading ".
###################################################
# Start the program
-if(int(@ARGV) != 1 && int(@ARGV) != 2) {
+if(int(@ARGV) < 1) {
print "Usage:\n";
print "as server: fhem configfile\n";
- print "as client: fhem [host:]port cmd\n";
+ print "as client: fhem [host:]port cmd cmd cmd...\n";
CommandHelp(undef, undef);
exit(1);
}
@@ -324,15 +324,20 @@ if($^O !~ m/Win/ && $< == 0) {
###################################################
# Client code
-if(int(@ARGV) == 2) {
+if(int(@ARGV) > 1) {
my $buf;
- my $addr = $ARGV[0];
- $addr = "localhost:$addr" if($ARGV[0] !~ m/:/);
+ my $addr = shift @ARGV;
+ $addr = "localhost:$addr" if($addr !~ m/:/);
my $client = IO::Socket::INET->new(PeerAddr => $addr);
die "Can't connect to $addr\n" if(!$client);
- syswrite($client, "$ARGV[1] ; quit\n");
+ for(my $i=0; $i < int(@ARGV); $i++) {
+ syswrite($client, $ARGV[$i]."\n");
+ }
shutdown($client, 1);
while(sysread($client, $buf, 256) > 0) {
+ $buf =~ s/\xff\xfb\x01Password: //;
+ $buf =~ s/\xff\xfc\x01\r\n//;
+ $buf =~ s/\xff\xfd\x00//;
print($buf);
}
exit(0);
@@ -576,6 +581,8 @@ sub
Log3($$$)
{
my ($dev, $loglevel, $text) = @_;
+
+ $dev = $dev->{NAME} if(defined($dev) && ref($dev) eq "HASH");
if(defined($dev) &&
defined($attr{$dev}) &&