2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 07:19:24 +00:00

46_PW_Circle:Fixed small bug in on/off-for-timer

git-svn-id: https://svn.fhem.de/fhem/trunk@9858 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
icinger 2015-11-11 15:42:54 +00:00
parent b8debb5eae
commit 9aa08bb2cc

View File

@ -22,7 +22,7 @@
# The GNU General Public License may also be found at http://www.gnu.org/licenses/gpl-2.0.html . # The GNU General Public License may also be found at http://www.gnu.org/licenses/gpl-2.0.html .
################################### ###################################
# #
# $Id: 46_PW_Circle.pm 0037 2015-11-09 19:18:38Z sguttmann $ # $Id: 46_PW_Circle.pm 0038 2015-11-11 16:18:38Z sguttmann $
package main; package main;
use strict; use strict;
@ -47,7 +47,7 @@ sub PW_Circle_Initialize($)
{ {
my ($hash) = @_; my ($hash) = @_;
$hash->{Match} = "Circle"; $hash->{Match} = "PW_Circle";
$hash->{DefFn} = "PW_Circle_Define"; $hash->{DefFn} = "PW_Circle_Define";
$hash->{UndefFn} = "PW_Circle_Undef"; $hash->{UndefFn} = "PW_Circle_Undef";
$hash->{ParseFn} = "PW_Circle_Parse"; $hash->{ParseFn} = "PW_Circle_Parse";
@ -56,7 +56,7 @@ sub PW_Circle_Initialize($)
$hash->{AttrList} = "IODev interval do_not_notify:1,0 ". $hash->{AttrList} = "IODev interval do_not_notify:1,0 ".
$readingFnAttributes; $readingFnAttributes;
$hash->{AutoCreate} = $hash->{AutoCreate} =
{ "Circle.*" => { ATTR => "room:Plugwise interval:10"} }; { "PW_Circle.*" => { ATTR => "room:Plugwise interval:10"} };
# Log3 $hash, 3, "PW_Circle_Initialize() Initialize"; # Log3 $hash, 3, "PW_Circle_Initialize() Initialize";
} }
@ -67,11 +67,11 @@ sub PW_Circle_Define($$)
my ($hash, $def) = @_; my ($hash, $def) = @_;
my @a = split("[ \t][ \t]*", $def); my @a = split("[ \t][ \t]*", $def);
my $a = int(@a); my $a = int(@a);
Log 3,"Circle define $a[0]"; #Log 3,"Circle define $a[0]";
return "wrong syntax: define <name> PW_Circle address" if(int(@a) != 3); return "wrong syntax: define <name> PW_Circle address" if(int(@a) != 3);
my $name = $a[0]; my $name = $a[0];
my $code = $a[2]; my $code = $a[2];
my $device_name = "Circle".$DOT.$code; my $device_name = "PW_Circle".$DOT.$code;
#Log 3,Dumper($hash); #Log 3,Dumper($hash);
$hash->{CODE} = $code; $hash->{CODE} = $code;
@ -128,7 +128,7 @@ sub PW_Circle_Set($@)
IOWrite($hash,$hash->{CODE},$opt); IOWrite($hash,$hash->{CODE},$opt);
} elsif($opt =~ "(on|off)-for-timer") } elsif($opt =~ "(on|off)-for-timer")
{ {
if (@a == 3) { if (@a == 1) {
IOWrite($hash,$hash->{CODE},$1); IOWrite($hash,$hash->{CODE},$1);
RemoveInternalTimer("onofffortimer:".$name.":off"); RemoveInternalTimer("onofffortimer:".$name.":off");
RemoveInternalTimer("onofffortimer:".$name.":on"); RemoveInternalTimer("onofffortimer:".$name.":on");
@ -191,7 +191,7 @@ if ($msg->{type} eq "err") {return undef};
$time_old = $time; $time_old = $time;
Log3 $hash,5, Dumper($msg); Log3 $hash,5, Dumper($msg);
my $device_name = "Circle".$DOT.$msg->{short}; my $device_name = "PW_Circle".$DOT.$msg->{short};
Log3 $hash,5,"New Devicename: $device_name"; Log3 $hash,5,"New Devicename: $device_name";
my $def = $modules{PW_Circle}{defptr}{"$device_name"}; my $def = $modules{PW_Circle}{defptr}{"$device_name"};
if(!$def) { if(!$def) {