mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-19 06:36:04 +00:00
93_PWMR.pm : fix content of IODev to support xmllist
git-svn-id: https://svn.fhem.de/fhem/trunk@10640 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
39f4da42ab
commit
be1563f284
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# 94_PWMR.pm
|
# 93_PWMR.pm
|
||||||
# written by Andreas Goebel 2012-07-25
|
# written by Andreas Goebel 2012-07-25
|
||||||
# e-mail: ag at goebel-it dot de
|
# e-mail: ag at goebel-it dot de
|
||||||
#
|
#
|
||||||
@ -23,6 +23,8 @@
|
|||||||
# 22.11.15 GA fix error handling in SetRoom (thanks to cobra112)
|
# 22.11.15 GA fix error handling in SetRoom (thanks to cobra112)
|
||||||
# 30.11.15 GA fix set reading of desired-temp-used to frost_protect if window is opened
|
# 30.11.15 GA fix set reading of desired-temp-used to frost_protect if window is opened
|
||||||
# 30.11.15 GA add call PWMR_Attr in PWMR_Define if already some attributes are defined
|
# 30.11.15 GA add call PWMR_Attr in PWMR_Define if already some attributes are defined
|
||||||
|
# 26.01.16 GA fix don't call AssignIoPort
|
||||||
|
# 26.01.16 GA fix assign IODev as reference to that hash (otherwise xmllist will crash fhem)
|
||||||
|
|
||||||
|
|
||||||
# module for PWM (Pulse Width Modulation) calculation
|
# module for PWM (Pulse Width Modulation) calculation
|
||||||
@ -421,7 +423,7 @@ PWMR_Define($$)
|
|||||||
return "syntax: define <name> PWMR <IODev> <factor[,offset]> <tsensor[:reading[:t_regexp]]> <actor>[:<a_regexp_on>] [<window>[,<window>][:<w_regexp>]]"
|
return "syntax: define <name> PWMR <IODev> <factor[,offset]> <tsensor[:reading[:t_regexp]]> <actor>[:<a_regexp_on>] [<window>[,<window>][:<w_regexp>]]"
|
||||||
if(int(@a) < 6 || int(@a) > 8);
|
if(int(@a) < 6 || int(@a) > 8);
|
||||||
|
|
||||||
my $iodev = $a[2];
|
my $iodevname = $a[2];
|
||||||
my $factor = ((int(@a) > 2) ? $a[3] : 0.2);
|
my $factor = ((int(@a) > 2) ? $a[3] : 0.2);
|
||||||
my $tsensor = ((int(@a) > 3) ? $a[4] : "");
|
my $tsensor = ((int(@a) > 3) ? $a[4] : "");
|
||||||
my $actor = ((int(@a) > 4) ? $a[5] : "");
|
my $actor = ((int(@a) > 4) ? $a[5] : "");
|
||||||
@ -438,15 +440,16 @@ PWMR_Define($$)
|
|||||||
|
|
||||||
#$hash->{helper}{cycletime} = 0;
|
#$hash->{helper}{cycletime} = 0;
|
||||||
|
|
||||||
if ( !$defs{$iodev} ) {
|
if ( !$iodevname ) {
|
||||||
return "unknown device $iodev";
|
return "unknown device $iodevname";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $defs{$iodev}->{TYPE} ne "PWM" ) {
|
if ( $defs{$iodevname}->{TYPE} ne "PWM" ) {
|
||||||
return "wrong type of $iodev (not PWM)";
|
return "wrong type of $iodevname (not PWM)";
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash->{IODev} = $iodev;
|
#$hash->{IODev} = $iodev;
|
||||||
|
$hash->{IODev} = $defs{$iodevname};
|
||||||
|
|
||||||
##########
|
##########
|
||||||
# calculage factoroffset
|
# calculage factoroffset
|
||||||
@ -556,7 +559,7 @@ PWMR_Define($$)
|
|||||||
|
|
||||||
$hash->{INTERVAL} = 300;
|
$hash->{INTERVAL} = 300;
|
||||||
|
|
||||||
AssignIoPort($hash);
|
#AssignIoPort($hash);
|
||||||
|
|
||||||
# if attributes already defined then recall set for them
|
# if attributes already defined then recall set for them
|
||||||
foreach my $oneattr (sort keys %{$attr{$name}})
|
foreach my $oneattr (sort keys %{$attr{$name}})
|
||||||
@ -760,7 +763,8 @@ PWMR_ReadRoom(@)
|
|||||||
my $PWMOnTime = sprintf ("%02s:%02s", int ($newpulse * $cycletime / 60), ($newpulse * $cycletime) % 60);
|
my $PWMOnTime = sprintf ("%02s:%02s", int ($newpulse * $cycletime / 60), ($newpulse * $cycletime) % 60);
|
||||||
|
|
||||||
my $iodev = $room->{IODev};
|
my $iodev = $room->{IODev};
|
||||||
if ($newpulse * $defs{$iodev}->{CYCLETIME} < $defs{$iodev}->{MINONOFFTIME}) {
|
#if ($newpulse * $defs{$iodev}->{CYCLETIME} < $defs{$iodev}->{MINONOFFTIME}) {
|
||||||
|
if ($newpulse * $iodev->{CYCLETIME} < $iodev->{MINONOFFTIME}) {
|
||||||
$PWMPulse = 0;
|
$PWMPulse = 0;
|
||||||
$PWMOnTime = "00:00";
|
$PWMOnTime = "00:00";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user