Skip to content

Commit

Permalink
thermostat select heating profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Standarduser committed May 15, 2024
1 parent cd814ac commit d0565d9
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 24 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ The widgets are designed for VIS 1.x.
* (Standarduser) thermostat: autofill object ids for Homematic devices
* (Standarduser) thermostat: text presets
* (Standarduser) thermostat: css-corrections
* (Standarduser) thermostat: select for heating profile

### 0.0.13 (2024-05-05)

Expand Down
64 changes: 42 additions & 22 deletions widgets/vis-homekittiles.html
Original file line number Diff line number Diff line change
Expand Up @@ -502,23 +502,6 @@
arrowDirection/nselect,,top,right,bottom,left;"
>
<div class="homekitTiles tile thermostatDialog vis-widget <%= this.data.attr('showLikeActive') ? 'state-active' : 'state-default' %> <%== this.data.attr('class') %>" style="width: 110px; height: 110px;" id="<%= this.data.attr('wid') %>">

<%
if (this.data.attr('oidActiveProfile')) {
var activeProfile = vis.states.attr(this.data['oidActiveProfile'] + '.val').toString();
var activeProfileValue = (data.attr('activeProfileValues') ? data.attr('activeProfileValues').split(';') : []);
var activeProfileText = (data.attr('activeProfileTexts') ? data.attr('activeProfileTexts').split(';') : []);
if (activeProfileValue.includes(activeProfile)) activeProfile = activeProfileText[activeProfileValue.indexOf(activeProfile)];
}

if (this.data.attr('oidWindowState')) {
var windowState = vis.states.attr(this.data['oidWindowState'] + '.val').toString();
var windowStateValue = (data.attr('windowStateValues') ? data.attr('windowStateValues').split(';') : []);
var windowStateText = (data.attr('windowStateTexts') ? data.attr('windowStateTexts').split(';') : []);
if (windowStateValue.includes(windowState)) windowState = windowStateText[windowStateValue.indexOf(windowState)];
}
%>

<div class="vis-widget-body" id="<%= this.data.attr('wid') %>_body">
<span class="tileValue <%= vis.states.attr(this.data['oidActualTemperature'] + '.val') < vis.states.attr(this.data['oidSetPointTemperature'] + '.val') ? 'heating' : vis.states.attr(this.data['oidActualTemperature'] + '.val') > vis.states.attr(this.data['oidSetPointTemperature'] + '.val') ? 'cooling' : '' %>"><%= vis.states.attr(this.data['oidActualTemperature'] + '.val') %><%= this.data.attr('unitTemperature') %></span>
<div class="labelGroup1">
Expand All @@ -529,9 +512,23 @@
<span class="label2post"><%= this.data.attr('label2post') %></span>
</div>
<div class="labelGroup2">
<% if (this.data.attr('oidHumidity')) { %><span class="label3value"><%= vis.states.attr(this.data['oidHumidity'] + '.val') %><%= this.data.attr('unitHumidity') %></span><br><% } %>
<% if (this.data.attr('oidActiveProfile')) { %><span class="label4value"><%= activeProfile %></span><br><% } %>
<% if (this.data.attr('oidWindowState')) { %><span class="label5value"><%= windowState %></span><% } %>
<% if (this.data.attr('oidHumidity')) { %>
<span class="label3value"><%= vis.states.attr(this.data['oidHumidity'] + '.val') %><%= this.data.attr('unitHumidity') %></span><br>
<% } %>
<% if (this.data.attr('oidActiveProfile')) {
var activeProfile = vis.states.attr(this.data['oidActiveProfile'] + '.val').toString();
var activeProfileValue = (data.attr('activeProfileValues') ? data.attr('activeProfileValues').split(';') : []);
var activeProfileText = (data.attr('activeProfileTexts') ? data.attr('activeProfileTexts').split(';') : []);
if (activeProfileValue.includes(activeProfile)) activeProfile = activeProfileText[activeProfileValue.indexOf(activeProfile)]; %>
<span class="label4value"><%= activeProfile %></span><br>
<% } %>
<% if (this.data.attr('oidWindowState')) {
var windowState = vis.states.attr(this.data['oidWindowState'] + '.val').toString();
var windowStateValue = (data.attr('windowStateValues') ? data.attr('windowStateValues').split(';') : []);
var windowStateText = (data.attr('windowStateTexts') ? data.attr('windowStateTexts').split(';') : []);
if (windowStateValue.includes(windowState)) windowState = windowStateText[windowStateValue.indexOf(windowState)]; %>
<span class="label5value"><%= windowState %></span>
<% } %>
</div>
</div>

