Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Completed settings page of smart home example app, new or-checkbox web component, removed last document-global styling from or-style

Christian Bauerab228dd68c27
diff --git a/client/src/main/webapp/index.html b/client/src/main/webapp/index.html
index b58df6c73..881c008bf 100644
--- a/client/src/main/webapp/index.html
+++ b/client/src/main/webapp/index.html
@@ -34,6 +34,17 @@
</script>
<style type="text/css">
+
+ html, body {
+ margin: 0;
+ height: 100vh;
+ overflow: hidden;
+ }
+
+ *:focus {
+ outline: 0;
+ }
+
::-webkit-scrollbar {
width: 1em;
}
diff --git a/client/src/main/webapp/src/or-app/or-style.html b/client/src/main/webapp/src/or-app/or-style.html
index d8c60c3f5..fbb643838 100644
--- a/client/src/main/webapp/src/or-app/or-style.html
+++ b/client/src/main/webapp/src/or-app/or-style.html
@@ -6,27 +6,10 @@
<dom-module id="or-style">
<template>
<style include="or-theme or-icons iron-flex iron-flex-alignment iron-flex-factors iron-positioning">
-
- * html, body {
- box-sizing: border-box;
- }
-
- html, body {
- width: 100%;
- height: 100vh;
- min-height: 100%;
- margin: 0;
- overflow: hidden;
- }
-
- *:focus {
- outline: 0;
- }
-
.or-Viewport {
width: 100%;
height: 100vh;
- min-height: 100%;
+ min-height: 100vh;
margin: 0;
}
@@ -642,7 +625,6 @@
padding: 0 0.4em;
font-size: 1em;
min-height: 1.5em;
- line-height: 1;
outline: 0;
border: 0;
border-radius: 0.15em;
@@ -664,54 +646,8 @@
pointer-events: none;
}
- .or-CheckBox {
- position: absolute;
- opacity: 0;
- margin: 0;
- cursor: pointer;
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- -webkit-tap-highlight-color: transparent;
- }
-
- .or-CheckBox:disabled {
- cursor: default;
- }
-
- .or-CheckBox,
- .or-CheckBox + label,
- .or-CheckBox + label:before {
- font-size: 1em;
- display: inline-block;
- width: 1.5em;
- height: 1.5em;
- }
-
- .or-CheckBox + label {
- position: relative;
- padding: 0;
- pointer-events: none;
- }
-
- .or-CheckBox + label:before {
- content: '';
- vertical-align: text-top;
- pointer-events: none;
- border-radius: 0.15em;
- }
-
- .or-CheckBox:checked + label:after {
- content: '';
- position: absolute;
- left: 0.4em;
- top: 0.7em;
- width: 0.2em;
- height: 0.2em;
- -webkit-transform: rotate(45deg);
- transform: rotate(45deg);
+ .or-Select select:focus {
+ outline: 0;
}
.or-Icon {
@@ -741,6 +677,11 @@
-webkit-box-sizing: content-box;;
}
+ .or-InputTime:focus,
+ .or-InputDate:focus {
+ outline: 0;
+ }
+
.or-InputTime::-webkit-datetime-edit,
.or-InputDate::-webkit-datetime-edit {
margin: 0;
diff --git a/client/src/main/webapp/src/or-app/or-theme.html b/client/src/main/webapp/src/or-app/or-theme.html
index 46c54976c..c7fd39bad 100644
--- a/client/src/main/webapp/src/or-app/or-theme.html
+++ b/client/src/main/webapp/src/or-app/or-theme.html
@@ -449,29 +449,6 @@
color: var(--theme-black);
}
- .or-CheckBox + label:before {
- background-color: var(--theme-lightgreen);
- }
-
- .or-CheckBox:checked + label:after {
- -webkit-box-shadow: 2px 0 0 var(--theme-black), 4px 0 0 var(--theme-black), 4px -2px 0 var(--theme-black), 4px -4px 0 var(--theme-black), 4px -6px 0 var(--theme-black), 4px -8px 0 var(--theme-black);
- box-shadow: 2px 0 0 var(--theme-black), 4px 0 0 var(--theme-black), 4px -2px 0 var(--theme-black), 4px -4px 0 var(--theme-black), 4px -6px 0 var(--theme-black), 4px -8px 0 var(--theme-black);
- background-color: var(--theme-black);
- }
-
- .or-CheckBox:disabled + label:before,
- .or-CheckBox:disabled:hover + label:before {
- -webkit-box-shadow: none;
- box-shadow: none;
- background-color: var(--theme-lightergrey);
- }
-
- .or-CheckBox:disabled:checked + label:after {
- -webkit-box-shadow: 2px 0 0 var(--theme-mediumgrey), 4px 0 0 var(--theme-mediumgrey), 4px -2px 0 var(--theme-mediumgrey), 4px -4px 0 var(--theme-mediumgrey), 4px -6px 0 var(--theme-mediumgrey), 4px -8px 0 var(--theme-mediumgrey);
- box-shadow: 2px 0 0 var(--theme-mediumgrey), 4px 0 0 var(--theme-mediumgrey), 4px -2px 0 var(--theme-mediumgrey), 4px -4px 0 var(--theme-mediumgrey), 4px -6px 0 var(--theme-mediumgrey), 4px -8px 0 var(--theme-mediumgrey);
- background-color: var(--theme-mediumgrey);
- }
-
.or-InputTime,
.or-InputDate {
background-color: var(--theme-black);
diff --git a/client/src/main/webapp/src/or-checkbox/or-checkbox.html b/client/src/main/webapp/src/or-checkbox/or-checkbox.html
new file mode 100644
index 000000000..0a9d2edee
--- /dev/null
+++ b/client/src/main/webapp/src/or-checkbox/or-checkbox.html
@@ -0,0 +1,71 @@
+<link rel="import" href="../or-app/or-style.html">
+
+<dom-module id="or-checkbox">
+
+ <template>
+ <style include="or-style">
+ :host {
+ width: 1.5em;
+ height: 1.5em;
+ background-color: var(--theme-lightgreen);
+ color: var(--theme-black);
+ cursor: pointer;
+ -webkit-tap-highlight-color: transparent;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ }
+
+ :host(:hover) {
+ opacity: .8;
+ }
+
+ .mark {
+ margin: 0 !important;
+ }
+ </style>
+
+ <span class$="mark [[icon('check')]]" hidden$="[[!checked]]"></span>
+
+ </template>
+
+ <script>
+ class OpenRemoteCheckbox extends OpenRemoteComponent {
+
+ static get is() {
+ return "or-checkbox";
+ }
+
+ static get properties() {
+ return {
+ checked: {
+ type: Boolean,
+ value: false,
+ notify: true
+ }
+ }
+ }
+
+
+ ready() {
+ super.ready();
+ this.shadowRoot.host.classList.add("layout", "vertical", "center-center")
+ this.shadowRoot.host.addEventListener("click", () => {
+ this.set("checked", !this.checked);
+ this.dispatchEvent(new CustomEvent("change", {detail: this.checked}));
+ });
+ }
+
+ connectedCallback() {
+ super.connectedCallback();
+ this.showComponent();
+ }
+
+ }
+
+ defineAppElement(OpenRemoteCheckbox, OpenRemoteCheckbox.is, "Checkbox");
+ </script>
+
+</dom-module>
\ No newline at end of file
diff --git a/deployment/manager/consoles/customerA/index.html b/deployment/manager/consoles/customerA/index.html
index de83de63d..521a5823e 100644
--- a/deployment/manager/consoles/customerA/index.html
+++ b/deployment/manager/consoles/customerA/index.html
@@ -25,12 +25,13 @@
}
/* Styles for the SmartHome app */
- html {
- height: 100%;
+ html, body {
+ margin: 0;
+ min-height: 100vh;
+ overflow: hidden;
}
body {
- min-height: 100%;
background: var(--theme-mediumgrey);
font-family: 'Open Sans', 'Roboto', Helvetica, Arial, Lucida, sans-serif;
}
@@ -38,7 +39,7 @@
</head>
-<body class="layout vertical">
+<body>
<or-app login tenant-realm="customerA">
diff --git a/deployment/manager/consoles/customerA/smart-home/locales.json b/deployment/manager/consoles/customerA/smart-home/locales.json
index c8f1b4443..a12927d30 100644
--- a/deployment/manager/consoles/customerA/smart-home/locales.json
+++ b/deployment/manager/consoles/customerA/smart-home/locales.json
@@ -40,6 +40,21 @@
"Auto": "Auto",
"Low": "Laag",
"Medium": "Medium",
- "High": "Hoog"
+ "High": "Hoog",
+ "Vacation": "Vakantie",
+ "On vacation until": "Op vakantie tot",
+ "Weekly Schedule": "Weekschema",
+ "Monday": "Maandag",
+ "Tuesday": "Dinsdag",
+ "Wednesday": "Woensdag",
+ "Thursday": "Donderdag",
+ "Friday": "Vrijdag",
+ "Saturday": "Zaterdag",
+ "Sunday": "Zondag",
+ "Scene start time": "Scene start time",
+ "Scene Configuration": "Scene Configuratie",
+ "Temperature": "Temperatuur",
+ "Enabled": "Geactiveerd",
+ "Scene": "Scene"
}
}
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-app.html b/deployment/manager/consoles/customerA/smart-home/smart-home-app.html
index 92f92c1b0..603104034 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-app.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-app.html
@@ -16,6 +16,9 @@
<dom-module id="smart-home-app">
<template>
<style include="smart-home-style">
+ :host {
+ min-height: 100vh;
+ }
</style>
<app-location use-hash-as-path route="{{appLocation}}"></app-location>
@@ -57,22 +60,22 @@
<smart-home-body>
<smart-home-scenes hidden$="[[!isActiveView(view, 'scenes')]]"
- residence="[[residence]]"></smart-home-scenes>
+ residence="[[residence]]"></smart-home-scenes>
<smart-home-energy hidden$="[[!isActiveView(view, 'energy')]]"
- residence="[[residence]]"
- rooms="[[rooms]]"></smart-home-energy>
+ residence="[[residence]]"
+ rooms="[[rooms]]"></smart-home-energy>
<smart-home-security hidden$="[[!isActiveView(view, 'security')]]"
- residence="[[residence]]"
- rooms="[[rooms]]"></smart-home-security>
+ residence="[[residence]]"
+ rooms="[[rooms]]"></smart-home-security>
<smart-home-climate hidden$="[[!isActiveView(view, 'climate')]]"
- residence="[[residence]]"
- rooms="[[rooms]]"></smart-home-climate>
+ residence="[[residence]]"
+ rooms="[[rooms]]"></smart-home-climate>
<smart-home-settings hidden$="[[!isActiveView(view, 'settings')]]"
- residence="[[residence]]"></smart-home-settings>
+ residence="[[residence]]"></smart-home-settings>
</smart-home-body>
</template>
@@ -111,6 +114,8 @@
ready() {
super.ready();
+ this.shadowRoot.host.classList.add("flex", "layout", "vertical");
+
console.log("Ready, initialising application state");
this.requests().sendAndReturn(
(requestParams) => {
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-body.html b/deployment/manager/consoles/customerA/smart-home/smart-home-body.html
index 43b5f86d2..66954a681 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-body.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-body.html
@@ -4,9 +4,6 @@
<dom-module id="smart-home-body">
<template>
<style include="smart-home-style">
- :host {
- margin-bottom: 10px;
- }
</style>
<slot></slot>
@@ -21,7 +18,7 @@
ready() {
super.ready();
- this.shadowRoot.host.classList.add("scroll");
+ this.shadowRoot.host.classList.add("scroll", "layout", "vertical");
}
}
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-climate.html b/deployment/manager/consoles/customerA/smart-home/smart-home-climate.html
index db0b02e4a..19dfb663e 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-climate.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-climate.html
@@ -2,6 +2,7 @@
<link rel="import" href="smart-home-style.html">
<link rel="import" href="smart-home-section.html">
<link rel="import" href="smart-home-smart.html">
+<link rel="import" href="smart-home-temperature-select.html">
<dom-module id="smart-home-climate">
<template>
@@ -41,95 +42,10 @@
</div>
<template is="dom-if" if="[[item.roomHasTargetTemperature]]">
<div class="targetTemperature">
- <div class="or-Select">
- <select value="{{item.targetTemperature::change}}"
- on-change="onTargetTemperatureChange"
- title="Target Temperature">
- <!-- TODO dom-repeat here is tricky, no matter where the items are computed, it's not working -->
- <option value="11">[[formatAttributeValue(item.targetTemperatureFormat,11.0)]]
- </option>
- <option value="11.5">[[formatAttributeValue(item.targetTemperatureFormat,11.5)]]
- </option>
- <option value="12">[[formatAttributeValue(item.targetTemperatureFormat,12.0)]]
- </option>
- <option value="12.5">[[formatAttributeValue(item.targetTemperatureFormat,12.5)]]
- </option>
- <option value="13">[[formatAttributeValue(item.targetTemperatureFormat,13.0)]]
- </option>
- <option value="13.5">[[formatAttributeValue(item.targetTemperatureFormat,13.5)]]
- </option>
- <option value="14">[[formatAttributeValue(item.targetTemperatureFormat,14.0)]]
- </option>
- <option value="14.5">[[formatAttributeValue(item.targetTemperatureFormat,14.5)]]
- </option>
- <option value="15">[[formatAttributeValue(item.targetTemperatureFormat,15.0)]]
- </option>
- <option value="15.5">[[formatAttributeValue(item.targetTemperatureFormat,15.5)]]
- </option>
- <option value="16">[[formatAttributeValue(item.targetTemperatureFormat,16.0)]]
- </option>
- <option value="16.5">[[formatAttributeValue(item.targetTemperatureFormat,16.5)]]
- </option>
- <option value="17">[[formatAttributeValue(item.targetTemperatureFormat,17.0)]]
- </option>
- <option value="17.5">[[formatAttributeValue(item.targetTemperatureFormat,17.5)]]
- </option>
- <option value="18">[[formatAttributeValue(item.targetTemperatureFormat,18.0)]]
- </option>
- <option value="18.5">[[formatAttributeValue(item.targetTemperatureFormat,18.5)]]
- </option>
- <option value="19">[[formatAttributeValue(item.targetTemperatureFormat,19.0)]]
- </option>
- <option value="19.5">[[formatAttributeValue(item.targetTemperatureFormat,19.5)]]
- </option>
- <option value="20">[[formatAttributeValue(item.targetTemperatureFormat,20.0)]]
- </option>
- <option value="20.5">[[formatAttributeValue(item.targetTemperatureFormat,20.5)]]
- </option>
- <option value="21">[[formatAttributeValue(item.targetTemperatureFormat,21.0)]]
- </option>
- <option value="21.5">[[formatAttributeValue(item.targetTemperatureFormat,21.5)]]
- </option>
- <option value="22">[[formatAttributeValue(item.targetTemperatureFormat,22.0)]]
- </option>
- <option value="22.5">[[formatAttributeValue(item.targetTemperatureFormat,22.5)]]
- </option>
- <option value="23">[[formatAttributeValue(item.targetTemperatureFormat,23.0)]]
- </option>
- <option value="23.5">[[formatAttributeValue(item.targetTemperatureFormat,23.5)]]
- </option>
- <option value="24">[[formatAttributeValue(item.targetTemperatureFormat,24.0)]]
- </option>
- <option value="24.5">[[formatAttributeValue(item.targetTemperatureFormat,24.5)]]
- </option>
- <option value="25">[[formatAttributeValue(item.targetTemperatureFormat,25.0)]]
- </option>
- <option value="25.5">[[formatAttributeValue(item.targetTemperatureFormat,25.5)]]
- </option>
- <option value="26">[[formatAttributeValue(item.targetTemperatureFormat,26.0)]]
- </option>
- <option value="26.5">[[formatAttributeValue(item.targetTemperatureFormat,26.5)]]
- </option>
- <option value="27">[[formatAttributeValue(item.targetTemperatureFormat,27.0)]]
- </option>
- <option value="27.5">[[formatAttributeValue(item.targetTemperatureFormat,27.5)]]
- </option>
- <option value="28">[[formatAttributeValue(item.targetTemperatureFormat,28.0)]]
- </option>
- <option value="28.5">[[formatAttributeValue(item.targetTemperatureFormat,28.5)]]
- </option>
- <option value="29">[[formatAttributeValue(item.targetTemperatureFormat,29.0)]]
- </option>
- <option value="29.5">[[formatAttributeValue(item.targetTemperatureFormat,29.5)]]
- </option>
- <option value="30">[[formatAttributeValue(item.targetTemperatureFormat,30.0)]]
- </option>
- <option value="30.5">[[formatAttributeValue(item.targetTemperatureFormat,30.5)]]
- </option>
- <option value="31">[[formatAttributeValue(item.targetTemperatureFormat,31.0)]]
- </option>
- </select>
- </div>
+ <smart-home-temperature-select
+ temperature="[[item.targetTemperature]]"
+ on-change="onTargetTemperatureChange"
+ temperature-format="[[item.targetTemperatureFormat]]"></smart-home-temperature-select>
</div>
</template>
<template is="dom-if" if="[[item.roomHasCurrentTemperature]]">
@@ -250,7 +166,7 @@
: null,
roomHasTargetTemperature: "targetTemperature" in room.attributes,
targetTemperature: room.attributes.targetTemperature
- ? room.attributes.targetTemperature.value
+ ? parseInt(room.attributes.targetTemperature.value) // TODO Currently we cut off decimal (19.5 -> 19)
: null,
targetTemperatureFormat: room.attributes.targetTemperature
? room.attributes.targetTemperature.meta.filter(m => m.name === "urn:openremote:asset:meta:format").map(m => m.value)[0]
@@ -315,7 +231,7 @@
onTargetTemperatureChange(e) {
this.sendAttributeEvent(
- e.model.item.roomId, "targetTemperature", parseFloat(e.target.value)
+ e.model.item.roomId, "targetTemperature", parseFloat(e.detail)
);
}
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-component.html b/deployment/manager/consoles/customerA/smart-home/smart-home-component.html
index 50ba7910e..7f7c7e769 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-component.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-component.html
@@ -10,11 +10,6 @@
}
}
}
-
- ready() {
- super.ready();
- this.shadowRoot.host.classList.add("layout", "vertical");
- }
}
</script>
</dom-module>
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-energy.html b/deployment/manager/consoles/customerA/smart-home/smart-home-energy.html
index c1b5cd7e4..fd5d1c381 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-energy.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-energy.html
@@ -67,7 +67,7 @@
</template>
</smart-home-section>
- <!-- TODO This section is not functional, not bound to any assets -->
+ <!-- TODO This section is not functional, not bound to any assets
<smart-home-section>
<div class="layout horizontal center">
<div class="flex" style="position: relative; padding-left: 10px;">
@@ -99,6 +99,7 @@
</div>
</div>
</smart-home-section>
+ -->
</template>
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-header.html b/deployment/manager/consoles/customerA/smart-home/smart-home-header.html
index 7f6cd16f8..4649cbc2a 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-header.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-header.html
@@ -85,7 +85,7 @@
ready() {
super.ready();
- this.shadowRoot.host.classList.add("flex-none");
+ this.shadowRoot.host.classList.add("flex-none", "layout", "vertical");
}
getNavItemClass(active, item) {
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-scenes.html b/deployment/manager/consoles/customerA/smart-home/smart-home-scenes.html
index d312e823f..dc5b423c5 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-scenes.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-scenes.html
@@ -26,8 +26,8 @@
}
.sceneItem.selected {
- background-color: var(--theme-lightergrey);
- color: var(--theme-mediumgrey);
+ background-color: var(--theme-lightgrey);
+ color: var(--theme-darkgrey);
}
.sceneItem.active {
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-section.html b/deployment/manager/consoles/customerA/smart-home/smart-home-section.html
index d2489e468..fc20cffd0 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-section.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-section.html
@@ -7,7 +7,7 @@
:host {
background-color: var(--theme-white);
border-radius: 10px;
- margin: 10px 10px 0 10px;
+ margin: 10px;
-webkit-box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.2);
box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.2);
@@ -22,18 +22,16 @@
user-select: none;
cursor: pointer;
color: var(--theme-darkgrey);
+ -webkit-tap-highlight-color: transparent;
+ -webkit-touch-callout: none;
}
.content {
padding: 10px;
- height: auto;
- overflow: auto;
}
.content[collapsed] {
- padding: 0;
- height: 0;
- overflow: hidden;
+ display: none;
}
.expandCollapseIcon {
@@ -43,13 +41,13 @@
</style>
<template is="dom-if" if="[[title]]">
- <div class="layout horizontal">
+ <div class="layout horizontal" hidden$="[[!title]]">
<div class="flex layout horizontal center title"
on-click="onTitleClicked">
<span class="flex or-Icon">&nbsp;</span>
<span class="">[[title]]</span>
- <span class$="flex [[icon('plus')]] expandCollapseIcon" hidden$="[[!collapsed]]"></span>
- <span class$="flex [[icon('minus')]] expandCollapseIcon" hidden$="[[collapsed]]"></span>
+ <span class$="flex [[icon('caret-down')]] expandCollapseIcon" hidden$="[[!collapsed]]"></span>
+ <span class$="flex [[icon('caret-up')]] expandCollapseIcon" hidden$="[[collapsed]]"></span>
</div>
</div>
</template>
@@ -81,7 +79,7 @@
ready() {
super.ready();
- this.shadowRoot.host.classList.add("flex-none");
+ this.shadowRoot.host.classList.add("flex-none", "layout", "vertical");
}
onTitleClicked() {
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-security.html b/deployment/manager/consoles/customerA/smart-home/smart-home-security.html
index 447f51b7c..95ac3c5bf 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-security.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-security.html
@@ -2,6 +2,7 @@
<link rel="import" href="smart-home-style.html">
<link rel="import" href="smart-home-section.html">
<link rel="import" href="smart-home-smart.html">
+<link rel="import" href="/static/src/or-checkbox/or-checkbox.html">
<dom-module id="smart-home-security">
<template>
@@ -47,12 +48,8 @@
</div>
</div>
<div class="layout horizontal">
- <input class="or-CheckBox"
- id="alarmEnabled"
- type="checkbox"
- on-change="onAlarmEnabledChange"
- checked="[[residence.attributes.alarmEnabled.value]]"/>
- <label for="alarmEnabled"></label>
+ <or-checkbox checked="[[residence.attributes.alarmEnabled.value]]"
+ on-change="onAlarmEnabledChange"></or-checkbox>
</div>
</div>
@@ -91,9 +88,9 @@
}
}
- onAlarmEnabledChange() {
+ onAlarmEnabledChange(e) {
this.sendAttributeEvent(
- this.residence.id, "alarmEnabled", this.$.alarmEnabled.checked
+ this.residence.id, "alarmEnabled", e.detail
);
}
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-settings.html b/deployment/manager/consoles/customerA/smart-home/smart-home-settings.html
index f81f1ee36..f7a8f7637 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-settings.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-settings.html
@@ -1,6 +1,8 @@
<link rel="import" href="smart-home-component.html">
<link rel="import" href="smart-home-style.html">
<link rel="import" href="smart-home-section.html">
+<link rel="import" href="smart-home-temperature-select.html">
+<link rel="import" href="/static/src/or-checkbox/or-checkbox.html">
<dom-module id="smart-home-settings">
<template>
@@ -8,29 +10,135 @@
.infoLabel {
font-size: smaller;
font-style: italic;
- color: var(--theme-darkgrey);
- margin: 0.8em;
+ color: var(--theme-white);
+ margin: 20px;
}
+
+ .row .field {
+ font-size: smaller;
+ margin: 0.6em 0;
+ }
+
+ .row .first.field {
+ max-width: 5.5em;
+ min-width: 5.5em;
+ }
+
+ .first.row {
+ background-color: var(--theme-lightergrey);
+ color: var(--theme-black);
+ }
+
+ .first.row .first.field {
+ font-weight: 600;
+ margin: 0;
+ padding: 0.6em 0;
+ background-color: var(--theme-white);
+ }
+
+ .row .field .or-InputTime {
+ max-width: 4.4em;
+ padding: 0 0.2em;
+ }
+
</style>
- <smart-home-section title="[[localize('Vacation')]]">
- <div class="layout horizontal center">
+ <smart-home-section title="[[localize('Vacation')]]" collapsed>
+ <div class="layout horizontal center" style="margin-bottom: 10px;">
<div class="flex">[[localize('On vacation until')]]</div>
<input class="or-Input or-InputDate"
title="[[localize('End of vacation')]]"
type="date"
empty$="[[vacationUntilEmpty]]"
value="[[vacationUntil]]"
- on-input="onVacationUntilChanged"/>
+ on-input="onVacationUntilChange"/>
</div>
</smart-home-section>
<smart-home-section title="[[localize('Weekly Schedule')]]" collapsed>
- TODO
+ <div class="layout horizontal">
+ <div class="layout horizontal first row">
+ <div class="first field">[[localize('Scene')]]</div>
+ </div>
+ <template is="dom-repeat" items="{{scenes}}" as="scene">
+ <div class="flex layout horizontal center-center first row">
+ <div class="field">[[localize(scene.label)]]</div>
+ </div>
+ </template>
+ </div>
+ <template is="dom-repeat" items="{{weekdays}}" as="weekday">
+ <div class="layout horizontal">
+ <div class="layout horizontal center row">
+ <div class="first field">[[localize(weekday)]]</div>
+ </div>
+ <template is="dom-repeat" items="{{scenes}}" as="scene">
+ <div class="flex layout horizontal center-center row">
+ <div class="field">
+ <input class="or-Input or-InputTime"
+ title="[[localize('Scene start time')]]"
+ type="time"
+ step="60"
+ required
+ value="[[getSceneTime(residence.attributes, weekday, scene.name)]]"
+ on-input="onSceneTimeChange"/>
+ </div>
+ </div>
+ </template>
+ </div>
+ </template>
</smart-home-section>
- <smart-home-section title="[[localize('Scenes')]]" collapsed>
- TODO
+ <smart-home-section title="[[localize('Scene Configuration')]]" collapsed>
+ <div class="layout horizontal">
+ <div class="layout horizontal first row">
+ <div class="first field">[[localize('Alarm')]]</div>
+ </div>
+ <template is="dom-repeat" items="{{scenes}}" as="scene">
+ <div class="flex layout horizontal center-center first row">
+ <div class="field">[[localize(scene.label)]]</div>
+ </div>
+ </template>
+ </div>
+ <div class="layout horizontal">
+ <div class="layout horizontal center row">
+ <div class="first field">[[localize('Enabled')]]</div>
+ </div>
+ <template is="dom-repeat" items="{{scenes}}" as="scene">
+ <div class="flex layout horizontal center-center row">
+ <div class="field">
+ <or-checkbox checked="[[getAlarmEnabled(residence.attributes, scene.name)]]"
+ on-change="onAlarmEnabledChange"></or-checkbox>
+ </div>
+ </div>
+ </template>
+ </div>
+
+ <div class="layout horizontal" style="margin-top: 20px;">
+ <div class="layout horizontal first row">
+ <div class="first field">[[localize('Climate')]]</div>
+ </div>
+ <template is="dom-repeat" items="{{scenes}}" as="scene">
+ <div class="flex layout horizontal center-center first row">
+ <div class="field">[[localize(scene.label)]]</div>
+ </div>
+ </template>
+ </div>
+ <div class="layout horizontal">
+ <div class="layout horizontal center row">
+ <div class="first field">[[localize('Temperature')]]</div>
+ </div>
+ <template is="dom-repeat" items="{{scenes}}" as="scene">
+ <div class="flex layout horizontal center-center row">
+ <div class="field">
+ <smart-home-temperature-select
+ temperature="[[getSceneTemperature(residence.attributes, scene.name)]]"
+ on-change="onSceneTemperatureChange"
+ temperature-format="%0f° C"></smart-home-temperature-select>
+ </div>
+ </div>
+ </template>
+ </div>
+
</smart-home-section>
<div class="layout horizontal center-center infoLabel">[[residence.name]]</div>
@@ -47,30 +155,51 @@
return {
vacationUntilEmpty: {
type: Boolean,
- computed: "computeVacationUntilEmpty(residence.*)"
+ computed: "computeVacationUntilEmpty(residence.attributes)"
},
vacationUntil: {
type: String,
- computed: "computeVacationUntil(residence.*)"
+ computed: "computeVacationUntil(residence.attributes)"
+ },
+ scenes: {
+ type: Array,
+ value: [
+ {name: "home", label: "At Home"},
+ {name: "away", label: "Away"},
+ {name: "evening", label: "Evening"},
+ {name: "night", label: "Night"},
+ ]
+ },
+ weekdays: {
+ type: Array,
+ value: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
},
- smartSwitchHourMinuteChangeDebouncer: {
- type: Object,
- value: {}
- }
}
}
- computeVacationUntilEmpty() {
- return !this.residence.attributes.vacationUntil || !this.residence.attributes.vacationUntil.value;
+ static get observers() {
+ return [
+ "onResidenceChange(residence.*)"
+ ]
+ }
+
+ onResidenceChange() {
+ // When anything on residence changes, notify everyone that attributes (might have) changed
+ this.notifyPath("residence.attributes")
+ }
+
+
+ computeVacationUntilEmpty(attributes) {
+ return !attributes || !attributes.vacationUntil || !attributes.vacationUntil.value;
}
- computeVacationUntil() {
- return this.residence.attributes.vacationUntil && this.residence.attributes.vacationUntil.value
- ? moment(this.residence.attributes.vacationUntil.value).format("YYYY-MM-DD")
+ computeVacationUntil(attributes) {
+ return attributes && attributes.vacationUntil && attributes.vacationUntil.value
+ ? moment(attributes.vacationUntil.value).format("YYYY-MM-DD")
: moment().add(7, "days").format("YYYY-MM-DD"); // Show 1 week in future if no vacation until set
}
- onVacationUntilChanged(e) {
+ onVacationUntilChange(e) {
let vacationUntilMoment = moment(e.target.value, "YYYY-MM-DD");
this.sendAttributeEvent(
this.residence.id,
@@ -79,6 +208,44 @@
vacationUntilMoment.isAfter(moment()) ? vacationUntilMoment.valueOf() : undefined
);
}
+
+ getSceneTime(attributes, weekday, scene) {
+ let weekdayUpperCase = weekday.toUpperCase();
+ return attributes && attributes[scene + "SceneTime" + weekdayUpperCase]
+ ? moment(attributes[scene + "SceneTime" + weekdayUpperCase].value, "HH:mm:ss").format("HH:mm")
+ : undefined;
+ }
+
+ onSceneTimeChange(e) {
+ let weekdayUpperCase = e.model.weekday.toUpperCase();
+ let scene = e.model.scene.name;
+ let value = moment(e.target.value, "HH:mm").format("HH:mm:ss");
+ this.sendAttributeEvent(this.residence.id, scene + "SceneTime" + weekdayUpperCase, value);
+ }
+
+ getAlarmEnabled(attributes, scene) {
+ return attributes && attributes[scene + "SceneAlarmEnabled"]
+ ? attributes[scene + "SceneAlarmEnabled"].value
+ : undefined;
+ }
+
+ onAlarmEnabledChange(e) {
+ let scene = e.model.scene.name;
+ let enabled = e.detail;
+ this.sendAttributeEvent(this.residence.id, scene + "SceneAlarmEnabled", enabled);
+ }
+
+ getSceneTemperature(attributes, scene) {
+ return attributes && attributes[scene + "SceneTargetTemperature"]
+ ? parseInt(attributes[scene + "SceneTargetTemperature"].value) // TODO Cut off decimal
+ : undefined;
+ }
+
+ onSceneTemperatureChange(e) {
+ let scene = e.model.scene.name;
+ let temperature = e.detail;
+ this.sendAttributeEvent(this.residence.id, scene + "SceneTargetTemperature", temperature);
+ }
}
defineAppElement(SmartHomeSettings, SmartHomeSettings.is, "SmartHomeSettings");
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-smart.html b/deployment/manager/consoles/customerA/smart-home/smart-home-smart.html
index fa461b54e..269601eda 100644
--- a/deployment/manager/consoles/customerA/smart-home/smart-home-smart.html
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-smart.html
@@ -1,6 +1,7 @@
<link rel="import" href="smart-home-component.html">
<link rel="import" href="smart-home-style.html">
<link rel="import" href="smart-home-section.html">
+<link rel="import" href="/static/src/or-checkbox/or-checkbox.html">
<dom-module id="smart-home-smart">
<template>
@@ -16,12 +17,8 @@
<!-- "All Smart" currently means enabling/disabling automatic scene switching based on schedule -->
<div class="flex layout horizontal smartLabel">[[localize('All Smart')]]</div>
<div class="layout horizontal">
- <input class="or-CheckBox"
- id="smartToggle"
- type="checkbox"
- on-change="onSmartToggleChange"
- checked="[[residence.attributes.sceneTimerEnabled.value]]"/>
- <label for="smartToggle"></label>
+ <or-checkbox checked="[[residence.attributes.sceneTimerEnabled.value]]"
+ on-change="onSmartToggleChange"></or-checkbox>
</div>
</div>
</smart-home-section>
@@ -41,7 +38,7 @@
onSmartToggleChange(e) {
this.sendAttributeEvent(
- this.residence.id, e.target.checked ? "enableSceneTimer" : "disableSceneTimer", "REQUEST_START"
+ this.residence.id, e.detail ? "enableSceneTimer" : "disableSceneTimer", "REQUEST_START"
);
}
}
diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-temperature-select.html b/deployment/manager/consoles/customerA/smart-home/smart-home-temperature-select.html
new file mode 100644
index 000000000..65334173e
--- /dev/null
+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-temperature-select.html
@@ -0,0 +1,68 @@
+<link rel="import" href="smart-home-component.html">
+<link rel="import" href="smart-home-style.html">
+
+<dom-module id="smart-home-temperature-select">
+ <template>
+ <style include="smart-home-style">
+ </style>
+
+ <div class="or-Select">
+ <select value="[[temperature]]"
+ on-change="onTemperatureChange"
+ title="[[localize('Temperature')]]">
+ <template is="dom-repeat" items="[[availableTemperatures]]" as="t">
+ <option value="[[t]]" selected$="[[isSelected(temperature, t)]]">
+ [[formatAttributeValue(temperatureFormat, t)]]
+ </option>
+ </template>
+ </select>
+ </div>
+ </template>
+
+ <script>
+ class SmartHomeTemperatureSelect extends SmartHomeComponent {
+ static get is() {
+ return "smart-home-temperature-select";
+ }
+
+ static get properties() {
+ return {
+ temperatureFormat: {
+ type: String
+ },
+ temperature: {
+ type: Number,
+ },
+ availableTemperatures: {
+ type: Array,
+ value: () => {
+ let temperatures = [];
+ // Support temperatures from 11 to 31 degrees
+ for(let t = 11; t <= 31; t++) {
+ temperatures.push(t);
+ }
+ return temperatures
+ }
+ }
+ }
+ }
+
+ ready() {
+ super.ready();
+ this.shadowRoot.host.classList.add("flex-none");
+ }
+
+ isSelected(temperature, t) {
+ return temperature === t;
+ }
+
+ onTemperatureChange(e) {
+ this.set("temperature", parseInt(e.target.value));
+ this.dispatchEvent(new CustomEvent("change", {detail: this.temperature}));
+ }
+ }
+
+ defineAppElement(SmartHomeTemperatureSelect, SmartHomeTemperatureSelect.is, "SmartHomeTemperatureSelect");
+ </script>
+
+</dom-module>
diff --git a/deployment/manager/consoles/master/examples.html b/deployment/manager/consoles/master/examples.html
index e657d5b32..32c5bc33f 100644
--- a/deployment/manager/consoles/master/examples.html
+++ b/deployment/manager/consoles/master/examples.html
@@ -10,6 +10,7 @@
<link rel="import" href="/static/src/or-app/or-app.html">
<link rel="import" href="/static/src/or-asset-list/or-asset-list.html">
+ <link rel="import" href="/static/src/or-checkbox/or-checkbox.html">
<!-- Optional: You can import other OpenRemote modules here -->
<!-- Optional: Load more application resources after authentication -->
@@ -49,6 +50,12 @@
}
/* Optional: Create some styles only for your app */
+ html, body {
+ margin: 0;
+ min-height: 100vh;
+ overflow: hidden;
+ }
+
.myAppHeadline {
display: block;
text-decoration: none;
@@ -62,7 +69,7 @@
</head>
<!-- Optional: You should use flexbox layout classes everywhere, starting with the body -->
-<body class="layout vertical">
+<body>
<!-- ############## Required: One <or-app> should wrap your frontend, you can enforce login/authentication ############## -->
<or-app login tenant-realm="master">
@@ -185,34 +192,11 @@
</button>
<div>
- <input class="or-CheckBox"
- id="toggle1"
- type="checkbox"/>
- <label for="toggle1"></label>
- </div>
-
- <div>
- <input class="or-CheckBox"
- id="toggle2"
- type="checkbox"
- checked/>
- <label for="toggle2"></label>
- </div>
-
- <div>
- <input class="or-CheckBox"
- id="toggle3"
- type="checkbox"
- disabled/>
- <label for="toggle3"></label>
+ <or-checkbox ></or-checkbox>
</div>
<div>
- <input class="or-CheckBox"
- id="toggle4"
- type="checkbox"
- checked disabled/>
- <label for="toggle4"></label>
+ <or-checkbox checked></or-checkbox>
</div>
<div class="or-Select">
diff --git a/keycloak/theme/account/template.ftl b/keycloak/theme/account/template.ftl
index def9c2ee2..994b75754 100644
--- a/keycloak/theme/account/template.ftl
+++ b/keycloak/theme/account/template.ftl
@@ -24,6 +24,15 @@
or-app > * {
visibility: hidden;
}
+
+ html, body {
+ margin: 0;
+ height: 100vh;
+ }
+
+ *:focus {
+ outline: 0;
+ }
</style>
</head>
diff --git a/keycloak/theme/login/template.ftl b/keycloak/theme/login/template.ftl
index bb05a1bf9..b4420d7d1 100755
--- a/keycloak/theme/login/template.ftl
+++ b/keycloak/theme/login/template.ftl
@@ -24,6 +24,16 @@
or-app > * {
visibility: hidden;
}
+
+ html, body {
+ margin: 0;
+ height: 100vh;
+ }
+
+ *:focus {
+ outline: 0;
+ }
+
</style>
</head>
diff --git a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
index fd29c5dc2..425fe4458 100644
--- a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
@@ -88,6 +88,7 @@ public abstract class AbstractManagerSetup implements Setup {
new MetaItem(LABEL, Values.create("Presence detected")),
new MetaItem(DESCRIPTION, Values.create("Presence detected in any room")),
new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)),
+ new MetaItem(READ_ONLY, Values.create(true)),
new MetaItem(RULE_STATE, Values.create(true)),
new MetaItem(STORE_DATA_POINTS, Values.create(true)),
new MetaItem(SHOW_ON_DASHBOARD, Values.create(true))
@@ -116,6 +117,7 @@ public abstract class AbstractManagerSetup implements Setup {
new MetaItem(RULE_STATE, Values.create(true)),
new MetaItem(SHOW_ON_DASHBOARD, Values.create(true))
),
+ // TODO Unused, can be removed? Port schedule prediction from DRL...
new AssetAttribute("lastDetectedScene", AttributeType.STRING, Values.create("home"))
.setMeta(
new MetaItem(LABEL, Values.create("Last detected scene by rules")),
@@ -139,8 +141,7 @@ public abstract class AbstractManagerSetup implements Setup {
new MetaItem(LABEL, Values.create("Motion sensor")),
new MetaItem(DESCRIPTION, Values.create("Greater than zero when motion is sensed")),
new MetaItem(READ_ONLY, Values.create(true)),
- new MetaItem(RULE_STATE, Values.create(true)),
- new MetaItem(STORE_DATA_POINTS, Values.create(true))
+ new MetaItem(RULE_STATE, Values.create(true))
).addMeta(shouldBeLinked ? agentLinker.get() : null),
new AssetAttribute("presenceDetected", AttributeType.BOOLEAN)
.setMeta(
@@ -148,17 +149,20 @@ public abstract class AbstractManagerSetup implements Setup {
new MetaItem(DESCRIPTION, Values.create("Someone is moving or resting in the room")),
new MetaItem(RULE_STATE, Values.create(true)),
new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)),
+ new MetaItem(READ_ONLY, Values.create(true)),
new MetaItem(STORE_DATA_POINTS, Values.create(true)),
new MetaItem(SHOW_ON_DASHBOARD, Values.create(true))
),
new AssetAttribute("firstPresenceDetected", TIMESTAMP_MILLIS)
.setMeta(
new MetaItem(LABEL, Values.create("First time movement was detected")),
+ new MetaItem(READ_ONLY, Values.create(true)),
new MetaItem(RULE_STATE, Values.create(true))
),
new AssetAttribute("lastPresenceDetected", TIMESTAMP_MILLIS)
.setMeta(
new MetaItem(LABEL, Values.create("Last time movement was detected")),
+ new MetaItem(READ_ONLY, Values.create(true)),
new MetaItem(RULE_STATE, Values.create(true))
)
);
@@ -226,7 +230,7 @@ public abstract class AbstractManagerSetup implements Setup {
new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)),
new MetaItem(ACCESS_RESTRICTED_WRITE, Values.create(true)),
new MetaItem(SHOW_ON_DASHBOARD, Values.create(true)),
- new MetaItem(FORMAT, Values.create("%0.1f° C"))
+ new MetaItem(FORMAT, Values.create("%0f° C"))
).addMeta(shouldBeLinked ? agentLinker.get() : null)
);
}
@@ -268,6 +272,7 @@ public abstract class AbstractManagerSetup implements Setup {
.setMeta(
new MetaItem(LABEL, Values.create("Smart Switch actuator earliest start time " + switchName)),
new MetaItem(DESCRIPTION, Values.create("Earliest computed start time sent to actuator")),
+ new MetaItem(READ_ONLY, Values.create(true)),
new MetaItem(RULE_STATE, Values.create(true))
).addMeta(shouldBeLinked ? agentLinker.apply(2) : null),
// StopTime
@@ -275,6 +280,7 @@ public abstract class AbstractManagerSetup implements Setup {
.setMeta(
new MetaItem(LABEL, Values.create("Smart Switch actuator latest stop time " + switchName)),
new MetaItem(DESCRIPTION, Values.create("Latest computed stop time sent to actuator")),
+ new MetaItem(READ_ONLY, Values.create(true)),
new MetaItem(RULE_STATE, Values.create(true))
).addMeta(shouldBeLinked ? agentLinker.apply(3) : null),
// Enabled
@@ -282,6 +288,7 @@ public abstract class AbstractManagerSetup implements Setup {
.setMeta(
new MetaItem(LABEL, Values.create("Smart Switch actuator enabled " + switchName)),
new MetaItem(DESCRIPTION, Values.create("1 if actuator only provides power at ideal time between start/stop")),
+ new MetaItem(READ_ONLY, Values.create(true)),
new MetaItem(RULE_STATE, Values.create(true))
).addMeta(shouldBeLinked ? agentLinker.apply(4) : null)
);
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
index 1f41818b6..74553867f 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
@@ -600,9 +600,9 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
asset.getAttribute("co2Level").isPresent()
asset.getAttribute("co2Level").get().meta.size() == 11
asset.getAttribute("lastPresenceDetected").isPresent()
- asset.getAttribute("lastPresenceDetected").get().meta.size() == 2
+ asset.getAttribute("lastPresenceDetected").get().meta.size() == 3
asset.getAttribute("motionSensor").isPresent()
- asset.getAttribute("motionSensor").get().meta.size() == 7
+ asset.getAttribute("motionSensor").get().meta.size() == 6
when: "a query is executed to select a subset of protected attributes"
asset = assetStorageService.find(