Minor cleanup

This commit is contained in:
Paulus Schoutsen 2014-11-19 23:42:57 -08:00
parent cc4c557e89
commit 66f8daded1
6 changed files with 18 additions and 25 deletions

View file

@ -111,7 +111,9 @@ def setup(hass, config):
# Setup chromecast # Setup chromecast
hass.states.set("chromecast.Living_Rm", "Netflix", hass.states.set("chromecast.Living_Rm", "Netflix",
{'friendly_name': 'Living Room'}) {'friendly_name': 'Living Room',
ATTR_ENTITY_PICTURE:
'http://graph.facebook.com/KillBillMovie/picture'})
# Setup tellstick sensors # Setup tellstick sensors
hass.states.set("tellstick_sensor.Outside_temperature", "15.6", hass.states.set("tellstick_sensor.Outside_temperature", "15.6",

View file

@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """ """ DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "3bb3a304afd8d825c83570bd91b634f0" VERSION = "12ba7bca8ad0c196cb04ada4fe85a76b"

File diff suppressed because one or more lines are too long

View file

@ -43,7 +43,7 @@
} }
paper-menu-button { paper-menu-button {
margin-top: 5px; margin-top: 5px !important;
} }
paper-dropdown { paper-dropdown {

View file

@ -81,7 +81,7 @@
<div class="time-ago"> <div class="time-ago">
<core-tooltip label="{{stateObj.last_changed}}" position="bottom"> <core-tooltip label="{{stateObj.last_changed}}" position="bottom">
{{lastChangedFromNow}} {{lastChangedFromNow(stateObj.last_changed)}}
</core-tooltip> </core-tooltip>
</div> </div>
@ -109,7 +109,6 @@
</template> </template>
<script> <script>
Polymer({ Polymer({
// attributes
stateObj: {}, stateObj: {},
cb_turn_on: null, cb_turn_on: null,
@ -118,16 +117,12 @@
stateUnknown: false, stateUnknown: false,
toggleChecked: -1, toggleChecked: -1,
computed: {
lastChangedFromNow: "stateObj.last_changed | parseLastChangedFromNow",
},
observe: { observe: {
'stateObj.state': 'stateChanged' 'stateObj.state': 'stateChanged'
}, },
parseLastChangedFromNow: function(lastChanged) { lastChangedFromNow: function(lastChanged) {
return moment(lastChanged, "HH:mm:ss DD-MM-YYYY").fromNow() return moment(lastChanged, "HH:mm:ss DD-MM-YYYY").fromNow();
}, },
toggleCheckedChanged: function(oldVal, newVal) { toggleCheckedChanged: function(oldVal, newVal) {
@ -144,8 +139,8 @@
}, },
stateChanged: function(oldVal, newVal) { stateChanged: function(oldVal, newVal) {
this.stateUnknown = newVal == null; this.stateUnknown = newVal === null;
this.toggleChecked = newVal == "on" this.toggleChecked = newVal === "on";
}, },
turn_on: function() { turn_on: function() {
@ -155,7 +150,7 @@
// unset state while we wait for an update // unset state while we wait for an update
var delayUnsetSate = function() { var delayUnsetSate = function() {
this.stateObj.state = null; this.stateObj.state = null;
} };
setTimeout(delayUnsetSate.bind(this), 500); setTimeout(delayUnsetSate.bind(this), 500);
} }
}, },
@ -167,7 +162,7 @@
// unset state while we wait for an update // unset state while we wait for an update
var delayUnsetSate = function() { var delayUnsetSate = function() {
this.stateObj.state = null; this.stateObj.state = null;
} };
setTimeout(delayUnsetSate.bind(this), 500); setTimeout(delayUnsetSate.bind(this), 500);
} }
}, },

View file

@ -41,7 +41,7 @@
</style> </style>
<div horizontal layout wrap> <div horizontal layout wrap>
<template repeat="{{state in states}}"> <template repeat="{{state in getStates(api.states, filter)}}">
<state-card <state-card
stateObj="{{state}}" stateObj="{{state}}"
cb_turn_on="{{api.turn_on}}" cb_turn_on="{{api.turn_on}}"
@ -56,10 +56,6 @@
Polymer({ Polymer({
filter: null, filter: null,
computed: {
states: "getStates(api.states, filter)"
},
getStates: function(states, filter) { getStates: function(states, filter) {
if(!states) { if(!states) {
return []; return [];