31_MilightDevice: Fixes, features, changes by MarkusM

git-svn-id: https://svn.fhem.de/fhem/trunk@8528 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mattwire
2015-05-05 11:06:05 +00:00
parent 58ed700bdd
commit b3305db5c1
3 changed files with 646 additions and 249 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.
- change: MilightDevice/MilightBridge: Fixes, features, changes (by MarkusM)
- bugfix: SYSMON: network speed
- improved: I2C_TSL2561: asynchronous measurements, new readings (by jensb),
new set update command, removed get command

View File

@@ -47,7 +47,7 @@ sub MilightBridge_Initialize($)
$hash->{UndefFn} = "MilightBridge_Undefine";
$hash->{NotifyFn} = "MilightBridge_Notify";
$hash->{AttrFn} = "MilightBridge_Attr";
$hash->{AttrList} = "port sendInterval disable:0,1 ".$readingFnAttributes;
$hash->{AttrList} = "port sendInterval disable:0,1 checkInterval ".$readingFnAttributes;
return undef;
}
@@ -96,6 +96,7 @@ sub MilightBridge_Define($$)
# Set Attributes
$attr{$name}{"event-on-change-reading"} = "state" if (!defined($attr{$name}{"event-on-change-reading"}));
$attr{$name}{"checkInterval"} = 10 if (!defined($attr{$name}{"checkInterval"}));
# Set state
$hash->{SENDFAIL} = 0;
@@ -136,6 +137,14 @@ sub MilightBridge_Attr($$$$) {
$hash->{INTERVAL} = $attr{$name}{"sendInterval"};
}
}
if ($attribute eq "checkInterval")
{
if (($value !~ /^\d*$/) || ($value < 5))
{
$attr{$name}{"checkInterval"} = 10;
return "checkInterval is required in s (default: 10, min: 5)";
}
}
elsif ($attribute eq "port")
{
if (($value !~ /^\d*$/) || ($value < 1))
@@ -208,8 +217,8 @@ sub MilightBridge_State(@)
# Update send fail flag
readingsSingleUpdate( $hash, "sendFail", $hash->{SENDFAIL}, 1 );
# Check state every 10 seconds
InternalTimer(gettimeofday() + 10, "MilightBridge_State", $hash, 0);
# Check state every X seconds
InternalTimer(gettimeofday() + AttrVal($hash->{NAME}, "checkInterval", "10"), "MilightBridge_State", $hash, 0);
return undef;
}
@@ -381,6 +390,10 @@ sub MilightBridge_CmdQueue_Send(@)
<b>sendInterval</b><br/>
Default: 100ms. The bridge has a minimum send delay of 100ms between commands.
</li>
<li>
<b>checkInterval</b><br/>
Default: 10s. Time after the bridge connection is re-checked.
</li>
<li>
<b>port</b><br/>
Default: 8899. Older bridges (V2) used port 50000 so change this value if you have an old bridge.

File diff suppressed because it is too large Load Diff