Add automation more info

This commit is contained in:
Paulus Schoutsen 2016-09-01 10:49:31 +01:00
parent 670ba0292b
commit ffce92d026
4 changed files with 53 additions and 2 deletions

View File

@ -48,7 +48,7 @@ Polymer({
updateRelative: function () {
var root = Polymer.dom(this);
root.innerHTML = this.parsedDateTime ?
window.hassUtil.relativeTime(this.parsedDateTime) : '';
window.hassUtil.relativeTime(this.parsedDateTime) : 'never';
},
});
</script>

View File

@ -0,0 +1,50 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../components/ha-relative-time.html">
<dom-module id="more-info-automation">
<template>
<style>
paper-button {
color: var(--default-primary-color);
font-weight: 500;
top: 3px;
height: 37px;
}
</style>
<p>
Last triggered:
<ha-relative-time datetime="[[stateObj.attributes.last_triggered]]"></ha-relative-time>
</p>
<paper-button on-tap='handleTriggerTapped'>TRIGGER</paper-button>
</template>
</dom-module>
<script>
Polymer({
is: 'more-info-automation',
properties: {
hass: {
type: Object,
},
stateObj: {
type: Object,
},
},
handleTriggerTapped: function () {
this.hass.serviceActions.callService('automation', 'trigger', {
entity_id: this.stateObj.entityId,
});
},
});
</script>

View File

@ -1,5 +1,6 @@
<link rel='import' href='../../bower_components/polymer/polymer.html'>
<link rel='import' href='more-info-automation.html'>
<link rel='import' href='more-info-climate.html'>
<link rel='import' href='more-info-cover.html'>
<link rel='import' href='more-info-default.html'>

View File

@ -28,7 +28,7 @@ window.hassUtil.DOMAINS_WITH_CARD = [
window.hassUtil.DOMAINS_WITH_MORE_INFO = [
'light', 'group', 'sun', 'climate', 'configurator', 'cover', 'thermostat',
'script', 'media_player', 'camera', 'updater', 'alarm_control_panel',
'lock', 'hvac',
'lock', 'hvac', 'automation',
];
window.hassUtil.DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator', 'scene'];