2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

add optional diff-temp to dewpoint fan

git-svn-id: https://svn.fhem.de/fhem/trunk@1877 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
wherzig 2012-09-19 20:19:00 +00:00
parent c52f1f27b6
commit e23cd23950
2 changed files with 19 additions and 11 deletions

View File

@ -73,11 +73,16 @@ dewpoint_Define($$)
}
} elsif ($cmd_type eq "fan") {
# define <name> dewpoint fan devicename-regex devicename-outside min_temp
if(@a == 6) {
if (@a == 6 || @a == 7) {
$hash->{DEVNAME_OUT} = $a[4];
$hash->{MIN_TEMP} = $a[5];
if (@a == 6) {
$hash->{DIFF_TEMP} = 0;
} else {
return "wrong syntax: define <name> dewpoint fan devicename-regex devicename-outside min_temp"
$hash->{DIFF_TEMP} = $a[6];
}
} else {
return "wrong syntax: define <name> dewpoint fan devicename-regex devicename-outside min_temp [diff_temp]"
}
} elsif ($cmd_type eq "alarm") {
# define <name> dewpoint alarm devicename-regex devicename-reference diff_temp
@ -147,7 +152,8 @@ dewpoint_Notify($$)
}
$devname_out = $hash->{DEVNAME_OUT};
$min_temp = $hash->{MIN_TEMP};
Log 1, "dewpoint_notify: cmd_type=$cmd_type devname=$devName dewname=$hashName, dev=$devName, dev_regex=$re, devname_out=$devname_out, min_temp=$min_temp" if ($dewpoint_debug == 1);
$diff_temp = $hash->{DIFF_TEMP};
Log 1, "dewpoint_notify: cmd_type=$cmd_type devname=$devName dewname=$hashName, dev=$devName, dev_regex=$re, devname_out=$devname_out, min_temp=$min_temp, diff_temp=$diff_temp" if ($dewpoint_debug == 1);
} elsif ($cmd_type eq "alarm") {
if (!defined($hash->{DEVNAME_REF}) || !defined($hash->{DIFF_TEMP})) {
@ -251,16 +257,16 @@ dewpoint_Notify($$)
Log 1, "dewpoint_notify: current=$current" if ($dewpoint_debug == 1);
} elsif ($cmd_type eq "fan") {
# >define <name> dewpoint fan devicename devicename-outside min-temp
# >define <name> dewpoint fan devicename devicename-outside min-temp [diff-temp]
#
# This define may be used to turn an fan on or off if the outside air has less
# water
#
# - Generate reading/event "fan: on" if dewpoint of <devicename-outside> is lower
# - Generate reading/event "fan: on" if (dewpoint of <devicename-outside>) + diff_temp is lower
# than dewpoint of <devicename> and temperature of <devicename-outside> is >= min-temp
# and reading "fan" was not already "on".
# - Generate reading/event "fan: off": else and if reading "fan" was not already "off".
Log 1, "dewpoint_notify: fan devname_out=$devname_out, min_temp=$min_temp" if ($dewpoint_debug == 1);
Log 1, "dewpoint_notify: fan devname_out=$devname_out, min_temp=$min_temp, diff_temp=$diff_temp" if ($dewpoint_debug == 1);
my $sensor;
my $current;
if (exists $defs{$devname_out}{READINGS}{temperature}{VAL} && exists $defs{$devname_out}{READINGS}{humidity}{VAL}) {
@ -268,7 +274,7 @@ dewpoint_Notify($$)
my $humidity_out = $defs{$devname_out}{READINGS}{humidity}{VAL};
my $dewpoint_out = sprintf("%.1f", dewpoint_dewpoint($temperature_out,$humidity_out));;
Log 1, "dewpoint_notify: fan dewpoint_out=$dewpoint_out" if ($dewpoint_debug == 1);
if ($dewpoint_out < $dewpoint && $temperature_out >= $min_temp) {
if (($dewpoint_out + $diff_temp) < $dewpoint && $temperature_out >= $min_temp) {
$current = "on";
Log 1, "dewpoint_notify: fan ON" if ($dewpoint_debug == 1);
} else {

View File

@ -1442,6 +1442,7 @@ A line ending with \ will be concatenated with the next one, so long lines
&lt;regexp&gt;.<br><br>
</ul>
<br>
<a name="Calendarattr"></a>
@ -6962,6 +6963,7 @@ The one byte hex string is generated by the Oregon sensor when is it powered on.
<a name="OREGONset"></a>
<b>Set</b> <ul>N/A</ul><br>
<a name="OREGONget"></a>
<b>Get</b> <ul>N/A</ul><br>
@ -10184,15 +10186,15 @@ KlikAanKlikUit, NEXA, CHACON, HomeEasy UK. <br> You need to define an RFXtrx433
</ul>
<ul>
<code>define &lt;name&gt; dewpoint fan &lt;devicename-regex&gt; &lt;devicename-outside&gt; &lt;min-temp&gt;</code><br>
<code>define &lt;name&gt; dewpoint fan &lt;devicename-regex&gt; &lt;devicename-outside&gt; &lt;min-temp&gt; [&lt;diff_temp&gt;]</code><br>
<br>
<ul>
May be used to turn an fan on or off if the outside air has less water.
<ul>
<li>
Generate event "fan: on" if dewpoint of &lt;devicename-outside&gt; is lower
Generate event "fan: on" if (dewpoint of &lt;devicename-outside&gt;) + &lt;diff_temp&gt; is lower
than dewpoint of &lt;devicename&gt; and temperature of &lt;devicename-outside&gt; is &gt;= min-temp
and reading "fan" was not already "on". The event will be generated for &lt;devicename&gt;.</li>
and reading "fan" was not already "on". The event will be generated for &lt;devicename&gt;. Parameter &lt;diff-temp&gt; is optional</li>
<li>Generate event "fan: off": else and if reading "fan" was not already "off".</li>
</ul>
</ul>