74_Unifi: fixed loglevel

git-svn-id: https://svn.fhem.de/fhem/trunk@19422 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
wuehler
2019-05-20 18:53:51 +00:00
parent 9e4187a237
commit aaa3e68a97
3 changed files with 29 additions and 10 deletions

View File

@@ -271,6 +271,7 @@ sub Unifi_Notify($$) {
}
for my $clientID (keys %{$hash->{clients}}) {
my $clientName=$hash->{clients}->{$clientID}->{name}."_";
# TODO: Pr<50>fen, ob es f<>r $clientName ein UnifiClient-Devices gibt und die Werte aus den Readings des UnifiClients wiederherstellen.
for my $readingName (keys %{$hash->{READINGS}}) {
#Log3 $name, 1, "$name ($self) - checking 2 $readingName for $clientName";
if($readingName =~ m/^$clientName.*/){
@@ -791,6 +792,8 @@ sub Unifi_Write($@){
Unifi_UnblockClient_Send($hash, $id); # id=mac
}elsif($type eq "Unifi_UserRestJson_Send"){
Unifi_UserRestJson_Send($hash, $id, $data); # id=_id
}elsif($type eq "Unifi_UpdateClient_Send"){
Unifi_UpdateClient_Send($hash, $id); # id=mac
}
return undef;
@@ -1073,7 +1076,7 @@ sub Unifi_UpdateClient_Receive($) {
}
}
readingsBeginUpdate($hash);
Unifi_setClientReadings($hash);
Unifi_SetClientReadings($hash);
readingsEndUpdate($hash,1);
}
}
@@ -1878,7 +1881,7 @@ sub Unifi_WlanconfRest_Send($$@) {
sub Unifi_WlanconfRest_Receive($) {
my ($param, $err, $data) = @_;
my ($name,$self,$hash) = ($param->{hash}->{NAME},Unifi_Whoami(),$param->{hash});
Log3 $name, 3, "$name ($self) - executed.";
Log3 $name, 5, "$name ($self) - executed.";
if ($err ne "") {
Unifi_ReceiveFailure($hash,{rc => 'Error while requesting', msg => $param->{url}." - $err"});
@@ -1949,7 +1952,7 @@ sub Unifi_GetVoucherList_Receive($) {
my $setCmd=$hash->{hotspot}->{voucherCache}->{$cache}->{setCmd};
my @words=split("[ \t][ \t]*", $setCmd);
my %params=("expire"=>$words[0],"n"=>$words[1],"quota"=>$words[2],"note"=>$words[3]);
Log3 $name, 3, "$name ($self) - expand VoucherCache ($cache).";
Log3 $name, 4, "$name ($self) - expand VoucherCache ($cache).";
Unifi_CreateVoucher_Send($hash, %params);
$expand=1;
}
@@ -1985,7 +1988,7 @@ sub Unifi_CreateVoucher_Send($%) {
sub Unifi_CreateVoucher_Receive($) {
my ($param, $err, $data) = @_;
my ($name,$self,$hash) = ($param->{hash}->{NAME},Unifi_Whoami(),$param->{hash});
Log3 $name, 3, "$name ($self) - executed.";
Log3 $name, 5, "$name ($self) - executed.";
if ($err ne "") {
Unifi_ReceiveFailure($hash,{rc => 'Error while requesting', msg => $param->{url}." - $err"});

View File

@@ -166,12 +166,13 @@ sub UnifiClient_Set($@){
}
}
$usergroups =~ s/.$//;
if($setName !~ /clear|blockClient|unblockClient|usergroup/) {
if($setName !~ /clear|blockClient|unblockClient|usergroup|update/) {
return "Unknown argument $setName, choose one of "
."clear:readings,usedOnlineTime "
.(($hash->{unifiClient}->{blocked} eq JSON::false) ? "blockClient:noArg " : "")
.(($hash->{unifiClient}->{blocked} eq JSON::true) ? "unblockClient:noArg " : "")
.(($usergroups ne "") ? "usergroup:$usergroups" : "");
.(($usergroups ne "") ? "usergroup:$usergroups" : "")
.((defined $hash->{unifiClient}->{mac}) ? " update:noArg" :"");
} elsif ($setName eq 'clear') {
if ($setVal eq 'readings') {
for (keys %{$hash->{READINGS}}) {
@@ -201,6 +202,8 @@ sub UnifiClient_Set($@){
$clientnameUC = $hash->{unifiClient}->{hostname};
}
IOWrite($hash, "Unifi_UserRestJson_Send", $hash->{unifiClient}->{_id},"{\"usergroup_id\":\"".$usergroupID."\",\"name\":\"".$clientnameUC."\"}");
} elsif ($setName eq 'update') {
IOWrite($hash, "Unifi_UpdateClient_Send", $hash->{unifiClient}->{mac});
}
return undef;
}
@@ -317,7 +320,7 @@ sub UnifiClient_Parse($$) {
else{
# Keine Gerätedefinition verfügbar
# Daher Vorschlag define-Befehl: <NAME> <MODULNAME> <ADDRESSE>
Log3 $name, 3, "$name ($self) - return: UNDEFINED UnifiClient_".$address." UnifiClient $address";
Log3 $name, 4, "$name ($self) - return: UNDEFINED UnifiClient_".$address." UnifiClient $address";
#return "UNDEFINED ".$address." UnifiClient $address";
# lieber kein autocreate ;-)
return undef;
@@ -401,12 +404,25 @@ You can use the readings or set features to control your clients.
<ul>
<li><code>set &lt;name&gt; clear &lt;readings|usedOnlineTime&gt;</code><br>
Clears the readings or set the usedOnlimeTime=0. </li>
<br>
<li><code>set &lt;name&gt; blockClient &lt;</code><br>
Blocks the client. </li>
<br>
<li><code>set &lt;name&gt; unblockClient &lt;</code><br>
Unblocks the client. </li>
<br>
<li><code>set &lt;name&gt; usergroup &lt;</code><br>
Set the usergroup for the client. </li>
<br>
<li><code>set &lt;name&gt; update &lt;</code><br>
Updates the client data. </li>
<br>
</ul>
<h4>Get</h4>
<ul>
<li><code>get &lt;name&gt; todo</code><br>
todo.</li>
<li><code>get &lt;usergroups&gt; todo</code><br>
Show information about the configuered usergroups in UnifiController.</li>
<br>
</ul>

View File

@@ -280,7 +280,7 @@ sub UnifiSwitch_Parse($$) {
else{
# Keine Gerätedefinition verfügbar
# Daher Vorschlag define-Befehl: <NAME> <MODULNAME> <ADDRESSE>
Log3 $name, 3, "$name ($self) - return: UNDEFINED UnifiSwitch_".$address." UnifiSwitch $address";
Log3 $name, 4, "$name ($self) - return: UNDEFINED UnifiSwitch_".$address." UnifiSwitch $address";
return "UNDEFINED ".$address." UnifiSwitch $address";
}
}