mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 17:26:34 +00:00
FHT sending added to CUL
git-svn-id: https://svn.fhem.de/fhem/trunk@378 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c2b24391c4
commit
800a10a557
@ -499,3 +499,4 @@
|
|||||||
- feature: FHEMWEB modules added
|
- feature: FHEMWEB modules added
|
||||||
- feature: holiday module + doc + example + holiday2we attribute
|
- feature: holiday module + doc + example + holiday2we attribute
|
||||||
- bugfix: sunrise stuff fixed, doc missing
|
- bugfix: sunrise stuff fixed, doc missing
|
||||||
|
- feature: CUL FHT sending added
|
||||||
|
@ -77,15 +77,18 @@ CUL_Define($$)
|
|||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
my $po;
|
my $po;
|
||||||
|
|
||||||
return "wrong syntax: define <name> CUL devicename [mobile]"
|
return "wrong syntax: define <name> CUL devicename <FHTID> [mobile]"
|
||||||
if(@a < 3 || @a > 4);
|
if(@a < 4 || @a > 5);
|
||||||
|
|
||||||
delete $hash->{PortObj};
|
delete $hash->{PortObj};
|
||||||
delete $hash->{FD};
|
delete $hash->{FD};
|
||||||
|
|
||||||
my $name = $a[0];
|
my $name = $a[0];
|
||||||
my $dev = $a[2];
|
my $dev = $a[2];
|
||||||
$hash->{MOBILE} = 1 if($a[3] && $a[3] eq "mobile");
|
return "FHTID must be H1H2, with H1 and H2 hex and both smaller than 64"
|
||||||
|
if($a[3] !~ m/^[0-6]\d[0-6]\d$/);
|
||||||
|
$hash->{FHTID} = uc($a[3]);
|
||||||
|
$hash->{MOBILE} = 1 if($a[4] && $a[4] eq "mobile");
|
||||||
$hash->{STATE} = "defined";
|
$hash->{STATE} = "defined";
|
||||||
|
|
||||||
$attr{$name}{savefirst} = 1;
|
$attr{$name}{savefirst} = 1;
|
||||||
@ -460,6 +463,19 @@ CUL_DoInit($)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CUL_SimpleWrite($hash, $initstr);
|
CUL_SimpleWrite($hash, $initstr);
|
||||||
|
|
||||||
|
# FHTID
|
||||||
|
my $fhtid;
|
||||||
|
CUL_SimpleWrite($hash, "T01");
|
||||||
|
($err, $fhtid) = CUL_ReadAnswer($hash, "FHTID", 0);
|
||||||
|
return "$name: $err" if($err);
|
||||||
|
$fhtid =~ s/[\r\n]//g;
|
||||||
|
Log 5, "GOT CUL fhtid: $fhtid";
|
||||||
|
if(!defined($fhtid) || $fhtid ne $hash->{FHTID}) {
|
||||||
|
Log 2, "Setting CUL fhtid to " . $hash->{FHTID};
|
||||||
|
CUL_SimpleWrite($hash, "T01" . $hash->{FHTID});
|
||||||
|
}
|
||||||
|
|
||||||
$hash->{STATE} = "Initialized";
|
$hash->{STATE} = "Initialized";
|
||||||
|
|
||||||
# Reset the counter
|
# Reset the counter
|
||||||
@ -558,6 +574,19 @@ CUL_Write($$$)
|
|||||||
} elsif($fn eq "04" && substr($msg,0,6) eq "010101") { # FS20
|
} elsif($fn eq "04" && substr($msg,0,6) eq "010101") { # FS20
|
||||||
$fn = "F";
|
$fn = "F";
|
||||||
$msg = substr($msg,6);
|
$msg = substr($msg,6);
|
||||||
|
} elsif($fn eq "04" && substr($msg,0,6) eq "020183") { # FHT
|
||||||
|
|
||||||
|
my $moff = 10;
|
||||||
|
Log 1, "Parse: $msg";
|
||||||
|
while(length($msg) > $moff) {
|
||||||
|
my $snd = substr($msg,6,4) .
|
||||||
|
substr($msg,$moff,2) . "79" . substr($msg,$moff+2,2);
|
||||||
|
Log 1, "Dumping: T$snd";
|
||||||
|
$hash->{PortObj}->write("T$snd\n");
|
||||||
|
$moff += 4;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log GetLogLevel($name,2), "CUL cannot translate $fn $msg";
|
Log GetLogLevel($name,2), "CUL cannot translate $fn $msg";
|
||||||
return;
|
return;
|
||||||
|
@ -412,12 +412,14 @@ FHT_Parse($$)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd = "FHZ:$cmd" if(substr($msg,24,1) eq "7");
|
if(substr($msg,24,1) eq "7") {
|
||||||
|
$cmd = "FHZ:$cmd";
|
||||||
$def->{READINGS}{$cmd}{TIME} = $tn;
|
} else {
|
||||||
$def->{READINGS}{$cmd}{VAL} = $val;
|
$def->{READINGS}{$cmd}{TIME} = $tn;
|
||||||
|
$def->{READINGS}{$cmd}{VAL} = $val;
|
||||||
|
$def->{STATE} = "$cmd: $val" if($cmd eq "measured-temp");
|
||||||
|
}
|
||||||
$def->{CHANGED}[0] = "$cmd: $val";
|
$def->{CHANGED}[0] = "$cmd: $val";
|
||||||
$def->{STATE} = "$cmd: $val" if($cmd eq "measured-temp");
|
|
||||||
|
|
||||||
Log 4, "FHT $name $cmd: $val";
|
Log 4, "FHT $name $cmd: $val";
|
||||||
|
|
||||||
|
@ -96,7 +96,8 @@ KS300_Parse($$)
|
|||||||
"israining", "unknown1", "unknown2", "unknown3");
|
"israining", "unknown1", "unknown2", "unknown3");
|
||||||
my @sfx = ( "(counter)", "(l/m2)", "(km/h)", "(%)", "(Celsius)",
|
my @sfx = ( "(counter)", "(l/m2)", "(km/h)", "(%)", "(Celsius)",
|
||||||
"(yes/no)", "","","");
|
"(yes/no)", "","","");
|
||||||
|
my %repchanged = ("rain"=>1, "wind"=>1, "humidity"=>1, "temperature"=>1,
|
||||||
|
"israining"=>1);
|
||||||
|
|
||||||
# counter for the change hash
|
# counter for the change hash
|
||||||
my $n= 1; # 0 is STATE and will b explicitely set
|
my $n= 1; # 0 is STATE and will b explicitely set
|
||||||
@ -194,12 +195,10 @@ KS300_Parse($$)
|
|||||||
# remember tsecs
|
# remember tsecs
|
||||||
$r->{tsecs}{TIME} = $tm;
|
$r->{tsecs}{TIME} = $tm;
|
||||||
$r->{tsecs}{VAL} = "$tsecs";
|
$r->{tsecs}{VAL} = "$tsecs";
|
||||||
$def->{CHANGED}[$n++] = "tsecs: $tsecs";
|
|
||||||
|
|
||||||
# remember rain_raw_adj
|
# remember rain_raw_adj
|
||||||
$r->{rain_raw_adj}{TIME} = $tm;
|
$r->{rain_raw_adj}{TIME} = $tm;
|
||||||
$r->{rain_raw_adj}{VAL} = $rain_raw_adj;
|
$r->{rain_raw_adj}{VAL} = $rain_raw_adj;
|
||||||
$def->{CHANGED}[$n++] = "rain_raw_adj: $rain_raw_adj";
|
|
||||||
|
|
||||||
|
|
||||||
# KS300 has a sensor which detects any drop of rain and immediately
|
# KS300 has a sensor which detects any drop of rain and immediately
|
||||||
@ -238,7 +237,8 @@ KS300_Parse($$)
|
|||||||
$r->{$txt[$i]}{TIME} = $tm;
|
$r->{$txt[$i]}{TIME} = $tm;
|
||||||
$val = "$v[$i] $sfx[$i]";
|
$val = "$v[$i] $sfx[$i]";
|
||||||
$r->{$txt[$i]}{VAL} = $val;
|
$r->{$txt[$i]}{VAL} = $val;
|
||||||
$def->{CHANGED}[$n++] = "$txt[$i]: $val";
|
$def->{CHANGED}[$n++] = "$txt[$i]: $val"
|
||||||
|
if(defined($repchanged{$txt[$i]}));
|
||||||
}
|
}
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
|
@ -41,7 +41,7 @@ CUL_WS_Define($$)
|
|||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
|
|
||||||
return "wrong syntax: define <name> CUL_WS <code> [corr1...corr4]"
|
return "wrong syntax: define <name> CUL_WS <code> [corr1...corr4]"
|
||||||
if(int(@a) < 3 || int(@a) > 6);
|
if(int(@a) < 3 || int(@a) > 7);
|
||||||
$a[2] = lc($a[2]);
|
$a[2] = lc($a[2]);
|
||||||
return "Define $a[0]: wrong CODE format: valid is 1-8"
|
return "Define $a[0]: wrong CODE format: valid is 1-8"
|
||||||
if($a[2] !~ m/^[1-8]$/);
|
if($a[2] !~ m/^[1-8]$/);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
FHEM:
|
FHEM:
|
||||||
- Remote serial device via IP (for the FHZ1300 WLAN)
|
- Remote serial device via IP (for the FHZ1300 WLAN)
|
||||||
- Common buffer for parallel use of two devices: CUL+FHZ, (WS300/EM1000PC?)
|
- Common buffer for parallel use of two devices: CUL+FHZ, (WS300/EM1000PC?)
|
||||||
- holiday database
|
|
||||||
- fhem-to-fhem module
|
- fhem-to-fhem module
|
||||||
- CUR built-in MENU creation support
|
- CUR built-in MENU creation support
|
||||||
- Remove or reimplement repeater attribute (cul/fhz/doc)
|
- Remove or reimplement repeater attribute (cul/fhz/doc)
|
||||||
|
26
fhem/fhem.pl
26
fhem/fhem.pl
@ -151,7 +151,7 @@ my %defaultattr; # Default attributes
|
|||||||
my %intAt; # Internal at timer hash.
|
my %intAt; # Internal at timer hash.
|
||||||
my $nextat; # Time when next timer will be triggered.
|
my $nextat; # Time when next timer will be triggered.
|
||||||
my $intAtCnt=0;
|
my $intAtCnt=0;
|
||||||
my $cvsid = '$Id: fhem.pl,v 1.71 2009-05-23 07:32:08 rudolfkoenig Exp $';
|
my $cvsid = '$Id: fhem.pl,v 1.72 2009-05-30 15:11:56 rudolfkoenig Exp $';
|
||||||
my $namedef =
|
my $namedef =
|
||||||
"where <name> is either:\n" .
|
"where <name> is either:\n" .
|
||||||
"- a single device name\n" .
|
"- a single device name\n" .
|
||||||
@ -613,9 +613,15 @@ devspec2array($)
|
|||||||
if($l =~ m/(.*)=(.*)/) {
|
if($l =~ m/(.*)=(.*)/) {
|
||||||
my ($lattr,$re) = ($1, $2);
|
my ($lattr,$re) = ($1, $2);
|
||||||
if($knownattr{$lattr}) {
|
if($knownattr{$lattr}) {
|
||||||
foreach my $l (sort keys %defs) {
|
eval { # a bad regexp may shut down fhem.pl
|
||||||
push @ret, $l
|
foreach my $l (sort keys %defs) {
|
||||||
if($defs{$l}{$lattr} && (!$re || $defs{$l}{$lattr} =~ m/$re/));
|
push @ret, $l
|
||||||
|
if($defs{$l}{$lattr} && (!$re || $defs{$l}{$lattr} =~ m/$re/));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if($@) {
|
||||||
|
Log 1, "devspec2array $name: $@";
|
||||||
|
return $name;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach my $l (sort keys %attr) {
|
foreach my $l (sort keys %attr) {
|
||||||
@ -627,9 +633,15 @@ devspec2array($)
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($l =~ m/[*\[\]^\$]/) { # Regexp
|
eval { # a bad regexp may shut down fhem.pl
|
||||||
push @ret, grep($_ =~ m/$l/, sort keys %defs);
|
if($l =~ m/[*\[\]^\$]/) { # Regexp
|
||||||
next;
|
push @ret, grep($_ =~ m/$l/, sort keys %defs);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if($@) {
|
||||||
|
Log 1, "devspec2array $name: $@";
|
||||||
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($l =~ m/-/) { # Range
|
if($l =~ m/-/) { # Range
|
||||||
|
Loading…
x
Reference in New Issue
Block a user