2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 14:47:00 +00:00

74_Unifi: new Readings for WLAN-states, fixed Warning

git-svn-id: https://svn.fhem.de/fhem/trunk@15949 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
wuehler 2018-01-21 19:51:41 +00:00
parent e0d80dc9ac
commit 7a1192fc5d
2 changed files with 28 additions and 6 deletions

View File

@ -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.
- feature: 74_Unifi: new Readings for WLAN-states, fixed Warning
- feature: 93_DbRep: V7.5.1, new set-options display/writeToDB for
(max|min|sum|average|diff)Value,
create background_processing_time before execute

View File

@ -10,6 +10,8 @@
# - feature: 74_Unifi: add new set command to en-/disable Site Status-LEDs
# V2.1.1
# - bugfix: 74_Unifi: fixed blockClient
# V2.1.2
# - feature: 74_Unifi: new Readings for WLAN-states, fixed Warning
package main;
@ -49,6 +51,7 @@ sub Unifi_ProcessUpdate($);
sub Unifi_SetClientReadings($);
sub Unifi_SetHealthReadings($);
sub Unifi_SetAccesspointReadings($);
sub Unifi_SetWlanReadings($);
sub Unifi_DisconnectClient_Send($@);
sub Unifi_DisconnectClient_Receive($);
sub Unifi_ApCmd_Send($$@);
@ -57,6 +60,7 @@ sub Unifi_ArchiveAlerts_Send($);
sub Unifi_Cmd_Receive($);
sub Unifi_ClientNames($@);
sub Unifi_ApNames($@);
sub Unifi_SSIDs($@);
sub Unifi_BlockClient_Send($@);
sub Unifi_BlockClient_Receive($);
sub Unifi_UnblockClient_Send($@);
@ -961,6 +965,7 @@ sub Unifi_ProcessUpdate($) {
Unifi_SetHealthReadings($hash);
Unifi_SetClientReadings($hash);
Unifi_SetAccesspointReadings($hash);
Unifi_SetWlanReadings($hash);
## WLANGROUPS ???
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''#
readingsEndUpdate($hash,1);
@ -1077,6 +1082,22 @@ sub Unifi_SetAccesspointReadings($) {
return undef;
}
###############################################################################
sub Unifi_SetWlanReadings($) {
my ($hash) = @_;
my ($name,$self) = ($hash->{NAME},Unifi_Whoami());
Log3 $name, 5, "$name ($self) - executed.";
my ($wlanName,$wlanRef);
for my $wlanID (keys %{$hash->{wlans}}) {
$wlanRef = $hash->{wlans}->{$wlanID};
$wlanName = $wlanRef->{name};
readingsBulkUpdate($hash,'-WLAN_'.$wlanName.'_state',($wlanRef->{enabled} == JSON::true) ? 'enabled' : 'disabled');
}
return undef;
}
###############################################################################
sub Unifi_DisconnectClient_Send($@) {
@ -1470,14 +1491,14 @@ sub Unifi_SSIDs($@){
}
return $ID;
}
else { # Return all aps in a scalar
my $aps = '';
for my $apID (keys %{$hash->{wlans}}) {
$aps .= Unifi_SSIDs($hash,$apID,'makeName').',';
else { # Return all wlans in a scalar
my $wlans = '';
for my $wlanID (keys %{$hash->{wlans}}) {
$wlans .= Unifi_SSIDs($hash,$wlanID,'makeName').',';
}
$aps =~ s/.$//;
$wlans =~ s/.$//;
return $aps;
return $wlans;
}
}
###############################################################################