2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 10:46:03 +00:00

postEvent for virtuals

git-svn-id: https://svn.fhem.de/fhem/trunk@3944 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-09-22 17:56:03 +00:00
parent 97cb1d8c84
commit 3875f25340
3 changed files with 64 additions and 8 deletions

View File

@ -844,7 +844,7 @@ sub CUL_HM_Parse($$) {##############################
push @event, "desired-temp:$setTemp";
push @event, "ValvePosition:$vp %";
push @event, "mode:$ctlTbl{$ctrlMode}";
push @event, "state:T:$actTemp desired:$setTemp valve:$vp %";
push @event, "state:T: $actTemp desired: $setTemp valve: $vp %";
push @entities,CUL_HM_UpdtReadBulk($dHash,1
,"battery:".($err&0x80?"low":"ok")
,"batteryLevel:$bat V"
@ -2902,6 +2902,49 @@ sub CUL_HM_Set($@) {
$pressCnt));
}
}
elsif($cmd eq "postEvent") { ################################################
my (undef,undef,$cond) = @a;
if ($cond =~ m/[+-]?\d+/){
return "condition value:$cond above 200 illegal" if ($cond > 200);
}
else{
my $val;
my @keys;
foreach my $tp (keys %lvlStr){
foreach my $mk (keys %{$lvlStr{$tp}}){
foreach (keys %{$lvlStr{$tp}{$mk}}){
$val = hex($_) if ($cond eq $lvlStr{$tp}{$mk}{$_});
push @keys,$lvlStr{$tp}{$mk}{$_};
}
}
}
return "cond:$cond not allowed. choose one of:[0..200],"
.join(",",sort @keys)
if (!defined $val);
$cond = $val;
}
my $pressCnt = (!$hash->{helper}{count}?1:$hash->{helper}{count}+1)%256;
$hash->{helper}{count}=$pressCnt;# remember for next round
my @peerList;
if ($st eq 'virtual'){#serve all peers of virtual button
foreach my $peer (sort(split(',',AttrVal($name,"peerIDs","")))) {
push (@peerList,substr($peer,0,6));
}
@peerList = CUL_HM_noDup(@peerList);
push @peerList,'00000000' if (!@peerList);#send to broadcast if no peer
foreach my $peer (sort @peerList){
my $peerFlag = $peer eq '00000000'?'A4':
CUL_HM_getFlag(CUL_HM_id2Hash($peer));
$peerFlag =~ s/0/4/;# either 'A4' or 'B4'
CUL_HM_PushCmdStack($hash, sprintf("++%s41%s%s%02X%02X%02X"
,$peerFlag,$dst,$peer
,$chn
,$pressCnt
,$cond));
}
}
}
elsif($cmd eq "peerChan") { ############################################# reg
#peerChan <btnN> <device> ... [single|dual] [set|unset] [actor|remote|both]
my ($bNo,$peerN,$single,$set,$target) = ($a[2],$a[3],$a[4],$a[5],$a[6]);
@ -4985,6 +5028,12 @@ sub CUL_HM_putHash($) {# provide data for HMinfo
implementation will not specify the duration for long. Only one trigger
will be sent of type "long".
</li>
<li><B>postEvent &lt;[0..200]&gt;<a name="CUL_HMpostEvents"></a></B>
simulates an event. A value must be given between 0 and 200.<br>
Alternally a literal ca be given as used by other sensors. enter <br>
postEvent ?<br>
to get options<br>
</li>
</ul>
</li>
<li>smokeDetector<br>
@ -5370,7 +5419,8 @@ sub CUL_HM_putHash($) {# provide data for HMinfo
humidity $h<br>
actuator $vp %<br>
desired-temp $dTemp<br>
desired-temp-manu $dTemp<br>
desired-temp-manu $dTemp #temperature if switchen to manual mode<br>
desired-temp-cent $dTemp #temperature if switchen to central mode<br>
windowopen-temp-%d %.1f (sensor:%s)<br>
tempList$wd hh:mm $t hh:mm $t ...<br>
displayMode temp-[hum|only]<br>

View File

@ -375,7 +375,12 @@ sub HMinfo_SetFn($@) {#########################################################
my ($found,$para) = HMinfo_getParam($id,@a);
push @paramList,$para if($found || $optEmpty);
}
$ret = $cmd." done:" ."\n param list" ."\n ".(join "\n ",sort @paramList)
my $prtHdr = "entity \t: ";
$prtHdr .= sprintf("%-20s \t|",$_)foreach (@a);
$ret = $cmd." done:"
."\n param list" ."\n "
.$prtHdr ."\n "
.(join "\n ",sort @paramList)
;
}
elsif($cmd eq "regCheck") {##check register--------------------------------

View File

@ -190,7 +190,7 @@ my %culHmModel=(
"0092" => {name=>"Schueco_263-144" ,st=>'switch' ,cyc=>'' ,rxt=>'c' ,lst=>'4' ,chn=>"",}, # HM Switch Interface 3 switches
"0093" => {name=>"Schueco_263-158" ,st=>'THSensor' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'p' ,chn=>"",}, #
"0094" => {name=>"IS-WDS-TH-OD-S-R3" ,st=>'THSensor' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'p' ,chn=>"",}, #
"0095" => {name=>"HM-CC-RT-DN" ,st=>'thermostat' ,cyc=>'' ,rxt=>'c:w:b' ,lst=>'p:1p.2p.5p.6p,3:3p.6p,7:4'
"0095" => {name=>"HM-CC-RT-DN" ,st=>'thermostat' ,cyc=>'' ,rxt=>'c:w' ,lst=>'p:1p.2p.5p.6p,3:3p.6p,7:4'
,chn=>"Weather:1:1,Climate:2:2,WindowRec:3:3,ClimRT_tr:4:4,ClimaTeam:5:5,remote:6:6"}, #
"0096" => {name=>"WDF-solar" ,st=>'blindActuatorSol' ,cyc=>'' ,rxt=>'b' ,lst=>'1,3' ,chn=>"win:1:1,blind_2:3",}, #
"009B" => {name=>"Schueco_263-xxx" ,st=>'tipTronic' ,cyc=>'28:00' ,rxt=>'c:w' ,lst=>'1:1.2,3:1p.3p',chn=>"act:1:1,sen:2:2,sec:3:3",}, #
@ -940,6 +940,7 @@ my %culHmSubTypeSets = (# channels of this subtype
,statusRequest =>""},
virtual =>{ peerChan =>"<btnNumber> <actChn> ... [single|dual] [set|unset] [actor|remote|both]"
,press =>"[long|short]..."
,postEvent =>"<condition>"
,valvePos =>"<position>"},#acting as TC
smokeDetector =>{ test =>""
,alarmOn =>""
@ -999,7 +1000,7 @@ my %culHmChanSets = (
"party-temp" =>"[on,off,6.0..30.0]",
"desired-temp" =>"[on,off,6.0..30.0]",
sysTime =>"" },
"HM-CC-TC02" =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] [actor|remote|both]"
"HM-CC-TC02" =>{ peerChan =>" 0 <actChn> ... single [set|unset] [actor|remote|both]"
,"day-temp" =>"[on,off,6.0..30.0]"
,"night-temp" =>"[on,off,6.0..30.0]"
,"party-temp" =>"[on,off,6.0..30.0]"
@ -1023,8 +1024,8 @@ my %culHmChanSets = (
"HM-OU-CFM-PL01" =>{ led =>"<color>[,<color>...] [<repeat>]"},
"HM-OU-CFM-PL02" =>{ playTone =>"<MP3No>[,<MP3No>...] [<repeat>]"},
"WDF-solar01" =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] [actor|remote|both]"},
"HM-Sen-RD-O01" =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] [actor|remote|both]"},
"WDF-solar01" =>{ peerChan =>" 0 <actChn> ... single [set|unset] [actor|remote|both]"},
"HM-Sen-RD-O01" =>{ peerChan =>" 0 <actChn> ... single [set|unset] [actor|remote|both]"},
"HM-Sen-RD-O02" =>{ "on-for-timer" =>"<sec>"
,"on-till" =>"<time>"
,on =>""
@ -1040,7 +1041,7 @@ my %culHmChanSets = (
,tempListFri =>"HH:MM temp ..."
,"desired-temp" =>"[on,off,6.0..30.0]"
},
"HM-CC-RT-DN05" =>{ peerChan =>"<btnNumber> <actChn> ... [single] [set|unset] [actor|remote|both]"},
"HM-CC-RT-DN05" =>{ peerChan =>" 0 <actChn> ... [single] [set|unset] [actor|remote|both]"},
);
# clones- - - - - - - - - - - - - - - - -
#$culHmChanSets{"HM-OU-CF-PL02"} = $culHmChanSets{"HM-OU-CF-PL01"};