diff --git a/fhem/CHANGED b/fhem/CHANGED index 956898bb9..ef699d56c 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. + - feature: 37_dash_dhcp.pm: added devAlias attribute - update: 74_AMAD: statusRequest every Time - change: 93_DbRep: code reviewed, no functional changes - change: 93_DbRep: DbRep version as INTERNAL, check if DBI module is diff --git a/fhem/FHEM/37_dash_dhcp.pm b/fhem/FHEM/37_dash_dhcp.pm index 7b006f7ed..9e8e90eec 100644 --- a/fhem/FHEM/37_dash_dhcp.pm +++ b/fhem/FHEM/37_dash_dhcp.pm @@ -22,7 +22,7 @@ dash_dhcp_Initialize($) #$hash->{SetFn} = "dash_dhcp_Set"; #$hash->{GetFn} = "dash_dhcp_Get"; $hash->{AttrFn} = "dash_dhcp_Attr"; - $hash->{AttrList} = "disable:1,0 disabledForIntervals allowed port $readingFnAttributes"; + $hash->{AttrList} = "devAlias disable:1,0 disabledForIntervals allowed port $readingFnAttributes"; } ##################################### @@ -173,6 +173,7 @@ dash_dhcp_Parse($$;$) Log3 $name, 4, "$name: got $chaddr"; $chaddr =~ s/:/-/g; + $chaddr = $hash->{helper}{devAliases}{$chaddr} if( defined($hash->{helper}{devAliases}{$chaddr}) ); readingsSingleUpdate( $hash, $chaddr, 'short', 1 ); } else { @@ -210,7 +211,17 @@ dash_dhcp_Attr($$$) my $orig = $attrVal; my $hash = $defs{$name}; - if( $attrName eq "disable" ) { + if( $attrName eq "devAlias" ) { + delete $hash->{helper}{devAliases}; + if( $cmd eq 'set' && $attrVal ) { + $hash->{helper}{devAliases} = {}; + foreach my $entry (split( ' ', $attrVal ) ) { + my ($mac, $alias) = split( ':', $entry ); + $hash->{helper}{devAliases}{$mac} = $alias; + } + } + + } elsif( $attrName eq "disable" ) { if( $cmd eq 'set' && $attrVal ne "0" ) { dash_dhcp_stopListener($hash); } else { @@ -268,8 +279,10 @@ and use the port attribute to configure the redirected port. Attr