00_HMUARTLGW.pm: add dummy attribute

git-svn-id: https://svn.fhem.de/fhem/trunk@12359 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgernoth
2016-10-17 08:46:50 +00:00
parent 01989b2720
commit 913a53fd64

View File

@@ -153,6 +153,7 @@ sub HMUARTLGW_Initialize($)
"csmaCa:0,1 " . "csmaCa:0,1 " .
"qLen " . "qLen " .
"logIDs ". "logIDs ".
"dummy:1 ".
$readingFnAttributes; $readingFnAttributes;
} }
@@ -184,7 +185,6 @@ sub HMUARTLGW_DoInit($)
delete($hash->{Helper}); delete($hash->{Helper});
delete($hash->{AssignedPeerCnt}); delete($hash->{AssignedPeerCnt});
delete($hash->{msgLoadCurrent}); delete($hash->{msgLoadCurrent});
delete($hash->{msgLoadCurrentRaw});
delete($hash->{msgLoadHistory}); delete($hash->{msgLoadHistory});
delete($hash->{msgLoadHistoryAbs}); delete($hash->{msgLoadHistoryAbs});
delete($hash->{owner}); delete($hash->{owner});
@@ -266,6 +266,12 @@ sub HMUARTLGW_Define($$)
$hash->{DeviceName} = $dev; $hash->{DeviceName} = $dev;
if (defined(AttrVal($name, "dummy", undef))) {
readingsSingleUpdate($hash, "state", "dummy", 1);
HMUARTLGW_updateCondition($hash);
return;
}
return DevIo_OpenDev($hash, 0, "HMUARTLGW_DoInit", \&HMUARTLGW_Connect); return DevIo_OpenDev($hash, 0, "HMUARTLGW_DoInit", \&HMUARTLGW_Connect);
} }
@@ -284,7 +290,10 @@ sub HMUARTLGW_Undefine($$;$)
$devcount--; $devcount--;
} }
DevIo_CloseDev($hash) if (!$noclose); if (defined($hash->{FD}) && (!$noclose)) {
DevIo_CloseDev($hash);
Log3($hash, 3, "${name} device closed") if (!defined($hash->{FD}));
}
$hash->{DevState} = HMUARTLGW_STATE_NONE; $hash->{DevState} = HMUARTLGW_STATE_NONE;
HMUARTLGW_updateCondition($hash); HMUARTLGW_updateCondition($hash);
} }
@@ -1796,6 +1805,20 @@ sub HMUARTLGW_Attr(@)
delete $attr{$hash->{keepAlive}->{NAME}}{$aName}; delete $attr{$hash->{keepAlive}->{NAME}}{$aName};
} }
} }
} elsif ($aName eq "dummy") {
if ($cmd eq "set") {
if (!defined($attr{$name}{$aName})) {
HMUARTLGW_Undefine($hash, $name);
readingsSingleUpdate($hash, "state", "dummy", 1);
HMUARTLGW_updateCondition($hash);
$hash->{XmitOpen} = 0;
}
} else {
if (defined($attr{$name}{$aName})) {
delete $attr{$name}{$aName};
DevIo_OpenDev($hash, 0, "HMUARTLGW_DoInit", \&HMUARTLGW_Connect);
}
}
} }
return $retVal; return $retVal;
@@ -1936,9 +1959,8 @@ sub HMUARTLGW_updateMsgLoad($$) {
} }
} }
if ((!defined($hash->{msgLoadCurrentRaw})) || if ((!defined($hash->{msgLoadCurrent})) ||
$hash->{msgLoadCurrentRaw} != $load) { $hash->{msgLoadCurrent} != $adjustedLoad) {
$hash->{msgLoadCurrentRaw} = $load;
$hash->{msgLoadCurrent} = $adjustedLoad; $hash->{msgLoadCurrent} = $adjustedLoad;
HMUARTLGW_updateCondition($hash); HMUARTLGW_updateCondition($hash);
} }
@@ -2342,6 +2364,10 @@ sub HMUARTLGW_getVerbLvl($$$$) {
avoidance), also known as listen-before-talk.<br> avoidance), also known as listen-before-talk.<br>
Default: 0 (disabled) Default: 0 (disabled)
</li> </li>
<li>dummy<br>
Do not interact with the device at all, only define it.<br>
Default: not set
</li>
<li>dutyCycle<br> <li>dutyCycle<br>
Enable or disable the duty-cycle check (1% rule) performed by the Enable or disable the duty-cycle check (1% rule) performed by the
wireless module.<br> wireless module.<br>