2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

70_BOTVAC.pm: fix robotSounds value mapping

git-svn-id: https://svn.fhem.de/fhem/trunk@19592 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
vuffiraa 2019-06-10 17:45:38 +00:00
parent 92b0677d7b
commit 67e57cc442

View File

@ -550,12 +550,15 @@ sub Set($@) {
my $prefName = $1;
$params{$prefName} = ReadingsVal($name, $reading, "null");
$params{$prefName} *= 43200 if ($prefName =~ /ChangeReminderInterval/ and $params{$prefName} =~ /^\d*$/);
$params{$prefName} = SetBoolean($params{$prefName}) if ($prefName eq "robotSounds");
}
}
return "No preferences present, execute 'set statusRequest' first." unless (keys %params);
$params{$item} = ($item =~ /ChangeReminderInterval/ && $a[2] =~ /^\d*$/ ? $a[2] * 43200 : $a[2]);
$params{$item} = $a[2];
$params{$item} *= 43200 if ($item =~ /ChangeReminderInterval/ && $params{$item} =~ /^\d*$/);
$params{$item} = SetBoolean($params{$item}) if ($item eq "robotSounds");
SendCommand( $hash, "messages", "setPreferences", \%params );
}
@ -1096,7 +1099,10 @@ sub ReceiveCommand($$$) {
my $data = $return->{data};
foreach my $key (keys %{$return->{data}}) {
my $value = $data->{$key};
$value /= 43200 if ($key =~ /ChangeReminderInterval/ and $value =~ /^[1-9]\d*$/);
$value /= 43200
if ($key =~ /ChangeReminderInterval/ and $value =~ /^[1-9]\d*$/);
$value = GetBoolean($value)
if ($key =~ /(robotSounds)|(dirtbinAlert)|(allAlerts)|(leds)|(buttonClicks)|(clock24h)/);
readingsBulkUpdateIfChanged($hash, "pref_$key", $value);
}
}
@ -1455,6 +1461,22 @@ sub GetBoolean($) {
}
}
sub SetBoolean($) {
my ($value) = @_;
my $booleans = {
'0' => "false",
'off' => "false",
'1' => "true",
'on' => "true"
};
if (defined( $booleans->{$value})) {
return $booleans->{$value};
} else {
return $value;
}
}
sub BuildState($$$$) {
my ($hash,$state,$action,$error) = @_;
my $states = {