2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-15 22:26:04 +00:00

74_Unifi: Minor bugfix in notify-function

git-svn-id: https://svn.fhem.de/fhem/trunk@16900 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
wuehler 2018-06-23 11:22:34 +00:00
parent bf62893e32
commit 01e0660903
2 changed files with 13 additions and 6 deletions

View File

@ -31,6 +31,8 @@
# V 3.0.1
# - feature: 74_Unifi: new reading UC_newClients for new clients
# - feature: 74_Unifi: block clients by mac-address
# V 3.0.2
# - fixed: 74_Unifi: Minor bugfix in notify-function
package main;
@ -190,9 +192,10 @@ sub Unifi_Undef($$) {
sub Unifi_Notify($$) {
my ($hash,$dev) = @_;
my ($name,$self) = ($hash->{NAME},Unifi_Whoami());
Log3 $name, 5, "$name ($self) - executed.";
return if($dev->{NAME} ne "global");
return if(!grep(m/^DEFINED|MODIFIED|INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
return if(!grep(m/^DEFINED $name|MODIFIED $name|INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
if(AttrVal($name, "disable", 0)) {
Log3 $name, 5, "$name ($self) - executed. - Device '$name' is disabled, do nothing...";
@ -1315,7 +1318,7 @@ sub Unifi_SetWlanReadings($) {
for my $wlanID (keys %{$hash->{wlans}}) {
$wlanRef = $hash->{wlans}->{$wlanID};
$wlanName = makeReadingName($wlanRef->{name});
readingsBulkUpdate($hash,'-WLAN_'.$wlanName.'_state',($wlanRef->{enabled} == JSON::true) ? 'enabled' : 'disabled');
readingsBulkUpdate($hash,'-WLAN_'.$wlanName.'_state',($wlanRef->{enabled} eq JSON::true) ? 'enabled' : 'disabled');
}
return undef;

View File

@ -14,6 +14,8 @@
# V 0.90
# - feature: 74_UnififSwitch: setter for poe-Mode
# added commandref
# V 0.91
# - fixed: 74_UnififSwitch: fixed wording in commandref
#
# TODOs:
# - state des USW korrekt setzen (aktuell nur connected und provisioning)
@ -36,7 +38,7 @@ sub UnifiSwitch_Parse($$);
sub UnifiSwitch_Whoami();
sub UnifiSwitch_Whowasi();
my $version="0.90";
my $version="0.91";
sub UnifiSwitch_Initialize($$) {
my ($hash) = @_;
@ -201,7 +203,9 @@ sub UnifiSwitch_Parse($$) {
if( $apRef->{type} eq 'usw' ){
if ($apRef->{state} eq "1"){
$hash->{STATE} = "connected";
}elsif($apRef->{state} eq "5"){
}elsif($apRef->{state} eq "4"){
$hash->{STATE} = "upgrading";
elsif($apRef->{state} eq "5"){
$hash->{STATE} = "provisioning";
}else{
$hash->{STATE} = "unknown: ".$apRef->{state}; # TODO: Weitere states setzen wenn state-id bekannt
@ -297,7 +301,7 @@ You can use the readings or set features to control your unifi-switch.
<li><code>set &lt;name&gt; clear &lt;readings|all&gt;</code><br>
Clears the readings or all. </li>
<br>
<li><code>set &lt;name&gt; poeMode &lt;name|mac|id&gt; &lt;port&gt; &lt;off|auto|passive|passthrough|restart&gt;</code><br>
<li><code>set &lt;name&gt; poeMode &lt;port&gt; &lt;off|auto|passive|passthrough|restart&gt;</code><br>
Set PoE mode for &lt;port&gt;. </li>
</ul>
@ -312,7 +316,7 @@ You can use the readings or set features to control your unifi-switch.
<ul>The connection state of the port. Can be disconnected or in Mbps/Gbps.</ul>
</li>
<li>poe_current
<ul>The current power-usage.</ul>
<ul>The current of the port.</ul>
</li>
<li>poe_mode
<ul>The poe-mode of the port.</ul>