From 3245aadb8efdb92f49b6f5165fe626f08c1aa09c Mon Sep 17 00:00:00 2001 From: jamesgo <> Date: Wed, 27 Dec 2017 11:38:12 +0000 Subject: [PATCH] 93_PWMR.pm : desiredTempFrom now handles Homematic on/off git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@15703 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/93_PWMR.pm | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/FHEM/93_PWMR.pm b/FHEM/93_PWMR.pm index 7d7218781..7395d26cd 100644 --- a/FHEM/93_PWMR.pm +++ b/FHEM/93_PWMR.pm @@ -45,6 +45,7 @@ # 14.12.16 GA fix supply DBuffer with delta temps for usePID=2 calculation # 14.12.16 GA add implement get previousTemps # 01.08.17 GA add documentation for attribute disable +# 27.12.17 GA add handle "off" as c_tempFrostProtect and "on" as c_tempC in getDesiredTempFrom (valid form Homematic) # module for PWM (Pulse Width Modulation) calculation @@ -152,9 +153,21 @@ PWMR_getDesiredTempFrom(@) $newTemp = $1; Log3 ($hash, 4, "PWMR_getDesiredTempFrom $hash->{NAME}: from $dt->{NAME} reading($d_reading) VAL($d_readingVal) regexp($d_regexpTemp) regexpVal($val)"); - } else { - $newTemp = $hash->{c_tempFrostProtect}; - Log3 ($hash, 4, "PWMR_getDesiredTempFrom $hash->{NAME}: from $dt->{NAME} reading($d_reading) VAL($d_readingVal) regexp($d_regexpTemp) regexpVal($val) set to frostProtect"); + } else { # regexp does not match + + if ($val =~ /^on$/) { + $newTemp = $hash->{c_tempC}; + Log3 ($hash, 4, "PWMR_getDesiredTempFrom $hash->{NAME}: from $dt->{NAME} reading($d_reading) VAL($d_readingVal) regexp($d_regexpTemp) regexpVal($val) set to 30"); + + } elsif ( $val =~ /^off$/ ) { + + $newTemp = $hash->{c_tempFrostProtect}; + Log3 ($hash, 4, "PWMR_getDesiredTempFrom $hash->{NAME}: from $dt->{NAME} reading($d_reading) VAL($d_readingVal) regexp($d_regexpTemp) regexpVal($val) set to frostProtect"); + } else { + + $newTemp = $hash->{c_tempFrostProtect}; + Log3 ($hash, 4, "PWMR_getDesiredTempFrom $hash->{NAME}: from $dt->{NAME} reading($d_reading) VAL($d_readingVal) regexp($d_regexpTemp) regexpVal($val) set to frostProtect"); + } } @@ -483,7 +496,7 @@ PWMR_Set($@) if ( $cmd eq "frostProtect" ) { my $val = $a[2]; if ( $val eq "on" ) { - $hash->{c_frostProtect} = 1; + $hash->{c_frostProtect} = 1; $attr{$name}{frostProtect} = 1; return undef; } elsif ( $val eq "off" ) { @@ -1865,7 +1878,11 @@ PWMR_valueFormat(@) If regexp does not match (e.g. reading is 'off') then tempFrostProtect is used.
Internals c_desiredTempFrom reflects the actual setting and d_name, d_reading und d_regexpTemp the values used.
If this attribute is used then state will change from "Calculating" to "From <device>".
- Calculation of desired-temp is (like when using tempRules) based on the interval specified for this device (default is 300 seconds). + Calculation of desired-temp is (like when using tempRules) based on the interval specified for this device (default is 300 seconds).
+ Special values "on" and "off" of Homematic devices are handled as c_tempC (set by attribute tempCosy) and c_tempFrostProtect (set by attribute tempFrostProtect). + + +
  • valueFormat