2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

98_weekprofile: attributes for temperature 'on' and 'off'

git-svn-id: https://svn.fhem.de/fhem/trunk@13277 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Risiko 2017-01-29 18:38:12 +00:00
parent 320f38f00f
commit 8d18a49780
3 changed files with 44 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 98_weekprofile: attributes for temperature 'on' and 'off'
- feature: 98_BOSEST: NEW REQUIREMENT sox, libsox-fmt-mp3 for TTS
- feature: 98_BOSEST: support more than 100 chars for TTS
- bugfix: 98_BOSEST: several TTS and Spotify bugfixes

View File

@ -152,6 +152,11 @@ sub weekprofile_readDayProfile($@)
for(my $i = 0; $i < scalar(@temps); $i+=1){
$temps[$i] =~s/[^\d.]//g; #only numbers
my $tempON = AttrVal($me, "tempON", undef);
my $tempOFF = AttrVal($me, "tempOFF", undef);
$temps[$i] =~s/$tempOFF/off/g if (defined($tempOFF)); # temp off
$temps[$i] =~s/$tempON/on/g if (defined($tempON)); # temp on
}
for(my $i = 0; $i < scalar(@times); $i+=1){
@ -417,7 +422,7 @@ sub weekprofile_Initialize($)
$hash->{StateFn} = "weekprofile_State";
$hash->{NotifyFn} = "weekprofile_Notify";
$hash->{AttrFn} = "weekprofile_Attr";
$hash->{AttrList} = "useTopics:0,1 widgetWeekdays widgetEditOnNewPage:0,1 widgetEditDaysInRow:1,2,3,4,5,6,7 configFile ".$readingFnAttributes;
$hash->{AttrList} = "useTopics:0,1 widgetWeekdays widgetEditOnNewPage:0,1 widgetEditDaysInRow:1,2,3,4,5,6,7 tempON tempOFF configFile ".$readingFnAttributes;
$hash->{FW_summaryFn} = "weekprofile_SummaryFn";
@ -1048,6 +1053,8 @@ sub weekprofile_SummaryFn()
my $editNewpage = AttrVal($d, "widgetEditOnNewPage", 0);
my $useTopics = AttrVal($d, "useTopics", 0);
my $editDaysInRow = AttrVal($d, "widgetEditDaysInRow", undef);
my $tempON = AttrVal($d, "tempON", undef);
my $tempOFF = AttrVal($d, "tempOFF", undef);
my $editIcon = FW_iconName($iconName) ? FW_makeImage($iconName,$iconName,"icon") : "";
$editIcon = "<a name=\"$d.edit\" onclick=\"weekprofile_DoEditWeek('$d','$editNewpage')\" href=\"javascript:void(0)\">$editIcon</a>";
@ -1059,8 +1066,10 @@ sub weekprofile_SummaryFn()
my $args = "weekprofile,MODE:SHOW";
$args .= ",USETOPICS:$useTopics";
$args .= ",MASTERDEV:$masterDev" if (defined($masterDev));
$args .= ",MASTERDEV:$masterDev" if (defined($masterDev));
$args .= ",DAYINROW:$editDaysInRow" if (defined($editDaysInRow));
$args .= ",TEMP_ON:$tempON" if (defined($tempON));
$args .= ",TEMP_OFF:$tempOFF" if (defined($tempOFF));
my $curr = "";
if (@{$hash->{PROFILES}} > 0)
@ -1309,6 +1318,12 @@ sub weekprofile_getEditLNK_MasterDev($$)
Enable topics.<br>
Default: 0
</li>
<li>tempON<br>
Temperature for 'on'. e.g. 30
</li>
<li>tempOFF<br>
Temperature for 'off'. e.g. 4
</li>
</ul>
</ul>
@ -1455,6 +1470,12 @@ sub weekprofile_getEditLNK_MasterDev($$)
<li>useTopics<br>
Verwendung von Topic aktivieren.
</li>
<li>tempON<br>
Temperature für 'on'. z.B. 30
</li>
<li>tempOFF<br>
Temperature für 'off'. z.B. 4
</li>
</ul>
</ul>

View File

@ -545,11 +545,25 @@ function FW_weekprofileEditDay(widget,day)
html += "<td><input type=\"text\" name=\"ENDTIME\" size=\"5\" maxlength=\"5\" align=\"center\" value=\""+endTime+"\" onblur=\"FW_weekprofileEditTime_changed(this)\"/></td>";
//temp
var tempOn = widget.TEMP_ON;
var tempOff = widget.TEMP_OFF;
if (tempOn == null)
tempOn = 30;
if (tempOff == null)
tempOff = 5;
html += "<td><select name=\"TEMP\" size=\"1\" onchange=\"FW_weekprofileTemp_chached(this)\">";
for (var k=5; k <= 30; k+=.5)
for (var k=tempOff; k <= tempOn; k+=.5)
{
var selected = (k == temps[i]) ? "selected " : "";
html += "<option "+selected+"value=\""+k.toFixed(1)+"\">"+k.toFixed(1)+"</option>";
if (k == widget.TEMP_OFF)
html += "<option "+selected+"value=\"off\">off</option>";
else if (k == widget.TEMP_ON)
html += "<option "+selected+"value=\"on\">on</option>";
else
html += "<option "+selected+"value=\""+k.toFixed(1)+"\">"+k.toFixed(1)+"</option>";
}
html += "</select></td>";
//ADD-Button
@ -787,6 +801,8 @@ FW_weekprofileCreate(elName, devName, vArr, currVal, set, params, cmd)
widget.JMPBACK = null;
widget.MODE = 'SHOW';
widget.USETOPICS = 0;
widget.TEMP_ON = null;
widget.TEMP_OFF = null;
for (var i = 1; i < vArr.length; ++i) {
var arg = vArr[i].split(':');
@ -796,6 +812,8 @@ FW_weekprofileCreate(elName, devName, vArr, currVal, set, params, cmd)
case "MASTERDEV": widget.MASTERDEV = arg[1]; break;
case "USETOPICS": widget.USETOPICS = arg[1]; break;
case "DAYINROW": widget.EDIT_DAYSINROW = arg[1]; break;
case "TEMP_ON": widget.TEMP_ON = parseFloat(arg[1]); break;
case "TEMP_OFF": widget.TEMP_OFF = parseFloat(arg[1]);break;
}
}