diff --git a/fhem/CHANGED b/fhem/CHANGED index bca4d8f8d..dbb6212b9 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - change: 74_Unifi: changed readings -UC_newClients and -AP_utilization - bugfix: 36_WMBUS: fix decryption for AES CBC mode - feature: 42_AptToDate: add dist-upgrade available with Attribut - change: 74_XiaomiBTLESens: more debug messages, delete old batteryreadings diff --git a/fhem/FHEM/74_Unifi.pm b/fhem/FHEM/74_Unifi.pm index ae33f6136..91c049069 100644 --- a/fhem/FHEM/74_Unifi.pm +++ b/fhem/FHEM/74_Unifi.pm @@ -35,10 +35,13 @@ # - fixed: 74_Unifi: Minor bugfix in notify-function # V 3.0.3 # - fixed: 74_Unifi: Minor loglevel-bugfix +# V 3.0.4 +# - fixed: 74_Unifi: Readingname -UC_newClients with leading - +# - changed: 74_Unifi: Reading(name) for Utilization of APs with UC V 5.7/8.x package main; -my $version="3.0.3"; +my $version="3.0.4"; use strict; use warnings; use HttpUtils; @@ -1249,7 +1252,7 @@ sub Unifi_SetClientReadings($) { readingsBulkUpdate($hash,$clientName,'disconnected'); } } - readingsBulkUpdate($hash,"UC_newClients",$newClients); + readingsBulkUpdate($hash,"-UC_newClients",$newClients); return undef; } @@ -1273,13 +1276,15 @@ sub Unifi_SetAccesspointReadings($) { my ($hash) = @_; my ($name,$self) = ($hash->{NAME},Unifi_Whoami()); Log3 $name, 5, "$name ($self) - executed."; - + my ($apName,$apRef,$essid); + my $utiliz; for my $apID (keys %{$hash->{accespoints}}) { $essid = ''; + $utiliz = ''; $apRef = $hash->{accespoints}->{$apID}; $apName = ($apRef->{name}) ? $apRef->{name} : $apRef->{ip}; - + if (defined $apRef->{vap_table} && scalar @{$apRef->{vap_table}}) { for my $vap (@{$apRef->{vap_table}}) { $essid .= makeReadingName($vap->{essid}).','; @@ -1288,11 +1293,22 @@ sub Unifi_SetAccesspointReadings($) { } else { my $essid = 'none'; } - + + #nochmal genauer ins json schauen, ob hier wirklich eine Schleife notwendig ist. (cu_total mehrfach vorhanden? + if (defined $apRef->{'radio_table_stats'} ) { + for my $rts (@{$apRef->{'radio_table_stats'}}) { + $utiliz .= makeReadingName($rts->{'cu_total'}).','; # TODO: hier nicht unbedingt notwendig, aufgrund des funktionierenden schnellen fixes wegen neuer controller-Version bleibt es aber erstmal so drin. + } + $utiliz =~ s/.$//; + } else { + my $utiliz = 'none'; + } + readingsBulkUpdate($hash,'-AP_'.$apName.'_state',($apRef->{state} == 1) ? 'ok' : 'error'); readingsBulkUpdate($hash,'-AP_'.$apName.'_clients',$apRef->{'num_sta'}); if( $apRef->{type} eq 'uap' ) { readingsBulkUpdate($hash,'-AP_'.$apName.'_essid',$essid); + readingsBulkUpdate($hash,'-AP_'.$apName.'_utilization',$utiliz) if ($utiliz ne ''); readingsBulkUpdate($hash,'-AP_'.$apName.'_utilizationNA',$apRef->{'na_cu_total'}) if( defined($apRef->{'na_cu_total'}) ); readingsBulkUpdate($hash,'-AP_'.$apName.'_utilizationNG',$apRef->{'ng_cu_total'}) if( defined($apRef->{'ng_cu_total'}) ); } @@ -1308,7 +1324,7 @@ sub Unifi_SetAccesspointReadings($) { # readingsBulkUpdate($hash,'-AP_'.$apName.'_users',$apRef->{'user-num_sta'}); # readingsBulkUpdate($hash,'-AP_'.$apName.'_last_seen',$apRef->{'last_seen'}); } - + return undef; } @@ -2370,8 +2386,8 @@ Or you can use the other readings or set and get features to control your unifi-
UC_newClients
shows nameof a new client, could be a comma-separated list. Will be set to empty at next interval.-UC_newClients
shows nameof a new client, could be a comma-separated list. Will be set to empty at next interval.