mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
threestate sensor devicepair, HMLAN prepare for improvement with wakeup
git-svn-id: https://svn.fhem.de/fhem/trunk@2350 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
964ca01eb6
commit
10885385a4
@ -132,7 +132,8 @@ HMLAN_Set($@)
|
|||||||
$hash->{hmPair} = 1;
|
$hash->{hmPair} = 1;
|
||||||
InternalTimer(gettimeofday()+$arg, "HMLAN_RemoveHMPair", "hmPairForSec:".$hash, 1);
|
InternalTimer(gettimeofday()+$arg, "HMLAN_RemoveHMPair", "hmPairForSec:".$hash, 1);
|
||||||
|
|
||||||
} elsif($type eq "hmPairSerial") { ################################
|
}
|
||||||
|
elsif($type eq "hmPairSerial") { ################################
|
||||||
return "Usage: set $name hmPairSerial <10-character-serialnumber>"
|
return "Usage: set $name hmPairSerial <10-character-serialnumber>"
|
||||||
if(!$arg || $arg !~ m/^.{10}$/);
|
if(!$arg || $arg !~ m/^.{10}$/);
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ HMLAN_ReadAnswer($$$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my %lhash;
|
my %lhash = ""; # remember which ID is assigned to this HMLAN
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
@ -221,8 +222,10 @@ HMLAN_Write($$$)
|
|||||||
my $IDadd = '+'.$dst; # guess: add ID?
|
my $IDadd = '+'.$dst; # guess: add ID?
|
||||||
my $IDsub = '-'.$dst; # guess: ID remove?
|
my $IDsub = '-'.$dst; # guess: ID remove?
|
||||||
|
|
||||||
HMLAN_SimpleWrite($hash, $IDadd) if (!$lhash{$dst} && $dst ne "000000");
|
if (!$lhash{$dst} && $dst ne "000000"){
|
||||||
|
HMLAN_SimpleWrite($hash, $IDadd);
|
||||||
$lhash{$dst} = 1;
|
$lhash{$dst} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
my $tm = int(gettimeofday()*1000) % 0xffffffff;
|
my $tm = int(gettimeofday()*1000) % 0xffffffff;
|
||||||
$msg = sprintf("S%08X,00,00000000,01,%08X,%s",$tm, $tm, substr($msg, 4));
|
$msg = sprintf("S%08X,00,00000000,01,%08X,%s",$tm, $tm, substr($msg, 4));
|
||||||
@ -317,7 +320,7 @@ HMLAN_Parse($$)
|
|||||||
# HMLAN_SimpleWrite($hash, '-'.$src);
|
# HMLAN_SimpleWrite($hash, '-'.$src);
|
||||||
# HMLAN_SimpleWrite($hash, '+'.$src);
|
# HMLAN_SimpleWrite($hash, '+'.$src);
|
||||||
# }
|
# }
|
||||||
$dmsg .= "NACK" if($mFld[1] !~ m/00(01|02|21)/ && $letter eq 'R');
|
$dmsg .= ":NACK" if($mFld[1] !~ m/00(01|02|21)/ && $letter eq 'R');
|
||||||
|
|
||||||
$hash->{uptime} = HMLAN_uptime($mFld[2]);
|
$hash->{uptime} = HMLAN_uptime($mFld[2]);
|
||||||
$hash->{RSSI} = hex($mFld[4])-65536;
|
$hash->{RSSI} = hex($mFld[4])-65536;
|
||||||
@ -335,7 +338,7 @@ HMLAN_Parse($$)
|
|||||||
$hash->{helper}{keepAliveRec} = 1;
|
$hash->{helper}{keepAliveRec} = 1;
|
||||||
Log $ll5, 'HMLAN_Parse: '.$name. ' V:'.$mFld[1]
|
Log $ll5, 'HMLAN_Parse: '.$name. ' V:'.$mFld[1]
|
||||||
.' sNo:'.$mFld[2].' d:'.$mFld[3]
|
.' sNo:'.$mFld[2].' d:'.$mFld[3]
|
||||||
.' O:' .$mFld[4].' m:'.$mFld[5].' d2:'.$mFld[6];
|
.' O:' .$mFld[4].' m:'.$mFld[5].' IDcnt:'.$mFld[6];
|
||||||
my $myId = AttrVal($name, "hmId", $mFld[4]);
|
my $myId = AttrVal($name, "hmId", $mFld[4]);
|
||||||
if(lc($mFld[4]) ne lc($myId) && !AttrVal($name, "dummy", 0)) {
|
if(lc($mFld[4]) ne lc($myId) && !AttrVal($name, "dummy", 0)) {
|
||||||
Log 1, 'HMLAN setting owner to '.$myId.' from '.$mFld[4];
|
Log 1, 'HMLAN setting owner to '.$myId.' from '.$mFld[4];
|
||||||
@ -437,6 +440,7 @@ HMLAN_DoInit($)
|
|||||||
HMLAN_SimpleWrite($hash, "Y03,00,");
|
HMLAN_SimpleWrite($hash, "Y03,00,");
|
||||||
HMLAN_SimpleWrite($hash, "T$s2000,04,00,00000000");
|
HMLAN_SimpleWrite($hash, "T$s2000,04,00,00000000");
|
||||||
|
|
||||||
|
%lhash = '';# clear IDs - HMLAN might have a reset
|
||||||
$hash->{helper}{keepAliveRec} = 1; # ok for first time
|
$hash->{helper}{keepAliveRec} = 1; # ok for first time
|
||||||
RemoveInternalTimer( "keepAlive:".$name);# avoid duplicate timer
|
RemoveInternalTimer( "keepAlive:".$name);# avoid duplicate timer
|
||||||
InternalTimer(gettimeofday()+25, "HMLAN_KeepAlive", "keepAlive:".$name, 0);
|
InternalTimer(gettimeofday()+25, "HMLAN_KeepAlive", "keepAlive:".$name, 0);
|
||||||
|
@ -8,7 +8,6 @@ package main;
|
|||||||
# the lines can be removed after some soak time - around version 2600
|
# the lines can be removed after some soak time - around version 2600
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
#use Time::HiRes qw(gettimeofday);
|
|
||||||
|
|
||||||
sub CUL_HM_Initialize($);
|
sub CUL_HM_Initialize($);
|
||||||
sub CUL_HM_Define($$);
|
sub CUL_HM_Define($$);
|
||||||
@ -354,8 +353,9 @@ CUL_HM_Parse($$)
|
|||||||
($dst eq "000000" ? "broadcast" :
|
($dst eq "000000" ? "broadcast" :
|
||||||
($dst eq $id ? $iohash->{NAME} : $dst));
|
($dst eq $id ? $iohash->{NAME} : $dst));
|
||||||
my $target = " (to $dname)";
|
my $target = " (to $dname)";
|
||||||
|
my $msgStat;
|
||||||
return "" if($p =~ m/NACK$/);#discard TCP errors from HMlan. Resend will cover it
|
($p,$msgStat) = split(":",$p,2);
|
||||||
|
return "" if($msgStat && $msgStat eq 'NACK');#discard TCP errors from HMlan. Resend will cover it
|
||||||
return "" if($src eq $id);#discard mirrored messages
|
return "" if($src eq $id);#discard mirrored messages
|
||||||
|
|
||||||
$respRemoved = 0; #set to 'no response in this message' at start
|
$respRemoved = 0; #set to 'no response in this message' at start
|
||||||
@ -391,7 +391,7 @@ CUL_HM_Parse($$)
|
|||||||
if($shash->{lastMsg} && $shash->{lastMsg} eq $msgX) {
|
if($shash->{lastMsg} && $shash->{lastMsg} eq $msgX) {
|
||||||
Log GetLogLevel($name,4), "CUL_HM $name dup mesg";
|
Log GetLogLevel($name,4), "CUL_HM $name dup mesg";
|
||||||
if(($id eq $dst)&& (hex($msgFlag)&0x20)){
|
if(($id eq $dst)&& (hex($msgFlag)&0x20)){
|
||||||
CUL_HM_SndCmd($shash, $msgcnt."8002".$id.$src."0101C800"); # Send Ack
|
# CUL_HM_SndCmd($shash, $msgcnt."8002".$id.$src."00"); # Send Ack
|
||||||
Log GetLogLevel($name,4), "CUL_HM $name dup mesg - ack and ignore";
|
Log GetLogLevel($name,4), "CUL_HM $name dup mesg - ack and ignore";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -1623,6 +1623,8 @@ my %culHmSubTypeSets = (
|
|||||||
{ devicepair => "<btnNumber> device ... [single|dual] [set|unset] [actor|remote|both]",},
|
{ devicepair => "<btnNumber> device ... [single|dual] [set|unset] [actor|remote|both]",},
|
||||||
pushButton =>
|
pushButton =>
|
||||||
{ devicepair => "<btnNumber> device ... [single|dual] [set|unset] [actor|remote|both]",},
|
{ devicepair => "<btnNumber> device ... [single|dual] [set|unset] [actor|remote|both]",},
|
||||||
|
threeStateSensor =>
|
||||||
|
{ devicepair => "<btnNumber> device ... single [set|unset] [actor|remote|both]",},
|
||||||
virtual =>
|
virtual =>
|
||||||
{ raw => "data ...",
|
{ raw => "data ...",
|
||||||
devicepair => "<btnNumber> device ... [single|dual] [set|unset] [actor|remote|both]",
|
devicepair => "<btnNumber> device ... [single|dual] [set|unset] [actor|remote|both]",
|
||||||
@ -1639,37 +1641,32 @@ my %culHmSubTypeSets = (
|
|||||||
keyMatic =>{lock =>"",
|
keyMatic =>{lock =>"",
|
||||||
unlock =>"[sec] ...",
|
unlock =>"[sec] ...",
|
||||||
open =>"[sec] ...",
|
open =>"[sec] ...",
|
||||||
inhibit=>"[on|off]",
|
inhibit=>"[on|off]"},
|
||||||
},
|
|
||||||
|
|
||||||
);
|
);
|
||||||
my %culHmModelSets = (
|
my %culHmModelSets = (
|
||||||
"HM-CC-VD"=>{
|
"HM-CC-VD"=>{
|
||||||
valvePos => "position",},
|
valvePos => "position"},
|
||||||
"HM-RC-19"=> {
|
"HM-RC-19"=> {
|
||||||
service => "<count>",
|
service => "<count>",
|
||||||
alarm => "<count>",
|
alarm => "<count>",
|
||||||
display => "<text> [comma,no] [unit] [off|1|2|3] [off|on|slow|fast] <symbol>",},
|
display => "<text> [comma,no] [unit] [off|1|2|3] [off|on|slow|fast] <symbol>"},
|
||||||
"HM-RC-19-B"=> {
|
"HM-RC-19-B"=> {
|
||||||
service => "<count>",
|
service => "<count>",
|
||||||
alarm => "<count>",
|
alarm => "<count>",
|
||||||
display => "<text> [comma,no] [unit] [off|1|2|3] [off|on|slow|fast] <symbol>",},
|
display => "<text> [comma,no] [unit] [off|1|2|3] [off|on|slow|fast] <symbol>"},
|
||||||
"HM-RC-19-SW"=> {
|
"HM-RC-19-SW"=> {
|
||||||
service => "<count>",
|
service => "<count>",
|
||||||
alarm => "<count>",
|
alarm => "<count>",
|
||||||
display => "<text> [comma,no] [unit] [off|1|2|3] [off|on|slow|fast] <symbol>",},
|
display => "<text> [comma,no] [unit] [off|1|2|3] [off|on|slow|fast] <symbol>"},
|
||||||
"HM-PB-4DIS-WM"=>{
|
"HM-PB-4DIS-WM"=>{
|
||||||
text => "<btn> [on|off] <txt1> <txt2>",},
|
text => "<btn> [on|off] <txt1> <txt2>"},
|
||||||
"HM-OU-LED16" =>{
|
"HM-OU-LED16" =>{
|
||||||
led =>"[off|red|green|orange]" ,
|
led =>"[off|red|green|orange]" ,
|
||||||
ilum =>"[0-15] [0-127]" },
|
ilum =>"[0-15] [0-127]" },
|
||||||
"HM-OU-CFM-PL"=>{
|
"HM-OU-CFM-PL"=>{
|
||||||
led => "<color>[,<color>..]",
|
led => "<color>[,<color>..]",
|
||||||
playTone => "<MP3No>[,<MP3No>..]",},
|
playTone => "<MP3No>[,<MP3No>..]"},
|
||||||
"ROTO_ZEL-STG-RM-FDK"=>{
|
|
||||||
devicepair => "<btnNumber> device ... single [set|unset] [actor|remote|both]",},
|
|
||||||
"HM-SEC-RHS"=>{
|
|
||||||
devicepair => "<btnNumber> device ... single [set|unset] [actor|remote|both]",},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
my %culHmChanSets = (
|
my %culHmChanSets = (
|
||||||
@ -2416,10 +2413,8 @@ CUL_HM_Set($@)
|
|||||||
return "$target must be [actor|remote|both]" if(defined($target) && (($target ne"actor") &&
|
return "$target must be [actor|remote|both]" if(defined($target) && (($target ne"actor") &&
|
||||||
($target ne"remote")&&($target ne"both")));
|
($target ne"remote")&&($target ne"both")));
|
||||||
return "use climate chan to pair TC" if($md eq "HM-CC-TC" &&$chn ne "02");
|
return "use climate chan to pair TC" if($md eq "HM-CC-TC" &&$chn ne "02");
|
||||||
return "use - single [set|unset] actor - for smoke detector" if($st eq "smokeDetector" &&
|
return "use - single [set|unset] actor - for smoke detector" if($st eq "smokeDetector" && (!$single || $single ne "single" || $target ne "actor"));
|
||||||
(!$single || $single ne "single" || $target ne "actor"));
|
return "use - single - for threeStateSensor" if($st eq "threeStateSensor" && (!$single || $single ne "single"));
|
||||||
return "use - single - for this sensor" if(($md eq "ROTO_ZEL-STG-RM-FDK" || $md eq "HM-SEC-RHS") &&
|
|
||||||
(!$single || $single ne "single"));
|
|
||||||
|
|
||||||
$single = ($single eq "single")?1:"";#default to dual
|
$single = ($single eq "single")?1:"";#default to dual
|
||||||
$set = ($set eq "unset")?0:1;
|
$set = ($set eq "unset")?0:1;
|
||||||
@ -2429,6 +2424,7 @@ CUL_HM_Set($@)
|
|||||||
$b1 = $b1*2 - 1 if(!$single && !$isChannel);
|
$b1 = $b1*2 - 1 if(!$single && !$isChannel);
|
||||||
if ($single){
|
if ($single){
|
||||||
$b2 = $b1;
|
$b2 = $b1;
|
||||||
|
$b1 = 0 if ($st eq "smokeDetector");
|
||||||
$nrCh2Pair = 1;
|
$nrCh2Pair = 1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -2458,7 +2454,8 @@ CUL_HM_Set($@)
|
|||||||
}
|
}
|
||||||
if (!$target || $target eq "actor" || $target eq "both"){
|
if (!$target || $target eq "actor" || $target eq "both"){
|
||||||
if (AttrVal( CUL_HM_id2Name($peerDst), "subType", "") eq "virtual"){
|
if (AttrVal( CUL_HM_id2Name($peerDst), "subType", "") eq "virtual"){
|
||||||
CUL_HM_ID2PeerList ($peerN,$dst.sprintf("%02X",$b1),$set); #update peerlist
|
CUL_HM_ID2PeerList ($peerN,$dst.sprintf("%02X",$b2),$set); #update peerlist
|
||||||
|
CUL_HM_ID2PeerList ($peerN,$dst.sprintf("%02X",$b1),$set) if ($b1 & !$single); #update peerlist
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
my $peerFlag = CUL_HM_getFlag($peerHash);
|
my $peerFlag = CUL_HM_getFlag($peerHash);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user