From 07acc7a533055c666be286f74fcf4dc43e3685b9 Mon Sep 17 00:00:00 2001 From: mgehre <> Date: Thu, 16 Apr 2015 19:53:53 +0000 Subject: [PATCH] MAX: update validation of "desiredTemperature" command git-svn-id: https://svn.fhem.de/fhem/trunk@8445 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_MAX.pm | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/10_MAX.pm b/fhem/FHEM/10_MAX.pm index db94c1c8e..a15be0baf 100755 --- a/fhem/FHEM/10_MAX.pm +++ b/fhem/FHEM/10_MAX.pm @@ -271,7 +271,7 @@ MAX_Set($@) #This enables the automatic/schedule mode where the thermostat follows the weekly program #There can be a temperature supplied, which will be kept until the next switch point of the weekly program - if(@args > 1) { + if(@args == 2) { if($args[1] eq "eco") { $temperature = MAX_ReadingsVal($hash,"ecoTemperature"); } elsif($args[1] eq "comfort") { @@ -279,30 +279,37 @@ MAX_Set($@) } else { $temperature = MAX_ParseTemperature($args[1]); } - } else { + } elsif(@args == 1) { $temperature = 0; #use temperature from weekly program + } else { + return "To many parameters: desiredTemperature auto []"; } $ctrlmode = 0; #auto } else { - return "To many parameters to desiredTemperature: expected one" if(@args > 1); if($args[0] eq "boost") { + return "To many parameters: desiredTemperature boost" if(@args > 1); $temperature = 0; $ctrlmode = 3; #TODO: auto mode with temperature is also possible + } elsif($args[0] eq "eco") { $temperature = MAX_ReadingsVal($hash,"ecoTemperature"); } elsif($args[0] eq "comfort") { $temperature = MAX_ReadingsVal($hash,"comfortTemperature"); - }else{ + } else { $temperature = MAX_ParseTemperature($args[0]); } - } - if(@args > 1 and ($args[1] eq "until") and ($ctrlmode == 1)) { - $ctrlmode = 2; #temporary - $until = sprintf("%06x",MAX_DateTime2Internal($args[2]." ".$args[3])); + if(@args > 1) { + #@args == 3 and $args[1] == "until" + return "Second parameter must be 'until'" if($args[1] ne "until"); + return "Not enough parameters: desiredTemperature [until