51_I2C_BMP180: bugfix for poll_interval

52_I2C_MCP342x: bugfix for poll_interval
52_I2C_SHT21: bugfix for poll_interval


git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@9272 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
klauswitt
2015-09-18 20:23:44 +00:00
parent 377e169869
commit cea6e93ffc
3 changed files with 29 additions and 17 deletions

View File

@@ -132,12 +132,20 @@ sub I2C_BMP180_Init($$) {
$hash->{I2C_Address} = hex(BMP180_I2C_ADDRESS);
my $msg = '';
# create default attributes
if (AttrVal($name, 'poll_interval', '?') eq '?') {
$msg = CommandAttr(undef, $name . ' poll_interval 5');
if ($msg) {
Log3 ($hash, 1, $msg);
return $msg;
}
}
if (AttrVal($name, '', '?') eq '?') {
$msg = CommandAttr(undef, $name . ' oversampling_settings 3');
if ($msg) {
Log3 ($hash, 1, $msg);
return $msg;
}
}
if ($hash->{HiPi_used}) {
my $dev = shift @$args;

View File

@@ -113,11 +113,13 @@ sub I2C_MCP342x_Init($$) {
my $msg = '';
# create default attributes
#$msg = CommandAttr(undef, $name . ' poll_interval 5');
if (AttrVal($name, 'poll_interval', '?') eq '?') {
$msg = CommandAttr(undef, $name . ' poll_interval 5');
if ($msg) {
Log3 ($hash, 1, $msg);
return $msg;
}
}
AssignIoPort($hash);
$hash->{STATE} = 'Initialized';
@@ -158,7 +160,7 @@ sub I2C_MCP342x_Attr (@) {# hier noch Werteueberpruefung einfuegen
RemoveInternalTimer($hash);
} elsif ($val > 0) {
RemoveInternalTimer($hash);
InternalTimer(1, 'I2C_MCP23017_Poll', $hash, 0);
InternalTimer(1, 'I2C_MCP342x_Poll', $hash, 0);
} else {
$msg = 'Wrong poll intervall defined. poll_interval must be a number > 0';
}

View File

@@ -78,11 +78,13 @@ sub I2C_SHT21_Init($$) {
my $msg = '';
# create default attributes
if (AttrVal($name, 'poll_interval', '?') eq '?') {
$msg = CommandAttr(undef, $name . ' poll_interval 5');
if ($msg) {
Log3 ($hash, 1, $msg);
return $msg;
}
}
AssignIoPort($hash);
$hash->{STATE} = 'Initialized';