mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
70_LaMetric2: fix cycle/sticky message
git-svn-id: https://svn.fhem.de/fhem/trunk@18389 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a33cd993f0
commit
90d55d3e8e
@ -20,8 +20,6 @@
|
||||
# 0x00B3 -> "3" m3
|
||||
# 0x0025 -> "%"
|
||||
# 0x00B0 -> "°"
|
||||
#- notification attributes auf tatsächliche funktion prüfen
|
||||
#- sticky/cycle message prüfen
|
||||
#- msgSchema (überlappende Parameter wie priority)
|
||||
#-mehrere metric/chart/goal/msg frames des gleichen typs (derzeit gehen per msg nur 1x zusätzlich metric,chart,goal) -> reihenfolge?
|
||||
|
||||
@ -31,6 +29,7 @@ use Data::Dumper;
|
||||
use JSON qw(decode_json encode_json);
|
||||
use Time::HiRes qw(gettimeofday time);
|
||||
use Time::Local;
|
||||
use IO::Socket::SSL;
|
||||
|
||||
use Encode;
|
||||
use HttpUtils;
|
||||
@ -1563,11 +1562,11 @@ sub LaMetric2_SetNotification {
|
||||
$values{sound} = ""
|
||||
if ( $values{sound} eq "none" || $values{sound} eq "off" );
|
||||
$values{repeat} =
|
||||
h->{repeat}
|
||||
$h->{repeat}
|
||||
? $h->{repeat}
|
||||
: 1;
|
||||
$values{cycles} =
|
||||
h->{cycles}
|
||||
defined( $h->{cycles} )
|
||||
? $h->{cycles}
|
||||
: 1;
|
||||
|
||||
@ -1886,6 +1885,16 @@ sub LaMetric2_SetNotification {
|
||||
|| defined( $values{goal} )
|
||||
|| defined( $values{metric} ) );
|
||||
|
||||
# If a cancelID was provided, send a "sticky" notification
|
||||
if ( !looks_like_number( $values{cycles} ) || $values{cycles} == 0 ) {
|
||||
$info->{cancelID} = $values{cycles};
|
||||
$values{cycles} = 0;
|
||||
|
||||
# start Validation Timer
|
||||
RemoveInternalTimer( $hash, "LaMetric2_CycleMessage" );
|
||||
InternalTimer( gettimeofday() + 5, "LaMetric2_CycleMessage", $hash, 0 );
|
||||
}
|
||||
|
||||
# Building notification
|
||||
#
|
||||
|
||||
@ -1905,16 +1914,6 @@ sub LaMetric2_SetNotification {
|
||||
readingsBulkUpdate( $hash, "lastNotificationIconType", $values{icontype} );
|
||||
readingsBulkUpdate( $hash, "lastNotificationLifetime", $values{lifetime} );
|
||||
|
||||
# If a cancelID was provided, send a "sticky" notification
|
||||
if ( !looks_like_number( $values{cycles} ) || $values{cycles} == 0 ) {
|
||||
$info->{cancelID} = $values{cycles};
|
||||
$values{cycles} = 0;
|
||||
|
||||
# start Validation Timer
|
||||
RemoveInternalTimer( $hash, "LaMetric2_CycleMessage" );
|
||||
InternalTimer( gettimeofday() + 5, "LaMetric2_CycleMessage", $hash, 0 );
|
||||
}
|
||||
|
||||
my $sound;
|
||||
if ( $values{sound} ne "" ) {
|
||||
my @sFields = split /:/, $values{sound};
|
||||
|
Loading…
x
Reference in New Issue
Block a user