Expand All @@ -545,8 +542,31 @@
<div class="values">
<div class="setpointTemperature"><span class="title"><%= this.data.attr('setpointTemperatureLabel') %></span><span class="value"><%= vis.states.attr(this.data['oidSetPointTemperature'] + '.val') %><%= this.data.attr('unitTemperature') %></span></div>
<% if (this.data.attr('oidHumidity')) { %><div class="actualHumidity"><span class="title"><%= this.data.attr('actualHumidityLabel') %></span><span class="value"><%= vis.states.attr(this.data['oidHumidity'] + '.val') %><%= this.data.attr('unitHumidity') %></span></div><% } %>
<% if (this.data.attr('oidActiveProfile')) { %><div class="activeProfile <%= activeProfile %>"><span class="title"><%= this.data.attr('activeProfileLabel') %></span><span class="value"><%= activeProfile %></span></div><% } %>
<% if (this.data.attr('oidWindowState')) { %><div class="windowState <%= windowState %>"><span class="title"><%= this.data.attr('windowStateLabel') %></span><span class="value"><%= windowState %></span></div><% } %>
<% if (this.data.attr('oidActiveProfile')) {
var activeProfile = vis.states.attr(this.data['oidActiveProfile'] + '.val').toString();
var activeProfileValue = (data.attr('activeProfileValues') ? data.attr('activeProfileValues').split(';') : []);
var activeProfileText = (data.attr('activeProfileTexts') ? data.attr('activeProfileTexts').split(';') : []);
if (activeProfileValue.includes(activeProfile)) activeProfile = activeProfileText[activeProfileValue.indexOf(activeProfile)]; %>
<div class="activeProfile <%= activeProfile %>"><span class="title"><%= this.data.attr('activeProfileLabel') %></span>
<div class="selectProfile">
<select id="<%= this.data.attr('wid') %>_select" data-oid="<%= this.data.attr('oidActiveProfile') %>" data-view="<%= this.view %>" <%= (el) -> setTimeout(function () { vis.binds['vis-homekittiles'].multiselect(el)}, 250) %> >
<%
var values = (data.attr('activeProfileValues') ? data.attr('activeProfileValues').split(';') : []);
var texts = (data.attr('activeProfileTexts') ? data.attr('activeProfileTexts').split(';') : []);
for (var val in values) { %>
<option value="<%= values[val] %>"><%= texts[val] %></option>
<% } %>
</select >
</div>
</div>
<% } %>
<% if (this.data.attr('oidWindowState')) {
var windowState = vis.states.attr(this.data['oidWindowState'] + '.val').toString();
var windowStateValue = (data.attr('windowStateValues') ? data.attr('windowStateValues').split(';') : []);
var windowStateText = (data.attr('windowStateTexts') ? data.attr('windowStateTexts').split(';') : []);
if (windowStateValue.includes(windowState)) windowState = windowStateText[windowStateValue.indexOf(windowState)]; %>
<div class="windowState <%= windowState %>"><span class="title"><%= this.data.attr('windowStateLabel') %></span><span class="value"><%= windowState %></span></div>
<% } %>
<% if (this.data.attr('oidLowBat')) { %><div class="lowBat <%= vis.states.attr(this.data['oidLowBat'] + '.val') %>"><span class="value"><%= this.data.attr('lowBatLabel') %></span></div><% } %>
<% if (this.data.attr('oidUnreach')) { %><div class="unreach <%= vis.states.attr(this.data['oidUnreach'] + '.val') %>"><span class="value"><%= this.data.attr('unreachLabel') %></span></div><% } %>
</div>
Expand Down
28 changes: 28 additions & 0 deletions widgets/vis-homekittiles/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,34 @@
color: white;
font-size: 16px;
}
.homekitTiles.dialog .thermostat.content .values .selectProfile {
width: 88px;
font-size: 1.25rem;
line-height: 1.1;
display: grid;
grid-template-areas: "select";
align-items: center;
}
.homekitTiles.dialog .thermostat.content .values .selectProfile::after {
content: "";
width: 0.5em;
height: 0.3em;
background-color: white;
clip-path: polygon(100% 0%, 0 0%, 50% 100%);
justify-self: end;
grid-area: select;
margin-left: 10px;
}
.homekitTiles.dialog .thermostat.content .values .selectProfile select {
appearance: none;
background-color: transparent;
border: none;
font-size: 16px;
cursor: inherit;
outline: none;
grid-area: select;
color: white;
}
.homekitTiles.dialog .thermostat.content .values .lowBat.false {
display: none;
}
Expand Down
4 changes: 2 additions & 2 deletions widgets/vis-homekittiles/js/vis-homekittiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ vis.binds["vis-homekittiles"] = {
vis.views[view].widgets[widgetID].data.actualTemperatureLabel = 'Actual temperature';
vis.views[view].widgets[widgetID].data.setpointTemperatureLabel = 'Setpoint temperature';
vis.views[view].widgets[widgetID].data.actualHumidityLabel = 'Humidity';
vis.views[view].widgets[widgetID].data.activeProfileLabel = 'Temperature profile';
vis.views[view].widgets[widgetID].data.activeProfileLabel = 'Heating profile';
vis.views[view].widgets[widgetID].data.activeProfileValues = '1;2;3;4;5;6';
vis.views[view].widgets[widgetID].data.activeProfileTexts = 'Comfort;Eco;-;-;Preheating;Away';
vis.views[view].widgets[widgetID].data.windowStateLabel = 'Window';
Expand All @@ -996,7 +996,7 @@ vis.binds["vis-homekittiles"] = {
vis.views[view].widgets[widgetID].data.actualTemperatureLabel = 'Aktuelle Temperatur';
vis.views[view].widgets[widgetID].data.setpointTemperatureLabel = 'Sollwert';
vis.views[view].widgets[widgetID].data.actualHumidityLabel = 'Feuchte';
vis.views[view].widgets[widgetID].data.activeProfileLabel = 'Temperaturprofil';
vis.views[view].widgets[widgetID].data.activeProfileLabel = 'Heizprofil';
vis.views[view].widgets[widgetID].data.activeProfileValues = '1;2;3;4;5;6';
vis.views[view].widgets[widgetID].data.activeProfileTexts = 'Komfort;Eco;-;-;Vorheizen;Abwesend';
vis.views[view].widgets[widgetID].data.windowStateLabel = 'Fenster';
Expand Down

0 comments on commit d0565d9

Please sign in to comment.