mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
FHT8V included in the FHEM directory
git-svn-id: https://svn.fhem.de/fhem/trunk@725 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a17c448352
commit
c981e97983
107
fhem/FHEM/11_FHT8V.pm
Executable file
107
fhem/FHEM/11_FHT8V.pm
Executable file
@ -0,0 +1,107 @@
|
||||
#############################################
|
||||
package main;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub
|
||||
FHT8V_Initialize($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
|
||||
$hash->{DefFn} = "FHT8V_Define";
|
||||
$hash->{SetFn} = "FHT8V_Set";
|
||||
$hash->{GetFn} = "FHT8V_Get";
|
||||
$hash->{AttrList} = "IODev dummy:1,0 ignore:1,0 loglevel:0,1,2,3,4,5,6";
|
||||
}
|
||||
|
||||
#############################
|
||||
sub
|
||||
FHT8V_Define($$)
|
||||
{
|
||||
my ($hash, $def) = @_;
|
||||
my @a = split("[ \t][ \t]*", $def);
|
||||
my $n = $a[0];
|
||||
|
||||
return "wrong syntax: define <name> FHT8V housecode [IODev]" if(@a < 3);
|
||||
return "wrong housecode format: specify a 4 digit hex value "
|
||||
if(($a[2] !~ m/^[a-f0-9]{4}$/i));
|
||||
if(@a > 3) {
|
||||
$hash->{IODev} = $defs{$a[3]};
|
||||
} else {
|
||||
AssignIoPort($hash);
|
||||
}
|
||||
return "$n: No IODev found" if(!$hash->{IODev});
|
||||
return "$n: Wrong IODev, has no FHTID" if(!$hash->{IODev}->{FHTID});
|
||||
|
||||
#####################
|
||||
# Check if the address corresponds to the CUL
|
||||
my $ioaddr = hex($hash->{IODev}->{FHTID});
|
||||
my $myaddr = hex($a[2]);
|
||||
my ($io1, $io0) = (int($ioaddr/255), $ioaddr % 256);
|
||||
my ($my1, $my0) = (int($myaddr/255), $myaddr % 256);
|
||||
if($my1 < $io1 || $my1 > $io1+7 || $io0 != $my0) {
|
||||
my $vals = "";
|
||||
for(my $m = 0; $m <= 7; $m++) {
|
||||
$vals .= sprintf(" %2x%2x", $io1+$m, $io0);
|
||||
}
|
||||
return sprintf("Wrong housecode: must be one of$vals");
|
||||
}
|
||||
|
||||
$hash->{ADDR} = uc($a[2]);
|
||||
$hash->{IDX} = sprintf("%02X", $my1-$io1);
|
||||
$hash->{STATE} = "defined";
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
sub
|
||||
FHT8V_Set($@)
|
||||
{
|
||||
my ($hash, @a) = @_;
|
||||
my $n = $hash->{NAME};
|
||||
|
||||
return "Need a parameter for set" if(@a < 2);
|
||||
my $arg = $a[1];
|
||||
|
||||
if($arg eq "valve" ) {
|
||||
return "Set valve needs a numeric parameter between 0 and 100"
|
||||
if(@a != 3 || $a[2] !~ m/^\d+$/ || $a[2] < 0 || $a[2] > 100);
|
||||
Log GetLogLevel($n,3), "FHT8V set $n $arg $a[2]";
|
||||
$hash->{STATE} = sprintf("%d %%", $a[2]);
|
||||
IOWrite($hash, "", sprintf("T%s0026%02X", $hash->{ADDR}, $a[2]*2.55));
|
||||
|
||||
} elsif ($arg eq "pair" ) {
|
||||
Log GetLogLevel($n,3), "FHT8V set $n $arg";
|
||||
IOWrite($hash, "", sprintf("T%s002f00", $hash->{ADDR}));
|
||||
|
||||
} else {
|
||||
return "Unknown argument $a[1], choose one of valve pair"
|
||||
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
sub
|
||||
FHT8V_Get($@)
|
||||
{
|
||||
my ($hash, @a) = @_;
|
||||
my $n = $hash->{NAME};
|
||||
|
||||
return "Need a parameter for get" if(@a < 2);
|
||||
my $arg = $a[1];
|
||||
|
||||
if($arg eq "valve" ) {
|
||||
my $io = $hash->{IODev};
|
||||
my $msg = CallFn($io->{NAME}, "GetFn", $io, (" ", "raw", "T10"));
|
||||
my $idx = $hash->{IDX};
|
||||
return int(hex($1)/2.55) if($msg =~ m/$idx:26(..)/);
|
||||
return "N/A";
|
||||
|
||||
}
|
||||
return "Unknown argument $a[1], choose one of valve"
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -88,6 +88,7 @@
|
||||
<a href="#FHEMRENDERER">FHEMRENDERER</a>
|
||||
<a href="#FHEMWEB">FHEMWEB</a>
|
||||
<a href="#FHT">FHT</a>
|
||||
<a href="#FHT8V">FHT8V</a>
|
||||
<a href="#FHZ">FHZ</a>
|
||||
<a href="#FS20">FS20</a>
|
||||
<a href="#HMS">HMS</a>
|
||||
@ -1135,13 +1136,13 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
corresponding to a button of the transmitter.</li>
|
||||
<li>The optional <code><fgaddr></code> specifies the function group.
|
||||
It is a 2 digit hex or 4 digit ELV address. The first digit of the hex
|
||||
adress must be F or the first 2 digits of the ELV4 address must be
|
||||
address must be F or the first 2 digits of the ELV4 address must be
|
||||
44.</li>
|
||||
<li>The optional <code><lmaddr></code> specifies the local
|
||||
master. It is a 2 digit hex or 4 digit ELV address. The last digit of the
|
||||
hex address must be F or the last 2 digits of the ELV4 address must be
|
||||
44.</li>
|
||||
<li>The optional gm specifies the global master, the adress must be FF if
|
||||
<li>The optional gm specifies the global master, the address must be FF if
|
||||
defined as hex value or 4444 if defined as ELV4 value.</li>
|
||||
</ul>
|
||||
<br>
|
||||
@ -1310,7 +1311,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<br><br>
|
||||
|
||||
<code><housecode></code> is a four digit hex number,
|
||||
corresponding to the adress of the FHT80b device.
|
||||
corresponding to the address of the FHT80b device.
|
||||
<br>
|
||||
|
||||
Examples:
|
||||
@ -1546,6 +1547,77 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
|
||||
</ul>
|
||||
|
||||
<a name="FHT8V"></a>
|
||||
<h3>FHT8V</h3>
|
||||
<ul>
|
||||
Fhem can directly control FHT8V type valves via a <a href="#CUL">CUL</a>
|
||||
device without an intermediate FHT. This paragraph documents one of the
|
||||
building blocks, the other is the <a href="#PID">PID</a> device.
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<a name="FHT8Vdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> FHT <housecode> [IODev]</code>
|
||||
<br><br>
|
||||
|
||||
<code><housecode></code> is a four digit hex number,
|
||||
and must have the following relation to the housecode of the corresponding CUL
|
||||
device:
|
||||
<ul>given the CUL housecode as AABB, then this housecode must be
|
||||
of the form CCBB, where CC is greater or equal to AA, but less then AA+8.
|
||||
</ul>
|
||||
This form is chosen so that the CUL can update all FHT8V valve states
|
||||
within 2 minutes.
|
||||
<br>
|
||||
<br>
|
||||
<code><IODev></code> must be specified if the last defined CUL device
|
||||
is not the one to use. Usually this is done voa the <a
|
||||
href="#IODev">IODev</a> attribute, but as the address checked is performed
|
||||
at the definition, we must use an exception here.
|
||||
<br>
|
||||
|
||||
Examples:
|
||||
<ul>
|
||||
<code>define wz FHT8V 3232</code><br>
|
||||
</ul>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
<a name="FHT8Vset"></a>
|
||||
<b>Set </b>
|
||||
<ul>
|
||||
<li>set <name> valve <value;><br>
|
||||
Set the valve to the given value (in percent, from 0 to 100).
|
||||
</li>
|
||||
<li>set <name> pair<br>
|
||||
Pair the valve with the CUL.
|
||||
</li>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
<a name="FHT8Vget"></a>
|
||||
<b>Get </b>
|
||||
<ul>
|
||||
<li>get <name> valve<br>
|
||||
Read back the valve position from the CUL FHT buffer, and convert it to percent (from 0 to 100).
|
||||
</li>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
<a name="FHT8Vattr"></a>
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<li><a href="#IODev">IODev</a></li>
|
||||
<li><a href="#dummy">loglevel</a></li>
|
||||
<li><a href="#ignore">ignore</a></li>
|
||||
<li><a href="#loglevel">loglevel</a></li>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<a name="CUL_FHTTK"></a>
|
||||
<h3>CUL_FHTTK</h3>
|
||||
@ -1611,7 +1683,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<br><br>
|
||||
|
||||
<code><housecode></code> is a four digit hex number,
|
||||
corresponding to the adress of the HMS device.
|
||||
corresponding to the address of the HMS device.
|
||||
<br>
|
||||
|
||||
Examples:
|
||||
@ -2442,7 +2514,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<br><br>
|
||||
|
||||
<code><housecode></code> is a four digit hex number,
|
||||
corresponding to the adress of the KS300 device, right now it is ignored.
|
||||
corresponding to the address of the KS300 device, right now it is ignored.
|
||||
The ml/raincounter defaults to 255 ml, but it must be specified if you wish
|
||||
to set the wind factor, which defaults to 1.0.
|
||||
<br>
|
||||
|
@ -160,7 +160,7 @@ my $nextat; # Time when next timer will be triggered.
|
||||
my $intAtCnt=0;
|
||||
my %duplicate; # Pool of received msg for multi-fhz/cul setups
|
||||
my $duplidx=0; # helper for the above pool
|
||||
my $cvsid = '$Id: fhem.pl,v 1.112 2010-10-08 07:07:40 rudolfkoenig Exp $';
|
||||
my $cvsid = '$Id: fhem.pl,v 1.113 2010-10-10 08:23:29 rudolfkoenig Exp $';
|
||||
my $namedef =
|
||||
"where <name> is either:\n" .
|
||||
"- a single device name\n" .
|
||||
@ -1095,12 +1095,14 @@ CommandDefine($$)
|
||||
if($ret) {
|
||||
delete $defs{$a[0]}; # Veto
|
||||
delete $attr{$a[0]};
|
||||
|
||||
} else {
|
||||
foreach my $da (sort keys (%defaultattr)) { # Default attributes
|
||||
CommandAttr($cl, "$a[0] $da $defaultattr{$da}");
|
||||
}
|
||||
}
|
||||
DoTrigger("global", "DEFINED $a[0]");
|
||||
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user