From bef1811d01dce241e826b81d2235c09041eb7baa Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Thu, 28 Sep 2017 06:57:29 +0000 Subject: [PATCH] 74_XiaomiFlowerMonitor: 73_GardenaSmartBridge: add syntax check for disabledForIntervals, check set Interval Valur greater than 0 git-svn-id: https://svn.fhem.de/fhem/trunk@15147 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 3 ++ fhem/FHEM/73_GardenaSmartBridge.pm | 7 ++- fhem/FHEM/74_XiaomiFlowerSens.pm | 87 ++++++++++++++++++++++++++---- 3 files changed, 84 insertions(+), 13 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 555cd1b16..f7e21219c 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,8 @@ # 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. + - feature: 73_GardenaSmartBridge: add syntax check for disabledForIntervals + check set Interval Valur greater than 0 + - feature: 74_XiaomiFlowerMonitor: add syntax check for disabledForIntervals - feature: LightScene: added set all command - feature: 49_SSCam: V3.0.0, new concept - differ between CAM-/SVS-device, version is downwardly compatible, but homeMode-commands diff --git a/fhem/FHEM/73_GardenaSmartBridge.pm b/fhem/FHEM/73_GardenaSmartBridge.pm index 6bf842d0f..5cf641291 100644 --- a/fhem/FHEM/73_GardenaSmartBridge.pm +++ b/fhem/FHEM/73_GardenaSmartBridge.pm @@ -68,7 +68,7 @@ eval "use JSON;1" or $missingModul .= "JSON "; eval "use IO::Socket::SSL;1" or $missingModul .= "IO::Socket::SSL "; -my $version = "0.2.5"; +my $version = "0.2.6"; @@ -209,8 +209,9 @@ sub GardenaSmartBridge_Attr(@) { elsif( $attrName eq "disabledForIntervals" ) { if( $cmd eq "set" ) { + return "check disabledForIntervals Syntax HH:MM-HH:MM or 'HH:MM-HH:MM HH:MM-HH:MM ...'" + unless($attrVal =~ /^((\d{2}:\d{2})-(\d{2}:\d{2})\s?)+$/); Log3 $name, 3, "GardenaSmartBridge ($name) - disabledForIntervals"; - readingsSingleUpdate ( $hash, "state", "inactive", 1 ); } elsif( $cmd eq "del" ) { @@ -221,6 +222,8 @@ sub GardenaSmartBridge_Attr(@) { elsif( $attrName eq "interval" ) { if( $cmd eq "set" ) { + return "Interval must be greater than 0" + unless($attrVal > 0); $hash->{INTERVAL} = $attrVal; RemoveInternalTimer($hash); Log3 $name, 3, "GardenaSmartBridge ($name) - set interval: $attrVal"; diff --git a/fhem/FHEM/74_XiaomiFlowerSens.pm b/fhem/FHEM/74_XiaomiFlowerSens.pm index 15c842555..0d42f3183 100644 --- a/fhem/FHEM/74_XiaomiFlowerSens.pm +++ b/fhem/FHEM/74_XiaomiFlowerSens.pm @@ -36,7 +36,7 @@ use JSON; use Blocking; -my $version = "1.0.1"; +my $version = "1.0.3"; @@ -164,6 +164,8 @@ sub XiaomiFlowerSens_Attr(@) { if( $attrName eq "disabledForIntervals" ) { if( $cmd eq "set" ) { + return "check disabledForIntervals Syntax HH:MM-HH:MM or 'HH:MM-HH:MM HH:MM-HH:MM ...'" + unless($attrVal =~ /^((\d{2}:\d{2})-(\d{2}:\d{2})\s?)+$/); Log3 $name, 3, "XiaomiFlowerSens ($name) - disabledForIntervals"; readingsSingleUpdate ( $hash, "state", "Unknown", 1 ); } @@ -651,20 +653,20 @@ sub XiaomiFlowerSens_BlockingAborted($) { Attributes @@ -672,6 +674,69 @@ sub XiaomiFlowerSens_BlockingAborted($) { =begin html_DE + +

Xiaomi Flower Monitor

+ + =end html_DE =cut