From ad35c3e913e9758ea7377275dda53e9b19bcc07b Mon Sep 17 00:00:00 2001 From: jamesgo <> Date: Fri, 4 Dec 2015 12:50:05 +0000 Subject: [PATCH] 93_PWMR.pm : new reading desired-temp-used (desired-temp used in calculation e.g. when window is set to state open) modification of definition in web gui will now also consider parameters changed by attributes git-svn-id: https://svn.fhem.de/fhem/trunk@10082 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/93_PWMR.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/fhem/contrib/93_PWMR.pm b/fhem/contrib/93_PWMR.pm index c5d6540f9..06c3d70d1 100644 --- a/fhem/contrib/93_PWMR.pm +++ b/fhem/contrib/93_PWMR.pm @@ -21,6 +21,8 @@ # 19.11.15 GA fix move actorState to readings # 22.11.15 GA fix rules on wednesday are now possible (thanks to Skusi) # 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 add call PWMR_Attr in PWMR_Define if already some attributes are defined # module for PWM (Pulse Width Modulation) calculation @@ -416,7 +418,7 @@ PWMR_Define($$) my $name = $hash->{NAME}; - return "syntax: define PWMR [:] [[,]:]" + return "syntax: define PWMR [:] [[,][:]]" if(int(@a) < 6 || int(@a) > 8); my $iodev = $a[2]; @@ -556,6 +558,12 @@ PWMR_Define($$) AssignIoPort($hash); + # if attributes already defined then recall set for them + foreach my $oneattr (sort keys %{$attr{$name}}) + { + PWMR_Attr ("set", $name, $oneattr, $attr{$name}{$oneattr}); + } + if($hash->{INTERVAL}) { InternalTimer(gettimeofday()+10, "PWMR_CalcDesiredTemp", $hash, 0); } @@ -735,6 +743,7 @@ PWMR_ReadRoom(@) if ($windowV > 0) { $desiredTemp = $room->{c_tempFrostProtect}; + } else { $desiredTemp = $room->{READINGS}{"desired-temp"}{VAL}; } @@ -757,6 +766,7 @@ PWMR_ReadRoom(@) } readingsBeginUpdate ($room); + readingsBulkUpdate ($room, "desired-temp-used", $desiredTemp); readingsBulkUpdate ($room, "PWMOnTime", $PWMOnTime); readingsBulkUpdate ($room, "PWMPulse", $PWMPulse); readingsBulkUpdate ($room, "temperature", $temperaturV); @@ -1036,7 +1046,7 @@ PWMR_Boost(@) #DoTrigger($name, undef); Log3 ($room, 4, "PWMR_Boost: $name ". - "set desiredtemp ".$room->{READINGS}{"desired-temp"}{TIME}." ". + "set desired-temp ".$room->{READINGS}{"desired-temp"}{TIME}." for ". $room->{READINGS}{"desired-temp"}{VAL}); } else { @@ -1075,7 +1085,7 @@ PWMR_Boost(@) Define
    - define <name> PWMR <IODev> <factor[,offset]> <tsensor[:reading:t_regexp]> <actor>[:<a_regexp_on>] [<window>[,<window>:w_regexp]
    + define <name> PWMR <IODev> <factor[,offset]> <tsensor[:reading:[t_regexp]]> <actor>[:<a_regexp_on>] [<window>[,<window>[:w_regexp]]

    Define a calculation object with the following parameters:
    @@ -1090,7 +1100,7 @@ PWMR_Boost(@) factor can be used to weight rooms.
    -
  • tsensor[:reading:t_regexp]
    +
  • tsensor[:reading[:t_regexp]]
    tsensor defines the temperature sensor for the actual room temperature.
    reading defines the reading of the temperature sensor. Default is "temperature"
    t_regexp defines a regular expression to be applied to the reading. Default is '([\\d\\.]*)'.
    @@ -1101,7 +1111,7 @@ PWMR_Boost(@) a_regexp_on defines a regular expression to be applied to the state of the actor. Default is 'on". If state matches the regular expression it is handled as "on", otherwise "off"
  • -
  • window[,window]:w_regexp
    +
  • window[,window][:w_regexp]
    window defines several window devices that can prevent heating to be turned on. If STATE matches the regular expression then the desired-temp will be decreased to frost-protect temperature.
    w_regexp defines a regular expression to be applied to the reading. Default is '.*Open.*'.