From ebaa61f41f3123e92f85c97be767a5017520e3bc Mon Sep 17 00:00:00 2001 From: Standarduser Date: Wed, 15 May 2024 13:37:40 +0200 Subject: [PATCH] thermostat setpoint mode --- README.md | 1 + widgets/vis-homekittiles.html | 36 ++++++++++++- widgets/vis-homekittiles/css/style.css | 13 ++++- .../vis-homekittiles/js/vis-homekittiles.js | 54 ++++++------------- 4 files changed, 64 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 50c725c..7d810e0 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ The widgets are designed for VIS 1.x. * (Standarduser) thermostat: text presets * (Standarduser) thermostat: css-corrections * (Standarduser) thermostat: select for heating profile +* (Standarduser) thermostat: added setpoint mode ### 0.0.13 (2024-05-05) diff --git a/widgets/vis-homekittiles.html b/widgets/vis-homekittiles.html index 463bf0b..56fb072 100644 --- a/widgets/vis-homekittiles.html +++ b/widgets/vis-homekittiles.html @@ -467,6 +467,7 @@ autofillOids[true]/checkbox; oidActualTemperature/id/autofillThermostat(onChangeFunc); oidSetPointTemperature/id; + oidSetPointMode/id; oidHumidity/id; oidActiveProfile/id; oidLowBat/id; @@ -486,6 +487,10 @@ closebuttonLabel; actualTemperatureLabel; setpointTemperatureLabel; + setpointModeLabel; + setpointModeValues; + setpointModeTexts; + setpointModeOperable/checkbox; actualHumidityLabel; activeProfileLabel; activeProfileValues; @@ -529,7 +534,14 @@ 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)]; %> - <%= windowState %> + <%= windowState %>
+ <% } %> + <% if (this.data.attr('oidSetPointMode')) { + var setpointMode = vis.states.attr(this.data['oidSetPointMode'] + '.val').toString(); + var setpointModeValue = (data.attr('setpointModeValues') ? data.attr('setpointModeValues').split(';') : []); + var setpointModeText = (data.attr('setpointModeTexts') ? data.attr('setpointModeTexts').split(';') : []); + if (setpointModeValue.includes(setpointMode)) setpointMode = setpointModeText[setpointModeValue.indexOf(setpointMode)]; %> + <%= setpointMode %> <% } %> @@ -543,6 +555,28 @@
<% if (this.data.attr('oidSetPointTemperature')) { %>
<%= this.data.attr('setpointTemperatureLabel') %><%= vis.states.attr(this.data['oidSetPointTemperature'] + '.val') %><%= this.data.attr('unitTemperature') %>
<% } %> + <% if (this.data.attr('oidSetPointMode')) { + var setpointMode = vis.states.attr(this.data['oidSetPointMode'] + '.val').toString(); + var setpointModeValue = (data.attr('setpointModeValues') ? data.attr('setpointModeValues').split(';') : []); + var setpointModeText = (data.attr('setpointModeTexts') ? data.attr('setpointModeTexts').split(';') : []); + if (setpointModeValue.includes(setpointMode)) setpointMode = setpointModeText[setpointModeValue.indexOf(setpointMode)]; %> +
<%= this.data.attr('setpointModeLabel') %> + <% if (this.data.attr('setpointModeOperable')) { %> +
+ +
+ <% } else { %> + <%= setpointMode %>
+ <% } %> +
+ <% } %> <% if (this.data.attr('oidHumidity')) { %>
<%= this.data.attr('actualHumidityLabel') %><%= vis.states.attr(this.data['oidHumidity'] + '.val') %><%= this.data.attr('unitHumidity') %>
<% } %> <% if (this.data.attr('oidActiveProfile')) { var activeProfile = vis.states.attr(this.data['oidActiveProfile'] + '.val').toString(); diff --git a/widgets/vis-homekittiles/css/style.css b/widgets/vis-homekittiles/css/style.css index 1a01f9c..81ad47c 100644 --- a/widgets/vis-homekittiles/css/style.css +++ b/widgets/vis-homekittiles/css/style.css @@ -902,7 +902,8 @@ } .homekitTiles.tile.thermostatDialog .labelGroup2 .label3value, .homekitTiles.tile.thermostatDialog .labelGroup2 .label4value, -.homekitTiles.tile.thermostatDialog .labelGroup2 .label5value { +.homekitTiles.tile.thermostatDialog .labelGroup2 .label5value, +.homekitTiles.tile.thermostatDialog .labelGroup2 .label6value { display: inline-block; width: 62px; white-space: nowrap; @@ -911,7 +912,8 @@ } .homekitTiles.tile.thermostatDialog .labelGroup2 .label3value:before, .homekitTiles.tile.thermostatDialog .labelGroup2 .label4value:before, -.homekitTiles.tile.thermostatDialog .labelGroup2 .label5value:before { +.homekitTiles.tile.thermostatDialog .labelGroup2 .label5value:before, +.homekitTiles.tile.thermostatDialog .labelGroup2 .label6value:before { display: inline-block; width: 12px; text-align: center; @@ -928,6 +930,10 @@ content: "o"; font-family: Wingdings; } +.homekitTiles.tile.thermostatDialog .labelGroup2 .label6value:before { + content: "R"; + font-family: Wingdings; +} /* Thermostat Dialog */ .homekitTiles.dialog .content { @@ -980,6 +986,7 @@ color: white; font-size: 16px; } +.homekitTiles.dialog .thermostat.content .values .selectMode, .homekitTiles.dialog .thermostat.content .values .selectProfile { width: 88px; font-size: 1.25rem; @@ -988,6 +995,7 @@ grid-template-areas: "select"; align-items: center; } +.homekitTiles.dialog .thermostat.content .values .selectMode::after, .homekitTiles.dialog .thermostat.content .values .selectProfile::after { content: ""; width: 0.5em; @@ -998,6 +1006,7 @@ grid-area: select; margin-left: 10px; } +.homekitTiles.dialog .thermostat.content .values .selectMode select, .homekitTiles.dialog .thermostat.content .values .selectProfile select { appearance: none; background-color: transparent; diff --git a/widgets/vis-homekittiles/js/vis-homekittiles.js b/widgets/vis-homekittiles/js/vis-homekittiles.js index 7f15b79..69e7370 100644 --- a/widgets/vis-homekittiles/js/vis-homekittiles.js +++ b/widgets/vis-homekittiles/js/vis-homekittiles.js @@ -151,7 +151,8 @@ $.extend( "autofillOids": { "en": "Autofill object IDs", "de": "Objekt-IDs automatisch füllen" }, "oidActualTemperature": { "en": "Object ID for temperature", "de": "Objekt-ID für Temperatur" }, - "oidSetPointTemperature": { "en": "Object ID for setpoint", "de": "Objekt-ID für Sollwert" }, + "oidSetPointTemperature": { "en": "Object ID for setpoint temp", "de": "Objekt-ID für Sollwert Temp." }, + "oidSetPointMode": { "en": "Object ID for setpoint mode", "de": "Objekt-ID für Sollwert Modus" }, "oidHumidity": { "en": "Object ID for humidity", "de": "Objekt-ID für Feuchte" }, "oidActiveProfile": { "en": "Object ID for heating profile", "de": "Objekt-ID für Heizprofil" }, "oidLowBat": { "en": "Object ID for low battery", "de": "Objekt-ID für Batterie schwach" }, @@ -164,12 +165,16 @@ $.extend( "temperatureStep": { "en": "Temperature steps", "de": "Schrittweite Temperatur" }, "group_thermostatDialog": { "en": "Thermostat dialog", "de": "Thermostat-Dialog" }, "closebuttonLabel": { "en": "Label close-button", "de": "Beschriftung Schließen-Button" }, - "actualTemperatureLabel": { "en": "Label temperature", "de": "Beschriftung Temperatur" }, - "setpointTemperatureLabel": { "en": "Label setpoint", "de": "Beschriftung Sollwert" }, + "actualTemperatureLabel": { "en": "Label actual temperature", "de": "Beschriftung aktuelle Temperatur" }, + "setpointTemperatureLabel": { "en": "Label setpoint temperature", "de": "Beschriftung Sollwert Temperatur" }, + "setpointModeLabel": { "en": "Label setpoint mode", "de": "Beschriftung Sollwert Modus" }, + "setpointModeValues": { "en": "Values setpoint mode", "de": "Werte Sollwert Modus" }, + "setpointModeTexts": { "en": "Names setpoint mode", "de": "Namen Sollwert Modus" }, + "setpointModeOperable": { "en": "Setpoint mode operable", "de": "Sollwert Modus bedienbar" }, "actualHumidityLabel": { "en": "Label humidity", "de": "Beschriftung Feuchte" }, "activeProfileLabel": { "en": "Label heating profile", "de": "Beschriftung Heizprofil" }, "activeProfileValues": { "en": "Values of heating profile", "de": "Werte des Heizprofils" }, - "activeProfileTexts": { "en": "Names of heating profile", "de": "Namen des Heizprofiles" }, + "activeProfileTexts": { "en": "Names of heating profile", "de": "Namen des Heizprofils" }, "windowStateLabel": { "en": "Label window contact", "de": "Beschriftung Fensterkontakt" }, "windowStateValues": { "en": "Values of window contact", "de": "Werte des Fensterkontakts" }, "windowStateTexts": { "en": "Value names of window contact", "de": "Textwerte des Fensterkontakts" }, @@ -920,44 +925,13 @@ vis.binds["vis-homekittiles"] = { var autofill = vis.views[view].widgets[widgetID].data.autofillOids; - // if (autofill && value) { - // var oidPath = value.split('.'); - - // //check if thermostat is from homematic and autofill if calculated object id exists - // if (oidPath[0] === 'hm-rpc' && oidPath[4] === 'ACTUAL_TEMPERATURE') { - // if (vis.views[view].widgets[widgetID].data.oidSetPointTemperature === '' || vis.views[view].widgets[widgetID].data.oidSetPointTemperature === undefined) { - // var _oid = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.SET_POINT_TEMPERATURE'; - // if (vis.states.attr(_oid + '.val') !== undefined) vis.views[view].widgets[widgetID].data.oidSetPointTemperature = _oid; - // } - // if (vis.views[view].widgets[widgetID].data.oidHumidity === '' || vis.views[view].widgets[widgetID].data.oidHumidity === undefined) { - // var _oid = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.HUMIDITY'; - // if (vis.states.attr(_oid + '.val') !== undefined) vis.views[view].widgets[widgetID].data.oidHumidity = _oid; - // } - // if (vis.views[view].widgets[widgetID].data.oidActiveProfile === '' || vis.views[view].widgets[widgetID].data.oidActiveProfile === undefined) { - // var _oid = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.ACTIVE_PROFILE'; - // if (vis.states.attr(_oid + '.val') !== undefined) vis.views[view].widgets[widgetID].data.oidActiveProfile = _oid; - // } - // if (vis.views[view].widgets[widgetID].data.oidLowBat === '' || vis.views[view].widgets[widgetID].data.oidLowBat === undefined) { - // var _oid = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.0.LOW_BAT'; - // if (vis.states.attr(_oid + '.val') !== undefined) vis.views[view].widgets[widgetID].data.oidLowBat = _oid; - // } - // if (vis.views[view].widgets[widgetID].data.oidUnreach === '' || vis.views[view].widgets[widgetID].data.oidUnreach === undefined) { - // var _oid = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.0.UNREACH'; - // if (vis.states.attr(_oid + '.val') !== undefined) vis.views[view].widgets[widgetID].data.oidUnreach = _oid; - // } - // if (vis.views[view].widgets[widgetID].data.oidWindowState === '' || vis.views[view].widgets[widgetID].data.oidWindowState === undefined) { - // var _oid = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.WINDOW_STATE'; - // if (vis.states.attr(_oid + '.val') !== undefined) vis.views[view].widgets[widgetID].data.oidWindowState = _oid; - // } - // } - // } - if (autofill && value) { var oidPath = value.split('.'); //check if thermostat is from homematic and autofill if calculated object id exists if (oidPath[0] === 'hm-rpc' && oidPath[4] === 'ACTUAL_TEMPERATURE') { if (vis.states.attr(oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.SET_POINT_TEMPERATURE.val') !== undefined) vis.views[view].widgets[widgetID].data.oidSetPointTemperature = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.SET_POINT_TEMPERATURE'; + if (vis.states.attr(oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.SET_POINT_MODE.val') !== undefined) vis.views[view].widgets[widgetID].data.oidSetPointMode = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.SET_POINT_MODE'; if (vis.states.attr(oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.HUMIDITY.val') !== undefined) vis.views[view].widgets[widgetID].data.oidHumidity = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.HUMIDITY'; if (vis.states.attr(oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.ACTIVE_PROFILE.val') !== undefined) vis.views[view].widgets[widgetID].data.oidActiveProfile = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.1.ACTIVE_PROFILE'; if (vis.states.attr(oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.0.LOW_BAT.val') !== undefined) vis.views[view].widgets[widgetID].data.oidLowBat = oidPath[0] + '.' + oidPath[1] + '.' + oidPath[2] + '.0.LOW_BAT'; @@ -980,6 +954,9 @@ vis.binds["vis-homekittiles"] = { vis.views[view].widgets[widgetID].data.closebuttonLabel = 'Close'; vis.views[view].widgets[widgetID].data.actualTemperatureLabel = 'Actual temperature'; vis.views[view].widgets[widgetID].data.setpointTemperatureLabel = 'Setpoint temperature'; + vis.views[view].widgets[widgetID].data.setpointModeLabel = 'Setpoint mode'; + vis.views[view].widgets[widgetID].data.setpointModeValues = '0;1;2'; + vis.views[view].widgets[widgetID].data.setpointModeTexts = 'Auto;Manual;Holiday'; vis.views[view].widgets[widgetID].data.actualHumidityLabel = 'Humidity'; vis.views[view].widgets[widgetID].data.activeProfileLabel = 'Heating profile'; vis.views[view].widgets[widgetID].data.activeProfileValues = '1;2;3;4;5;6'; @@ -994,7 +971,10 @@ vis.binds["vis-homekittiles"] = { vis.views[view].widgets[widgetID].data.title = 'Raum'; vis.views[view].widgets[widgetID].data.closebuttonLabel = 'Schließen'; vis.views[view].widgets[widgetID].data.actualTemperatureLabel = 'Aktuelle Temperatur'; - vis.views[view].widgets[widgetID].data.setpointTemperatureLabel = 'Sollwert'; + vis.views[view].widgets[widgetID].data.setpointTemperatureLabel = 'Sollwert Temperatur'; + vis.views[view].widgets[widgetID].data.setpointModeLabel = 'Sollwert Modus'; + vis.views[view].widgets[widgetID].data.setpointModeValues = '0;1;2'; + vis.views[view].widgets[widgetID].data.setpointModeTexts = 'Auto;Manuell;Urlaub'; vis.views[view].widgets[widgetID].data.actualHumidityLabel = 'Feuchte'; vis.views[view].widgets[widgetID].data.activeProfileLabel = 'Heizprofil'; vis.views[view].widgets[widgetID].data.activeProfileValues = '1;2;3;4;5;6';