2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-02 19:15:31 +00:00

CUL_HM: play_tone improvement

git-svn-id: https://svn.fhem.de/fhem/trunk@10133 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2015-12-08 19:43:27 +00:00
parent d7a4334349
commit ec1df45e05
2 changed files with 15 additions and 5 deletions

View File

@ -4405,11 +4405,18 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
my @itemList = split(',',$a[2]);
my $repeat = (defined $a[3] && $a[3] =~ m/^(\d+)$/)?$a[3]:1;
my $itemCnt = int(@itemList);
return "no more then 12 entries please" if ($itemCnt>12);
my $volume = (defined $a[4] && $a[4] =~ m/^(\d+)$/)?$a[4]:10;
return "no more than 10 entries please" if ($itemCnt>10);
return "repetition $repeat out of range [1..255]"
if($repeat < 1 || $repeat > 255);
#<entries><multiply><MP3><MP3>
my $msgBytes = sprintf("%02X%02X",$itemCnt,$repeat);
return "volume $volume out of range [0..10]"
if($volume < 0 || $volume > 10);
#<volume><multiply><MP3><MP3>
my $msgBytes = sprintf("%02X%02X",$volume*20,$repeat);
foreach my $mp3 (@itemList){
return "input: $mp3 is not an integer below 255"
if (!defined $mp3 || $mp3 !~ /^[+-]?\d+$/ || $mp3 > 255);
@ -9035,11 +9042,12 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
'L' long ilumination. <br>
<b>repeat</b> defines how often the sequence shall be executed. Defaults to 1.<br>
</li>
<li><B>playTone &lt;MP3No&gt[,&lt;MP3No&gt..] [&lt;repeat&gt..]</B><br>
<li><B>playTone &lt;MP3No&gt[,&lt;MP3No&gt..] [&lt;repeat&gt;] [&lt;volume&gt;]</B><br>
Play a series of tones. List is to be entered separated by ','. White
spaces must not be used in the list.<br>
<b>replay</b> can be entered to repeat the last sound played once more.<br>
<b>repeat</b> defines how often the sequence shall be played. Defaults to 1.<br>
<b>volume</b> is defined between 0 and 10. 0 stops any sound currently playing. Defaults to 10 (100%).<br>
Example:
<ul><code>
# "hello" in display, symb bulb on, backlight, beep<br>
@ -10333,15 +10341,17 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
'L' lange Beleuchtungsdauer. <br>
<b>repeat</b> definiert wie oft die Sequenz ausgef&uuml;hrt werden soll. Standard ist 1.<br>
</li>
<li><B>playTone &lt;MP3No&gt[,&lt;MP3No&gt..] [&lt;repeat&gt..]</B><br>
<li><B>playTone &lt;MP3No&gt[,&lt;MP3No&gt;..] [&lt;repeat&gt;] [&lt;volume&gt;]</B><br>
Spielt eine Reihe von T&ouml;nen. Die Liste muss mit ',' getrennt werden. Leerzeichen
d&uuml;rfen in der Liste nicht benutzt werden.<br>
<b>replay</b> kann verwendet werden um den zuletzt gespielten Klang zu wiederholen.<br>
<b>repeat</b> definiert wie oft die Sequenz ausgef&uuml;hrt werden soll. Standard ist 1.<br>
<b>volume</b> kann im Bereich 0..10 liegen. 0 stoppt jeden aktuell gespielten Sound. Standard ist 10 (100%.<br>
Beispiel:
<ul><code>
set cfm_Mp3 playTone 3 # MP3 Titel 3 einmal<br>
set cfm_Mp3 playTone 3 3 # MP3 Titel 3 dreimal<br>
set cfm_Mp3 playTone 3 1 5 # MP3 Titel 3 mit halber Lautst&auml;rke<br>
set cfm_Mp3 playTone 3,6,8,3,4 # MP3 Titelfolge 3,6,8,3,4 einmal<br>
set cfm_Mp3 playTone 3,6,8,3,4 255# MP3 Titelfolge 3,6,8,3,4 255 mal<br>
set cfm_Mp3 playTone replay # Wiederhole letzte Sequenz<br>

View File

@ -167,7 +167,7 @@ my $K_actDetID = '000000'; # id of actionDetector
,"005C" => {name=>"HM-OU-CF-PL" ,st=>'outputUnit' ,cyc=>'' ,rxt=>'' ,lst=>'3' ,chn=>"Led:1:1,Sound:2:2",}
,"005D" => {name=>"HM-Sen-MDIR-O" ,st=>'motionDetector' ,cyc=>'00:10' ,rxt=>'c:w:l' ,lst=>'1,4' ,chn=>"",}
,"005F" => {name=>"HM-SCI-3-FM" ,st=>'threeStateSensor' ,cyc=>'28:00' ,rxt=>'c:w' ,lst=>'1,4' ,chn=>"Sw:1:3",}
,"0060" => {name=>"HM-PB-4DIS-WM" ,st=>'pushButton' ,cyc=>'' ,rxt=>'c' ,lst=>'1,4' ,chn=>"Btn:1:20",}
,"0060" => {name=>"HM-PB-4DIS-WM" ,alias=>"HM-PB-4DIS-WM-2"}
,"0061" => {name=>"HM-LC-SW4-DR" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:4",}
,"0062" => {name=>"HM-LC-SW2-DR" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:2",}
,"0064" => {name=>"DORMA_atent" ,st=>'' ,cyc=>'' ,rxt=>'c' ,lst=>'1,3' ,chn=>"Btn:1:3",} # DORMA Remote 3 buttons
@ -195,7 +195,7 @@ my $K_actDetID = '000000'; # id of actionDetector
,"007B" => {name=>"ROTO_ZEL-STG-RM-FEP-230V",st=>'blindActuator' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",} # radio-controlled blind actuator 1-channel (flush-mount)
,"007C" => {name=>"ROTO_ZEL-STG-RM-FZS" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",} # radio-controlled socket adapter switch actuator 1-channel
,"007D" => {name=>"ROTO_ZEL-STG-RM-WT-2" ,st=>'pushButton' ,cyc=>'' ,rxt=>'c:w:l' ,lst=>'1,4' ,chn=>"",} # HM Push Button 2
,"007E" => {name=>"ROTO_ZEL-STG-RM-DWT-10" ,st=>'remote' ,cyc=>'00:10' ,rxt=>'c' ,lst=>'1,4' ,chn=>"",} # HM Remote Display 4 buttons Roto
,"007E" => {name=>"ROTO_ZEL-STG-RM-DWT-10" ,alias=>"HM-PB-4DIS-WM-2"}
,"007F" => {name=>"ROTO_ZEL-STG-RM-FST-UP4" ,st=>'pushButton' ,cyc=>'' ,rxt=>'c' ,lst=>'1,4' ,chn=>"",} # HM Push Button Interface
,"0080" => {name=>"ROTO_ZEL-STG-RM-HS-4" ,st=>'remote' ,cyc=>'' ,rxt=>'c' ,lst=>'1,4' ,chn=>"",} # HM Remote 4 buttons
,"0081" => {name=>"ROTO_ZEL-STG-RM-FDK" ,st=>'threeStateSensor' ,cyc=>'28:00' ,rxt=>'c:w' ,lst=>'1,4' ,chn=>"",} # HM Rotary Handle Sensor