1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-07 22:29:19 +00:00

restrict statusRequest command, update peerList, restrict attr peerIDs to channels

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@3590 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-08-03 11:07:14 +00:00
parent 75a91c022c
commit 0b9acf8689
2 changed files with 91 additions and 57 deletions

View File

@ -301,7 +301,15 @@ sub CUL_HM_Define($$) {##############################
$devHash->{"channel_$chn"} = $name; #reference in device as well
$attr{$name}{model} = AttrVal($devName, "model", undef);
$hash->{helper}{role}{chn}=1;
delete $devHash->{helper}{role}{chn} if($chn eq "01");#device no longer
if($chn eq "01"){
$attr{$name}{peerIDs} = AttrVal($devName, "peerIDs", "");
$hash->{REAGINDS}{peerList}{VAL} = ReadingsVal($devName,"peerList","");
$hash->{peerList} = $devHash->{peerList} if($devHash->{peerList});
delete $devHash->{helper}{role}{chn};#device no longer
delete $devHash->{peerList};
delete $devHash->{REAGINDS}{peerList};
}
}
else{# define a device
$hash->{helper}{role}{dev}=1;
@ -356,6 +364,7 @@ sub CUL_HM_Attr(@) {#################################
my ($cmd,$name, $attrName,$attrVal) = @_;
my @hashL;
my $updtReq = 0;
my $hash = CUL_HM_name2Hash($name);
if ($attrName eq "expert"){#[0,1,2]
$attr{$name}{expert} = $attrVal;
my $eHash = $defs{$name};
@ -414,7 +423,6 @@ sub CUL_HM_Attr(@) {#################################
$updtReq = 1;
}
elsif($attrName eq "param"){
my $hash = CUL_HM_name2Hash($name);
my $md = CUL_HM_Get($hash,$name,"param","model");
my $chn = substr(CUL_HM_hash2Id($hash),6,2);
if ($md eq "HM-Sen-RD-O" && $chn eq "02"){
@ -430,6 +438,9 @@ sub CUL_HM_Attr(@) {#################################
return "attribut param not defined for this entity";
}
}
elsif($attrName eq "peerIDs" &&!$hash->{helper}{role}{chn}){#only for chan
return "$attrName not usable for devices";
}
CUL_HM_queueUpdtCfg($name) if ($updtReq);
return;
@ -1213,7 +1224,7 @@ sub CUL_HM_Parse($$) {##############################
push @event,"state:" .($alarmList?"smoke-Alarm":"off" );
push @event,"smoke_detect:" .($alarmList?$alarmList :"none");
#--- check out teamstatus, members might be shy ---
my $peerList = ReadingsVal($name,"peerList","");
my $peerList = $shash->{peerList}?$shash->{peerList}:"";
foreach my $pNm (split(",",$peerList)){
CUL_HM_qStateUpdatIfEnab($pNm,1)if ($pNm);
}
@ -1878,8 +1889,11 @@ sub CUL_HM_Get($@) {
my $pIds = AttrVal($eName, "peerIDs", "");
my $timestamps = "\n# timestamp of the readings for reference";
if ($pIds){
print aSave "\n# Peer Names:".ReadingsVal($eName,"peerList","");
$timestamps .= "\n# ".ReadingsTimestamp($eName,"peerList","")." :peerList";
print aSave "\n# Peer Names:"
.($defs{$name}{peerList}?$defs{$name}{peerList}:"");
$timestamps .= "\n# "
.($defs{$eName}{peerList}?$defs{$eName}{peerList}:"")
." :peerList";
print aSave "\nset ".$eName." peerBulk ".$pIds;
}
my $ehash = $defs{$eName};
@ -2991,6 +3005,7 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response
my $chnhash = $modules{CUL_HM}{defptr}{"$dst$chn"};
$chnhash = $hash if (!$chnhash);
delete $chnhash->{READINGS}{peerList};#empty old list
delete $chnhash->{peerList};#empty old list
delete $chnhash->{helper}{peerIDsRaw};
$attr{$chnhash->{NAME}}{peerIDs} = '';
return;
@ -3261,9 +3276,11 @@ sub CUL_HM_ID2PeerList ($$$) {
$attr{$name}{peerIDs} = $peerIDs; # make it public
if ($peerNames){
readingsSingleUpdate($hash,"peerList",$peerNames,0) ;
$hash->{peerList} = $peerNames;
}
else{
delete $hash->{READINGS}{peerList};
delete $hash->{peerList};
}
}
sub CUL_HM_peerChId($$$) {# in:<IDorName> <deviceID> <ioID>, out:channelID

View File

@ -854,11 +854,10 @@ my %culHmModelGets = (
##############################---set---########################################
my %culHmGlobalSets = (# all but virtuals
regBulk => "<list>:<peer> <addr1:data1> <addr2:data2> ...",
statusRequest => "",
getRegRaw =>"[List0|List1|List2|List3|List4|List5|List6] ... [<PeerChannel>]",
getRegRaw => "[List0|List1|List2|List3|List4|List5|List6] ... [<PeerChannel>]",
getConfig => "",
regSet =>"<regName> <value> ... [<peerChannel>]",
clear =>"[readings|msgEvents]",
regSet => "<regName> <value> ... [<peerChannel>]",
clear => "[readings|msgEvents]",
);
my %culHmGlobalSetsVrtDev = (# virtuals and devices without subtype
raw => "data ...",
@ -877,55 +876,75 @@ my %culHmGlobalSetsChn = (# all channels but virtuals
);
my %culHmSubTypeSets = (# channels of this subtype
switch =>{ "on-for-timer"=>"<sec>"
,"on-till" =>"<time>"
,on =>""
,off =>""
,toggle =>""
,press =>"[long|short] [on|off] ..."
,inhibit =>"[on|off]"},
,"on-till" =>"<time>"
,on =>""
,off =>""
,toggle =>""
,press =>"[long|short] [on|off] ..."
,inhibit =>"[on|off]"
,statusRequest =>""},
dimmer =>{ "on-for-timer"=>"<sec>"
,"on-till" =>"<time>"
,on =>""
,off =>""
,toggle =>""
,pct =>"<value> ... [<ontime>] [<ramptime>]"
,stop =>""
,press =>"[long|short] [on|off] ..."
,up =>"[<changeValue>] [<ontime>] [<ramptime>] ..."
,down =>"[<changeValue>] [<ontime>] [<ramptime>] ..."
,inhibit =>"[on|off]"},
blindActuator =>{ on =>""
,off =>""
,toggle =>""
,pct =>"[<value>] ... [<ontime>]"
,stop =>""
,press =>"[long|short] [on|off] ..."
,up =>"[<changeValue>] [<ontime>] [<ramptime>] ..."
,down =>"[<changeValue>] [<ontime>] [<ramptime>] ..."
,inhibit =>"[on|off]"},
remote =>{ peerChan =>"<btnNumber> <actChn> ... [single|dual] [set|unset] [actor|remote|both]"},
threeStateSensor =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] [actor|remote|both]"},
THSensor =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] [actor|remote|both]"},
virtual =>{ peerChan =>"<btnNumber> <actChn> ... [single|dual] [set|unset] [actor|remote|both]"
,press =>"[long|short]..."
,valvePos =>"<position>"},#acting as TC
smokeDetector =>{ test =>""
,alarmOn =>""
,alarmOff =>""
,peerChan =>"<btnNumber> <actChn> ... single [set|unset] actor"},
winMatic =>{ matic =>"<btn>"
,keydef =>"<btn> <txt1> <txt2>"
,create =>"<txt>"
,inhibit =>"[on|off]"},
keyMatic =>{ lock =>""
,unlock =>"[<sec>] ..."
,open =>"[<sec>] ..."
,inhibit =>"[on|off]"},
,"on-till" =>"<time>"
,on =>""
,off =>""
,toggle =>""
,pct =>"<value> ... [<ontime>] [<ramptime>]"
,stop =>""
,press =>"[long|short] [on|off] ..."
,up =>"[<changeValue>] [<ontime>] [<ramptime>] ..."
,down =>"[<changeValue>] [<ontime>] [<ramptime>] ..."
,inhibit =>"[on|off]"
,statusRequest =>""},
blindActuator =>{ on =>""
,off =>""
,toggle =>""
,pct =>"[<value>] ... [<ontime>]"
,stop =>""
,press =>"[long|short] [on|off] ..."
,up =>"[<changeValue>] [<ontime>] [<ramptime>] ..."
,down =>"[<changeValue>] [<ontime>] [<ramptime>] ..."
,inhibit =>"[on|off]"
,statusRequest =>""},
remote =>{ peerChan =>"<btnNumber> <actChn> ... [single|dual] [set|unset] [actor|remote|both]"},
threeStateSensor =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] [actor|remote|both]"
,statusRequest =>""},
THSensor =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] [actor|remote|both]"
,statusRequest =>""},
virtual =>{ peerChan =>"<btnNumber> <actChn> ... [single|dual] [set|unset] [actor|remote|both]"
,press =>"[long|short]..."
,valvePos =>"<position>"},#acting as TC
smokeDetector =>{ test =>""
,alarmOn =>""
,alarmOff =>""
,peerChan =>"<btnNumber> <actChn> ... single [set|unset] actor"
,statusRequest =>""},
winMatic =>{ matic =>"<btn>"
,keydef =>"<btn> <txt1> <txt2>"
,create =>"<txt>"
,inhibit =>"[on|off]"
,statusRequest =>""},
keyMatic =>{ lock =>""
,unlock =>"[<sec>] ..."
,open =>"[<sec>] ..."
,inhibit =>"[on|off]"
,statusRequest =>""},
repeater =>{ setRepeat => "[no1..36] <sendName> <recName> [bdcast-yes|no]"
,inhibit => "[on|off]"
,statusRequest =>""},
outputUnit =>{ statusRequest =>""},
);
# clones- - - - - - - - - - - - - - - - -
$culHmSubTypeSets{pushButton} = $culHmSubTypeSets{remote};
$culHmSubTypeSets{swi} = $culHmSubTypeSets{remote};
$culHmSubTypeSets{motionDetector} = $culHmSubTypeSets{threeStateSensor};
$culHmSubTypeSets{pushButton} = $culHmSubTypeSets{remote};
$culHmSubTypeSets{swi} = $culHmSubTypeSets{remote};
$culHmSubTypeSets{sensor} = $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{thermostat} = $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{KFM100} = $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{blindActuatorSol}= $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{tipTronic} = $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{motionDetector} = $culHmSubTypeSets{threeStateSensor};
# sensRain ( no statusrequest)
my %culHmModelSets = (# channels of this subtype-------------
"HM-CC-VD" =>{ valvePos => "position"},
@ -939,8 +958,6 @@ my %culHmModelSets = (# channels of this subtype-------------
,ilum => "[0-15] [0-127]"},
"HM-OU-CFM-PL" =>{ press => "[long|short] [on|off] ..."
,inhibit => "[on|off]"},
"HM-Sys-sRP-Pl"=>{ setRepeat => "[no1..36] <sendName> <recName> [bdcast-yes|no]"
,inhibit => "[on|off]"},
"HM-CC-RT-DN" =>{ mode => "[auto|manu|party|boost|comfort|lower] ... <temp> <startTime> <endTime>"}#General only for one channel??
);
# clones- - - - - - - - - - - - - - - - -