51_MOBILEALERTS: Perl Warnings and Init RainSensor

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@23556 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
MarkusF 2021-01-19 18:06:03 +00:00
parent 74f5c5ba47
commit dee45c8957
2 changed files with 11 additions and 7 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.
- bugfix: 51_MOBILEALERTS: Perl Warnings and Init RainSensor
- bugfix: 57_Calendar: correct event selection for
limit:when=tomorrow (forum #97810)
- feature: 36_ShellyModule: new module to interwork with 36_Shelly

View File

@ -27,6 +27,7 @@ sub MOBILEALERTS_Initialize($) {
$hash->{AutoCreate} = {
"MA_.*" => {
ATTR => "event-on-change-reading:.* timestamp-on-change-reading:.*",
GPLOT => "",
FILTER => "%NAME"
}
};
@ -678,11 +679,13 @@ sub MOBILEALERTS_Parse_e1 ($$) {
unpack( "nnnnnnnnnnnn", $message );
my $lastEventCounter = ReadingsVal( $hash->{NAME}, "eventCounter", undef );
my $mmRain = 0;
my $mmRainOffset = 0;
if ( !defined($lastEventCounter) ) {
# First Data
$mmRain = $eventCounter * MA_RAIN_FACTOR;
$mmRainOffset = $eventCounter * MA_RAIN_FACTOR;
$mmRain = 0;
}
elsif ( $lastEventCounter > $eventCounter ) {
@ -695,7 +698,7 @@ sub MOBILEALERTS_Parse_e1 ($$) {
else {
$mmRain = 0;
}
MOBILEALERTS_CheckRainSensor( $hash, $mmRain );
MOBILEALERTS_CheckRainSensor( $hash, $mmRain, $mmRainOffset );
MOBILEALERTS_readingsBulkUpdate( $hash, 0, "txCounter",
MOBILEALERTS_decodeTxCounter($txCounter) );
MOBILEALERTS_readingsBulkUpdate( $hash, 0, "triggered",
@ -1348,7 +1351,7 @@ sub MOBILEALERTS_CheckRainSensorTimed($) {
my ($hash) = @_;
$hash->{".expertMode"} = AttrVal( $hash->{NAME}, "expert", 0 );
readingsBeginUpdate($hash);
MOBILEALERTS_CheckRainSensor( $hash, 0 );
MOBILEALERTS_CheckRainSensor( $hash, 0, 0);
readingsEndUpdate( $hash, 1 );
InternalTimer(
time_str2num(
@ -1359,8 +1362,8 @@ sub MOBILEALERTS_CheckRainSensorTimed($) {
);
}
sub MOBILEALERTS_CheckRainSensor($$) {
my ( $hash, $mmRain ) = @_;
sub MOBILEALERTS_CheckRainSensor($$$) {
my ( $hash, $mmRain, $mmRainOffset ) = @_;
#Event
push @{ $hash->{CHANGED} }, "rain" if ( $mmRain > 0 );
@ -1423,8 +1426,8 @@ sub MOBILEALERTS_CheckRainSensor($$) {
if ( $mmRain > 0 );
}
MOBILEALERTS_readingsBulkUpdate( $hash, 0, "mmRain",
$mmRain + ReadingsVal( $hash->{NAME}, "mmRain", "0" ) )
if ( $mmRain > 0 );
$mmRain + $mmRainOffset + ReadingsVal( $hash->{NAME}, "mmRain", "0" ) )
if ( $mmRain + $mmRainOffset > 0 );
}
sub MOBILEALERTS_ActionDetector($) {