2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

22_HOMEMODE: v1.4.8 - fix attr validation for HomeSensorsSmokeReading

git-svn-id: https://svn.fhem.de/fhem/trunk@19186 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
deespe 2019-04-14 18:41:30 +00:00
parent b6f2b1fcc5
commit faf2adbb21

View File

@ -16,7 +16,7 @@ use Time::HiRes qw(gettimeofday);
use HttpUtils;
use vars qw{%attr %defs %modules $FW_CSRF};
my $HOMEMODE_version = "1.4.7";
my $HOMEMODE_version = "1.4.8";
my $HOMEMODE_Daytimes = "05:00|morning 10:00|day 14:00|afternoon 18:00|evening 23:00|night";
my $HOMEMODE_Seasons = "03.01|spring 06.01|summer 09.01|autumn 12.01|winter";
my $HOMEMODE_UserModes = "gotosleep,awoken,asleep";
@ -1696,13 +1696,20 @@ sub HOMEMODE_Attr(@)
return $trans if (!HOMEMODE_CheckIfIsValidDevspec("TYPE=$attr_value","presence"));
HOMEMODE_updateInternals($hash,1);
}
elsif ($attr_name =~ /^(HomeSensorsContactReadings|HomeSensorsMotionReadings|HomeSensorsSmokeReading)$/)
elsif ($attr_name =~ /^(HomeSensorsContactReadings|HomeSensorsMotionReadings)$/)
{
$trans = $HOMEMODE_de?
"Ungültiger Wert $attr_value für Attribut $attr_name. Es werden 2 Leerzeichen separierte Readings benötigt! z.B. state sabotageError":
"Invalid value $attr_value for attribute $attr_name. You have to provide at least 2 space separated readings, e.g. state sabotageError";
return $trans if ($attr_value !~ /^[\w\-\.]+\s[\w\-\.]+$/);
}
elsif ($attr_name eq "HomeSensorsSmokeReading")
{
$trans = $HOMEMODE_de?
"Ungültiger Wert $attr_value für Attribut $attr_name. Es wird ein einzelnes Reading benötigt! z.B. state":
"Invalid value $attr_value for attribute $attr_name. You have to provide one reading, e.g. state";
return $trans if ($attr_value !~ /^[\w\-\.]+$/);
}
elsif ($attr_name =~ /^(HomeSensorsContactValues|HomeSensorsMotionValues|HomeSensorsSmokeValue)$/)
{
$trans = $HOMEMODE_de?