mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 01:06:04 +00:00
add lock as level to winmatic
git-svn-id: https://svn.fhem.de/fhem/trunk@6312 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c7a4daa78c
commit
806efb4877
@ -401,7 +401,11 @@ sub HMLAN_ReadAnswer($$$) {# This is a direct read for commands like get
|
||||
|
||||
sub HMLAN_Write($$$) {#########################################################
|
||||
my ($hash,$fn,$msg) = @_;
|
||||
if (length($msg)>22){
|
||||
if ($fn eq "cmd"){
|
||||
HMLAN_SimpleWrite($hash,$msg);
|
||||
return;
|
||||
}
|
||||
elsif (length($msg)>22){
|
||||
my ($mtype,$src,$dst) = (substr($msg, 8, 2),
|
||||
substr($msg, 10, 6),
|
||||
substr($msg, 16, 6));
|
||||
@ -661,9 +665,7 @@ sub HMLAN_Parse($$) {##########################################################
|
||||
Dispatch($hash, $dmsg, \%addvals);
|
||||
}
|
||||
elsif($mFld[0] eq 'HHM-LAN-IF'){#HMLAN version info
|
||||
$hash->{serialNr} = $mFld[2];
|
||||
$hash->{firmware} = sprintf("%d.%d", (hex($mFld[1])>>12)&0xf, hex($mFld[1]) & 0xffff);
|
||||
$hash->{owner} = $mFld[4];
|
||||
|
||||
$hash->{uptime} = HMLAN_uptime($mFld[5],$hash);
|
||||
$hash->{assignedIDsReport}=hex($mFld[6]);
|
||||
$hash->{helper}{q}{keepAliveRec} = 1;
|
||||
@ -674,6 +676,20 @@ sub HMLAN_Parse($$) {##########################################################
|
||||
.' O:' .$mFld[4].' t:'.$mFld[5].' IDcnt:'.$mFld[6];
|
||||
my $myId = AttrVal($name, "hmId", "");
|
||||
$myId = $attr{$name}{hmId} = $mFld[4] if (!$myId);
|
||||
|
||||
my (undef,$info) = unpack('A11A29',$rmsg);
|
||||
if (!$hash->{helper}{info} || $hash->{helper}{info} ne $info){
|
||||
my $fwVer = hex($mFld[1]);
|
||||
$fwVer = sprintf("%d.%d", ($fwVer >> 12) & 0xf, $fwVer & 0xffff);
|
||||
$hash->{owner} = $mFld[4];
|
||||
readingsBeginUpdate($hash);
|
||||
readingsBulkUpdate($hash,"D-firmware" ,$fwVer);
|
||||
readingsBulkUpdate($hash,"D-serialNr" ,$mFld[2]);
|
||||
readingsBulkUpdate($hash,"D-HMIdOriginal",$mFld[3]);
|
||||
readingsBulkUpdate($hash,"D-HMIdAssigned",$mFld[4]);
|
||||
readingsEndUpdate($hash,1);
|
||||
$hash->{helper}{info} = $info;
|
||||
}
|
||||
|
||||
if($mFld[4] ne $myId && !AttrVal($name, "dummy", 0)) {
|
||||
Log3 $hash, 1, 'HMLAN setting owner to '.$myId.' from '.$mFld[4];
|
||||
|
@ -759,6 +759,8 @@ sub CUL_HM_prtInit($){ #setup protocol variables after define
|
||||
sub CUL_HM_hmInitMsg($){ #define device init msg for HMLAN
|
||||
#message to be send to HMLAN/USB to define device communication defails
|
||||
#bit-usage is widely unknown.
|
||||
#p[1]: 00000001 = request AES
|
||||
#p[1]: 00000010 = data pending - autosend wakeup if device send data
|
||||
my ($hash)=@_;
|
||||
my $rxt = CUL_HM_getRxType($hash);
|
||||
my $id = CUL_HM_hash2Id($hash);
|
||||
@ -2226,16 +2228,15 @@ sub CUL_HM_parseCommon(@){#####################################################
|
||||
}
|
||||
elsif($subType eq "01"){ #ACKinfo#################
|
||||
$success = "yes";
|
||||
my $rssi = substr($p,8,2);# --calculate RSSI
|
||||
my (undef,$chn,undef,undef,$rssi) = unpack '(A2)*',$p;
|
||||
my $chnHash = CUL_HM_id2Hash($src.$chn);
|
||||
push @evtEt,[$chnHash,0,"recentStateType:ack"];
|
||||
CUL_HM_storeRssi( $shash->{NAME}
|
||||
,($dhash?$dhash->{NAME}:$shash->{IODev}{NAME})
|
||||
,(-1)*(hex($rssi))
|
||||
,$mNo)
|
||||
if ($rssi && $rssi ne '00' && $rssi ne'80');
|
||||
$reply = "ACKStatus";
|
||||
my $chnHash = CUL_HM_id2Hash($src.substr($p,2,2));
|
||||
push @evtEt,[$chnHash,0,"recentStateType:ack"];
|
||||
|
||||
if ($shash->{helper}{tmdOn}){
|
||||
if ((not hex(substr($p,6,2))&0x40) && # not timedOn, we have to repeat
|
||||
$shash->{helper}{tmdOn} eq substr($p,2,2) ){# virtual channels for dimmer may be incorrect
|
||||
@ -2504,7 +2505,9 @@ sub CUL_HM_parseCommon(@){#####################################################
|
||||
$ret= "parsed";
|
||||
}
|
||||
elsif($subType eq "06"){ #reply to status request=======================
|
||||
my $rssi = substr($p,8,2);# --calculate RSSI
|
||||
my (undef,$chn,undef,undef,$rssi) = unpack '(A2)*',$p;
|
||||
my $chnHash = CUL_HM_id2Hash($src.$chn);
|
||||
push @evtEt,[$chnHash,0,"recentStateType:info"];
|
||||
CUL_HM_storeRssi( $shash->{NAME}
|
||||
,($dhash?$dhash->{NAME}:$shash->{IODev}{NAME})
|
||||
,(-1)*(hex($rssi))
|
||||
@ -2512,8 +2515,6 @@ sub CUL_HM_parseCommon(@){#####################################################
|
||||
if ($rssi && $rssi ne '00' && $rssi ne'80');
|
||||
@{$modules{CUL_HM}{helper}{qReqStat}} = grep { $_ ne $shash->{NAME} }
|
||||
@{$modules{CUL_HM}{helper}{qReqStat}};
|
||||
my $chnHash = CUL_HM_id2Hash($src.substr($p,2,2));
|
||||
push @evtEt,[$chnHash,0,"recentStateType:info"];
|
||||
|
||||
if ($pendType eq "StatusReq"){#it is the answer to our request
|
||||
my $chnSrc = $src.$shash->{helper}{prt}{rspWait}{forChn};
|
||||
@ -3508,8 +3509,9 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
|
||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'8001C8'.$delay);# OPEN
|
||||
}
|
||||
elsif($cmd eq "inhibit") { ##################################################
|
||||
return "$a[2] is not on or off" if($a[2] !~ m/^(on|off)$/);
|
||||
my $val = ($a[2] eq "on") ? "01" : "00";
|
||||
return "$a[2] is not on or off" if($a[2] !~ m/^(on|off)$/);
|
||||
my $val = ($a[2] eq "on") ? "01" : "00";
|
||||
CUL_HM_UpdtReadSingle($hash,"inhibit","set_$a[2]",1);
|
||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.$val.$chn); # SET_LOCK
|
||||
}
|
||||
elsif($cmd =~ m/^(up|down|pct)$/) { #########################################
|
||||
|
@ -1630,6 +1630,10 @@ $culHmChanSets{"ROTO_ZEL-STG-RM-FWT02"} = $culHmChanSets{"HM-CC-TC02"};
|
||||
VALVE => "6,2",
|
||||
MODE => "6,2" } },
|
||||
|
||||
"11;p01=00" => { txt => "INHIBIT0ff" , params => {
|
||||
CHANNEL => "02,2" } },
|
||||
"11;p01=01" => { txt => "INHIBIT0n" , params => {
|
||||
CHANNEL => "02,2" } },
|
||||
"11;p01=02" => { txt => "SET" , params => {
|
||||
CHANNEL => "02,2",
|
||||
VALUE => "04,2",
|
||||
|
Loading…
x
Reference in New Issue
Block a user