diff --git a/fhem/FHEM/74_Unifi.pm b/fhem/FHEM/74_Unifi.pm index 64b13a7c4..765fc6b29 100644 --- a/fhem/FHEM/74_Unifi.pm +++ b/fhem/FHEM/74_Unifi.pm @@ -271,6 +271,7 @@ sub Unifi_Notify($$) { } for my $clientID (keys %{$hash->{clients}}) { my $clientName=$hash->{clients}->{$clientID}->{name}."_"; + # TODO: Prü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"}); diff --git a/fhem/FHEM/74_UnifiClient.pm b/fhem/FHEM/74_UnifiClient.pm index 417b7d379..d1ff539d3 100755 --- a/fhem/FHEM/74_UnifiClient.pm +++ b/fhem/FHEM/74_UnifiClient.pm @@ -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: - 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.
  • set <name> clear <readings|usedOnlineTime>
    Clears the readings or set the usedOnlimeTime=0.
  • +
    +
  • set <name> blockClient <
    + Blocks the client.
  • +
    +
  • set <name> unblockClient <
    + Unblocks the client.
  • +
    +
  • set <name> usergroup <
    + Set the usergroup for the client.
  • +
    +
  • set <name> update <
    + Updates the client data.
  • +

Get

    -
  • get <name> todo
    - todo.
  • +
  • get <usergroups> todo
    + Show information about the configuered usergroups in UnifiController.

diff --git a/fhem/FHEM/74_UnifiSwitch.pm b/fhem/FHEM/74_UnifiSwitch.pm index 8535070db..4ecbee993 100755 --- a/fhem/FHEM/74_UnifiSwitch.pm +++ b/fhem/FHEM/74_UnifiSwitch.pm @@ -280,7 +280,7 @@ sub UnifiSwitch_Parse($$) { else{ # Keine Gerätedefinition verfügbar # Daher Vorschlag define-Befehl: - 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"; } }