From 6faf157a1d4f4b9014a3c0b3c1c4c458d0725e7d Mon Sep 17 00:00:00 2001 From: finity69x2 <32221243+finity69x2@users.noreply.github.com> Date: Mon, 17 Feb 2020 16:05:13 -0500 Subject: [PATCH] switch set speed and turn on command --- dist/fan-control-entity-row.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dist/fan-control-entity-row.js b/dist/fan-control-entity-row.js index 714d6b9..14d51ea 100644 --- a/dist/fan-control-entity-row.js +++ b/dist/fan-control-entity-row.js @@ -202,18 +202,20 @@ class CustomFanRow extends Polymer.Element { e.stopPropagation(); } - setSpeed(e) { + setSpeed(e) { const speed = e.currentTarget.getAttribute('name'); if( speed == 'off' ){ - this.hass.callService('fan', 'turn_off', {entity_id: this._config.entity}); - } else { - this.hass.callService('fan', 'set_speed', {entity_id: this._config.entity, speed: speed}); - if(this._config.sendStateWithSpeed){ + this.hass.callService('fan', 'turn_off', {entity_id: this._config.entity}); + } else { + if(this._config.sendStateWithSpeed){ this.hass.callService('fan', 'turn_on', {entity_id: this._config.entity}); - } - } + } + this.hass.callService('fan', 'set_speed', {entity_id: this._config.entity, speed: speed}); + } } } + +} customElements.define('fan-control-entity-row', CustomFanRow);