2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

SetExtension: toggle added for ZWave

git-svn-id: https://svn.fhem.de/fhem/trunk@6588 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-09-21 14:19:50 +00:00
parent 64c9948ecb
commit b3e0d066f2
2 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,6 @@
# 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: add toggle to SetExtensions (introduced for ZWave)
- bugfix: plotEmbed FHEMWEB attribute (fix for an iOS8 bug)
- feature: SHC: support for analog inputs (EnvSensor) and new device
RGB_Dimmer added (rr2000)

View File

@ -20,17 +20,20 @@ SetExtensions($$@)
"off-till" => 1,
"blink" => 2,
"intervals" => 0,
"toggle" => 0
);
my $hasOn = ($list =~ m/\bon\b/);
my $hasOff = ($list =~ m/\boff\b/);
if(!$hasOn || !$hasOff) {
my $value = Value($name);
my $em = AttrVal($name, "eventMap", undef);
if($em) {
if(!$hasOn || !$hasOff) {
$hasOn = ($em =~ m/:on\b/) if(!$hasOn);
$hasOff = ($em =~ m/:off\b/) if(!$hasOff);
}
$cmd = ReplaceEventMap($name, $cmd, 1) if($cmd ne "?"); # Fix B0-for-timer
(undef, $value) = ReplaceEventMap($name, [$name, $value], 0);
}
if(!$hasOn || !$hasOff) { # No extension
return "Unknown argument $cmd, choose one of $list";
@ -125,6 +128,9 @@ SetExtensions($$@)
}
}
} elsif($cmd eq "toggle") {
DoSet($name, $value =~ m/^on/ ? "off" : "on");
}
return undef;