diff --git a/src/more-infos/more-info-alarm_control_panel.html b/src/more-infos/more-info-alarm_control_panel.html index 8d3add4a81..3af69c9b23 100644 --- a/src/more-infos/more-info-alarm_control_panel.html +++ b/src/more-infos/more-info-alarm_control_panel.html @@ -92,7 +92,7 @@ Polymer({ return re.test(code); }, - stateObjChanged: function (newVal) { + stateObjChanged: function (newVal, oldVal) { if (newVal) { this.codeFormat = newVal.attributes.code_format; this.codeInputVisible = this.codeFormat !== null; @@ -110,9 +110,11 @@ Polymer({ this.armHomeButtonVisible = newVal.state === 'disarmed'; this.armAwayButtonVisible = newVal.state === 'disarmed'; } - this.async(function () { - this.fire('iron-resize'); - }.bind(this), 500); + if (oldval) { + this.async(function () { + this.fire('iron-resize'); + }.bind(this), 500); + } }, handleDisarmTap: function () { diff --git a/src/more-infos/more-info-climate.html b/src/more-infos/more-info-climate.html index 426bd74481..6c7f45b24e 100644 --- a/src/more-infos/more-info-climate.html +++ b/src/more-infos/more-info-climate.html @@ -234,7 +234,7 @@ Polymer({ }, }, - stateObjChanged: function (newVal) { + stateObjChanged: function (newVal, oldVal) { this.targetTemperatureSliderValue = newVal.attributes.temperature; this.awayToggleChecked = newVal.attributes.away_mode === 'on'; this.auxheatToggleChecked = newVal.attributes.aux_heat === 'on'; @@ -260,9 +260,11 @@ Polymer({ this.swingIndex = -1; } - this.async(function () { - this.fire('iron-resize'); - }.bind(this), 500); + if (oldVal) { + this.async(function () { + this.fire('iron-resize'); + }.bind(this), 500); + } }, computeTargetTempHidden: function (stateObj) { diff --git a/src/more-infos/more-info-fan.html b/src/more-infos/more-info-fan.html index 8ff952d0e2..47a62745a8 100644 --- a/src/more-infos/more-info-fan.html +++ b/src/more-infos/more-info-fan.html @@ -85,7 +85,7 @@ Polymer({ }, }, - stateObjChanged: function (newVal) { + stateObjChanged: function (newVal, oldVal) { this.oscillationToggleChecked = newVal.attributes.oscillating; if (newVal.attributes.speed_list) { @@ -95,9 +95,11 @@ Polymer({ this.speedIndex = -1; } - this.async(function () { - this.fire('iron-resize'); - }.bind(this), 500); + if (oldVal) { + this.async(function () { + this.fire('iron-resize'); + }.bind(this), 500); + } }, computeClassNames: function (stateObj) { diff --git a/src/more-infos/more-info-light.html b/src/more-infos/more-info-light.html index 051635075d..277ae75860 100644 --- a/src/more-infos/more-info-light.html +++ b/src/more-infos/more-info-light.html @@ -123,7 +123,7 @@ Polymer({ }, }, - stateObjChanged: function (newVal) { + stateObjChanged: function (newVal, oldVal) { if (newVal && newVal.state === 'on') { this.brightnessSliderValue = newVal.attributes.brightness; this.ctSliderValue = newVal.attributes.color_temp; @@ -139,9 +139,11 @@ Polymer({ this.brightnessSliderValue = 0; } - this.async(function () { - this.fire('iron-resize'); - }.bind(this), 500); + if (oldVal) { + this.async(function () { + this.fire('iron-resize'); + }.bind(this), 500); + } }, computeClassNames: function (stateObj) { diff --git a/src/more-infos/more-info-lock.html b/src/more-infos/more-info-lock.html index 240437502b..d2d357fdfc 100644 --- a/src/more-infos/more-info-lock.html +++ b/src/more-infos/more-info-lock.html @@ -47,13 +47,10 @@ Polymer({ this.callService('lock', { code: this.enteredCode }); }, - stateObjChanged: function (newVal) { + stateObjChanged: function (newVal, oldVal) { if (newVal) { this.isLocked = newVal.state === 'locked'; } - this.async(function () { - this.fire('iron-resize'); - }.bind(this), 500); }, callService: function (service, data) { diff --git a/src/more-infos/more-info-media_player.html b/src/more-infos/more-info-media_player.html index f3a9a10fa5..1f14022c46 100644 --- a/src/more-infos/more-info-media_player.html +++ b/src/more-infos/more-info-media_player.html @@ -228,7 +228,7 @@ Polymer({ HAS_MEDIA_STATES: ['playing', 'paused', 'unknown'], - stateObjChanged: function (newVal) { + stateObjChanged: function (newVal, oldVal) { if (newVal) { this.isOff = newVal.state === 'off'; this.isPlaying = newVal.state === 'playing'; @@ -253,9 +253,11 @@ Polymer({ } } - this.async(function () { - this.fire('iron-resize'); - }.bind(this), 500); + if (oldVal) { + this.async(function () { + this.fire('iron-resize'); + }.bind(this), 500); + } }, computeClassNames: function (stateObj) {