Adds script component.
A script is composed of a sequence of actions (currently service calls) that are executed in order. Individual actions can also be delayed by a given timedelta.
This commit is contained in:
1 parent
948a5c97ec
commit
046efe3acb
10 files changed
+223
-7
No files matched your search
+22
-2
@@ -93,6 +93,13 @@
|
||||
</paper-item>
|
||||
</template>
|
||||
|
||||
<template if="{{hasScriptComponent}}">
|
||||
<paper-item data-panel="script">
|
||||
<core-icon icon="description"></core-icon>
|
||||
Scripts
|
||||
</paper-item>
|
||||
</template>
|
||||
|
||||
<div flex></div>
|
||||
|
||||
<paper-item on-click="{{handleLogOutClick}}">
|
||||
@@ -124,10 +131,10 @@
|
||||
This is the main partial, never remove it from the DOM but hide it
|
||||
to speed up when people click on states.
|
||||
-->
|
||||
<partial-states hidden?="{{selected != 'states' && selected != 'group'}}"
|
||||
<partial-states hidden?="{{hideStates}}"
|
||||
main narrow="{{narrow}}"
|
||||
togglePanel="{{togglePanel}}"
|
||||
filter="{{selected == 'group' ? 'group' : null}}">
|
||||
filter="{{selected}}">
|
||||
</partial-states>
|
||||
|
||||
<template if="{{selected == 'history'}}">
|
||||
@@ -153,10 +160,13 @@ Polymer(Polymer.mixin({
|
||||
selected: "states",
|
||||
narrow: false,
|
||||
hasHistoryComponent: false,
|
||||
hasScriptComponent: false,
|
||||
|
||||
isStreaming: false,
|
||||
hasStreamError: false,
|
||||
|
||||
hideStates: false,
|
||||
|
||||
attached: function() {
|
||||
this.togglePanel = this.togglePanel.bind(this);
|
||||
|
||||
@@ -169,6 +179,7 @@ Polymer(Polymer.mixin({
|
||||
|
||||
componentStoreChanged: function(componentStore) {
|
||||
this.hasHistoryComponent = componentStore.isLoaded('history');
|
||||
this.hasScriptComponent = componentStore.isLoaded('script');
|
||||
},
|
||||
|
||||
streamStoreChanged: function(streamStore) {
|
||||
@@ -194,6 +205,15 @@ Polymer(Polymer.mixin({
|
||||
this.togglePanel();
|
||||
this.selected = newChoice;
|
||||
}
|
||||
switch(this.selected) {
|
||||
case 'states':
|
||||
case 'group':
|
||||
case 'script':
|
||||
hideStates = false;
|
||||
break;
|
||||
default:
|
||||
hideStates = true;
|
||||
}
|
||||
},
|
||||
|
||||
responsiveChanged: function(ev, detail, sender) {
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@
|
||||
|
||||
<div class='sidebar'>
|
||||
<b>Available services:</b>
|
||||
<services-list cbServiceClicked={{serviceSelected}}></event-list>
|
||||
<services-list cbServiceClicked={{serviceSelected}}></services-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -70,6 +70,10 @@
|
||||
var stateStore = window.hass.stateStore;
|
||||
|
||||
var stateGroupFilter = function(state) { return state.domain === 'group'; };
|
||||
var stateScriptFilter = function(state) { return state.domain === 'script'; };
|
||||
var stateFilter = function(state) {
|
||||
return !stateGroupFilter(state) && !stateScriptFilter(state);
|
||||
};
|
||||
|
||||
Polymer(Polymer.mixin({
|
||||
headerTitle: "States",
|
||||
@@ -130,6 +134,10 @@
|
||||
this.headerTitle = "Groups";
|
||||
break;
|
||||
|
||||
case "script":
|
||||
this.headerTitle = "Scripts";
|
||||
break;
|
||||
|
||||
default:
|
||||
this.headerTitle = "States";
|
||||
break;
|
||||
@@ -139,10 +147,12 @@
|
||||
refreshStates: function() {
|
||||
var states = stateStore.all;
|
||||
|
||||
if (this.filter === 'group') {
|
||||
if (this.filter == 'group') {
|
||||
states = states.filter(stateGroupFilter);
|
||||
} else if (this.filter == 'script') {
|
||||
states = states.filter(stateScriptFilter);
|
||||
} else {
|
||||
states = states.filterNot(stateGroupFilter);
|
||||
states = states.filter(stateFilter);
|
||||
}
|
||||
|
||||
this.states = states.toArray();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<link rel="import" href="more-info-sun.html">
|
||||
<link rel="import" href="more-info-configurator.html">
|
||||
<link rel="import" href="more-info-thermostat.html">
|
||||
<link rel="import" href="more-info-script.html">
|
||||
|
||||
<polymer-element name="more-info-content" attributes="stateObj">
|
||||
<template>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<link rel="import" href="../bower_components/polymer/polymer.html">
|
||||
<link rel="import" href="../bower_components/core-style/core-style.html">
|
||||
|
||||
<polymer-element name="more-info-script" attributes="stateObj" noscript>
|
||||
<template>
|
||||
<core-style ref='ha-key-value-table'></core-style>
|
||||
<style>
|
||||
.data-entry .value {
|
||||
max-width: 200px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div layout vertical>
|
||||
<div layout justified horizontal class='data-entry'>
|
||||
<div class='key'>Last Action</div>
|
||||
<div class='value'>
|
||||
{{stateObj.attributes.last_action}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</polymer-element>
|
||||
+3
@@ -81,6 +81,9 @@ window.hass.uiUtil.domainIcon = function(domain, state) {
|
||||
case "conversation":
|
||||
return "av:hearing";
|
||||
|
||||
case "script":
|
||||
return "description";
|
||||
|
||||
default:
|
||||
return "bookmark-outline";
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
(function() {
|
||||
var DOMAINS_WITH_CARD = ['thermostat', 'configurator'];
|
||||
var DOMAINS_WITH_MORE_INFO = [
|
||||
'light', 'group', 'sun', 'configurator', 'thermostat'
|
||||
'light', 'group', 'sun', 'configurator', 'thermostat', 'script'
|
||||
];
|
||||
|
||||
// Register some polymer filters
|
||||
|
||||
Reference in new issue
Block a user