2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-17 17:36:01 +00:00

37_dash_dhcp.pm: added devAlias attribute

git-svn-id: https://svn.fhem.de/fhem/trunk@12732 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2016-12-09 21:18:21 +00:00
parent 1cfde3005d
commit c924c62a62
2 changed files with 17 additions and 3 deletions

@ -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

@ -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.</li>
<a name="dash_dhcp_Attr"></a>
<b>Attr</b>
<ul>
<li>devAlias<br>
space separated list of &lt;mac&gt;:&lt;alias&gt; pairs.</li>
<li>allowed<br>
comma separated list of allowed mac adresses</li>
comma separated list of allowed mac adresses</li>
<li>port<br>
the listen port. defaults to 67 for root and 6767 for other users.</li>
<li><a href="#disable">disable</a></li>