mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
32_TechemHKV.pm: fix for event-on
git-svn-id: https://svn.fhem.de/fhem/trunk@10659 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3dc9c484ee
commit
b3b44462dd
@ -133,10 +133,12 @@ TechemHKV_Receive(@) {
|
|||||||
$ats = ReadingsTimestamp($hash->{NAME},"current_period", "0");
|
$ats = ReadingsTimestamp($hash->{NAME},"current_period", "0");
|
||||||
$ts = sprintf ("%02d-%02d-%02d 00:00:00", $msg->{actual}->{year}, $msg->{actual}->{month}, $msg->{actual}->{day});
|
$ts = sprintf ("%02d-%02d-%02d 00:00:00", $msg->{actual}->{year}, $msg->{actual}->{month}, $msg->{actual}->{day});
|
||||||
if ($ats ne $ts) {
|
if ($ats ne $ts) {
|
||||||
|
my $i;
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
$hash->{".updateTimestamp"} = $ts;
|
$hash->{".updateTimestamp"} = $ts;
|
||||||
|
$i = $#{ $hash->{CHANGED} };
|
||||||
readingsBulkUpdate($hash, "current_period", $msg->{actualVal});
|
readingsBulkUpdate($hash, "current_period", $msg->{actualVal});
|
||||||
$hash->{CHANGETIME}->[$#{ $hash->{CHANGED} }] = $ts;
|
$hash->{CHANGETIME}->[$#{ $hash->{CHANGED} }] = $ts if ($#{ $hash->{CHANGED} } != $i ); # only add ts if there is a event to
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,10 +146,12 @@ TechemHKV_Receive(@) {
|
|||||||
$ats = ReadingsTimestamp($hash->{NAME},"previous_period", "0");
|
$ats = ReadingsTimestamp($hash->{NAME},"previous_period", "0");
|
||||||
$ts = sprintf ("20%02d-%02d-%02d 00:00:00", $msg->{last}->{year}, $msg->{last}->{month}, $msg->{last}->{day});
|
$ts = sprintf ("20%02d-%02d-%02d 00:00:00", $msg->{last}->{year}, $msg->{last}->{month}, $msg->{last}->{day});
|
||||||
if ($ats ne $ts) {
|
if ($ats ne $ts) {
|
||||||
|
my $i;
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
$hash->{".updateTimestamp"} = $ts;
|
$hash->{".updateTimestamp"} = $ts;
|
||||||
|
$i = $#{ $hash->{CHANGED} };
|
||||||
readingsBulkUpdate($hash, "previous_period", $msg->{lastVal});
|
readingsBulkUpdate($hash, "previous_period", $msg->{lastVal});
|
||||||
$hash->{CHANGETIME}->[$#{ $hash->{CHANGED} }] = $ts;
|
hash->{CHANGETIME}->[$#{ $hash->{CHANGED} }] = $ts if ($#{ $hash->{CHANGED} } != $i ); # only add ts if there is a event to
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +189,7 @@ TechemHKV_Parse(@) {
|
|||||||
my ($message, $rssi);
|
my ($message, $rssi);
|
||||||
($msg, $rssi) = split (/::/, $msg);
|
($msg, $rssi) = split (/::/, $msg);
|
||||||
$msg = TechemHKV_SanityCheck($msg);
|
$msg = TechemHKV_SanityCheck($msg);
|
||||||
return '' unless $msg;
|
return ('') unless $msg;
|
||||||
|
|
||||||
my @m = ($msg =~ m/../g);
|
my @m = ($msg =~ m/../g);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user