Show scripts as a button if cannot cancel
This commit is contained in:
parent
78c036f443
commit
6615f2366c
|
@ -6,6 +6,7 @@
|
|||
<link rel="import" href="state-card-media_player.html">
|
||||
<link rel="import" href="state-card-rollershutter.html">
|
||||
<link rel="import" href="state-card-scene.html">
|
||||
<link rel="import" href="state-card-script.html">
|
||||
<link rel="import" href="state-card-thermostat.html">
|
||||
<link rel="import" href="state-card-toggle.html">
|
||||
<link rel="import" href="state-card-weblink.html">
|
||||
|
|
|
@ -8,6 +8,7 @@ require('./state-card-display');
|
|||
require('./state-card-input_select');
|
||||
require('./state-card-media_player');
|
||||
require('./state-card-scene');
|
||||
require('./state-card-script');
|
||||
require('./state-card-rollershutter');
|
||||
require('./state-card-thermostat');
|
||||
require('./state-card-toggle');
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
|
||||
|
||||
<link rel="import" href="../components/state-info.html">
|
||||
<link rel="import" href="../components/entity/ha-entity-toggle.html">
|
||||
|
||||
<dom-module id="state-card-script">
|
||||
<style>
|
||||
paper-icon-button {
|
||||
border: 1px solid;
|
||||
border-radius: 50%;
|
||||
color: var(--default-primary-color);
|
||||
line-height: 24px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class='horizontal justified layout'>
|
||||
<state-info state-obj="[[stateObj]]"></state-info>
|
||||
<template is='dom-if' if='[[stateObj.attributes.can_cancel]]'>
|
||||
<ha-entity-toggle state-obj='[[stateObj]]'></ha-entity-toggle>
|
||||
</template>
|
||||
<template is='dom-if' if='[[!stateObj.attributes.can_cancel]]'>
|
||||
<paper-icon-button on-tap='fireScript' icon='mdi:play'></paper-icon-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</dom-module>
|
|
@ -0,0 +1,21 @@
|
|||
import Polymer from '../polymer';
|
||||
import hass from '../util/home-assistant-js-instance';
|
||||
|
||||
require('../components/state-info');
|
||||
require('../components/entity/ha-entity-toggle');
|
||||
|
||||
const { serviceActions } = hass;
|
||||
|
||||
export default new Polymer({
|
||||
is: 'state-card-script',
|
||||
|
||||
properties: {
|
||||
stateObj: {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
|
||||
fireScript() {
|
||||
serviceActions.callTurnOn(this.stateObj.entityId);
|
||||
},
|
||||
});
|
|
@ -6,6 +6,7 @@ const DOMAINS_WITH_CARD = [
|
|||
'media_player',
|
||||
'rollershutter',
|
||||
'scene',
|
||||
'script',
|
||||
'thermostat',
|
||||
'weblink',
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue