From 6b2bc397b141647bf42217d12202b783f05fac47 Mon Sep 17 00:00:00 2001 From: phenning <> Date: Mon, 29 Jan 2018 07:25:53 +0000 Subject: [PATCH] 95_YAAHM.pm: Bugfix git-svn-id: https://svn.fhem.de/fhem/trunk@16033 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/95_YAAHM.pm | 27 ++++++++++++++++++--------- fhem/www/pgm2/alarm.js | 2 +- fhem/www/pgm2/babble.js | 2 +- fhem/www/pgm2/yaahm.js | 2 +- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/fhem/FHEM/95_YAAHM.pm b/fhem/FHEM/95_YAAHM.pm index ae17b7bac..edde8a691 100644 --- a/fhem/FHEM/95_YAAHM.pm +++ b/fhem/FHEM/95_YAAHM.pm @@ -47,7 +47,7 @@ my $yaahmname; my $yaahmlinkname = "Profile"; # link text my $yaahmhiddenroom = "ProfileRoom"; # hidden room my $yaahmpublicroom = "Unsorted"; # public room -my $yaahmversion = "1.46"; +my $yaahmversion = "1.47"; my $firstcall = 1; my %yaahm_transtable_EN = ( @@ -1886,16 +1886,25 @@ sub YAAHM_sayWeeklyTime($$$) { ($hl,$ml) = split(':',strftime('%H:%M', localtime(time))); $tl = 60*$hl+$ml; - #-- today off AND tomorrow any time or off + #-- today off AND tomorrow any time or off => compare this time with current time if( $tod =~ /^off.*/ ){ - #-- special time + #-- tomorrow any time if( $tom =~ /(\d?\d):(\d\d)(:(\d\d))?/ && $tom !~ /.*\(off\)$/ ){ - $hw = $1*1; - $mw = $2*1; - $pt = sprintf("%d:%02d",$hw,$mw)." ".lc($yaahm_tt->{"tomorrow"}); - $msg .= " ".lc($yaahm_tt->{"tomorrow"})." $hw ".$yaahm_tt->{"clock"}; - $msg .=" $mw" - if( $mw != 0 ); + #Log 1,"===========> |$1|$2|$3|$4"; + ($ht,$mt) = split('[\s:]',$tom); + $tt=60*$ht+$mt; + #-- wakeup tomorrow later than now + if( $tt < $tl ){ + $hw = $1*1; + $mw = $2*1; + $pt = sprintf("%d:%02d",$hw,$mw)." ".lc($yaahm_tt->{"tomorrow"}); + $msg .= " ".lc($yaahm_tt->{"tomorrow"})." $hw ".$yaahm_tt->{"clock"}; + $msg .=" $mw" + if( $mw != 0 ); + }else{ + $pt = "off ".lc($yaahm_tt->{"today"}); + $msg .= " ".lc($yaahm_tt->{"today"})." ".$yaahm_tt->{"swoff"}; + } }elsif( $tom =~ /^off/ || $tom =~ /.*\(off\)$/ ){ $pt = "off ".lc($yaahm_tt->{"today"})." ".$yaahm_tt->{"and"}." ".lc($yaahm_tt->{"tomorrow"}); $msg .= " ".lc($yaahm_tt->{"today"})." ".$yaahm_tt->{"and"}." ".lc($yaahm_tt->{"tomorrow"})." ".$yaahm_tt->{"swoff"}; diff --git a/fhem/www/pgm2/alarm.js b/fhem/www/pgm2/alarm.js index 1fe7e00de..130ac27d7 100644 --- a/fhem/www/pgm2/alarm.js +++ b/fhem/www/pgm2/alarm.js @@ -10,7 +10,7 @@ //------------------------------------------------------------------------------------------------------ var req = new XMLHttpRequest(); -req.open('HEAD', document.location.href, false); +req.open('GET', document.location.href, false); req.send(null); var csrfToken = req.getResponseHeader('X-FHEM-csrfToken'); if( csrfToken == null ){ diff --git a/fhem/www/pgm2/babble.js b/fhem/www/pgm2/babble.js index 1bfd08f10..436d48d14 100644 --- a/fhem/www/pgm2/babble.js +++ b/fhem/www/pgm2/babble.js @@ -10,7 +10,7 @@ //------------------------------------------------------------------------------------------------------ var req = new XMLHttpRequest(); -req.open('HEAD', document.location.href, false); +req.open('GET', document.location.href, false); req.send(null); var csrfToken = req.getResponseHeader('X-FHEM-csrfToken'); if( csrfToken == null ){ diff --git a/fhem/www/pgm2/yaahm.js b/fhem/www/pgm2/yaahm.js index 259186318..bc7f1ffcb 100644 --- a/fhem/www/pgm2/yaahm.js +++ b/fhem/www/pgm2/yaahm.js @@ -10,7 +10,7 @@ //------------------------------------------------------------------------------------------------------ var req = new XMLHttpRequest(); -req.open('HEAD', document.location.href, false); +req.open('GET', document.location.href, false); req.send(null); var csrfToken = req.getResponseHeader('X-FHEM-csrfToken'); if( csrfToken == null ){