Skip to content

Commit

Permalink
Merge pull request #13 from finity69x2/dev
Browse files Browse the repository at this point in the history
switch set speed and turn on command
  • Loading branch information
finity69x2 authored Feb 20, 2020
2 parents 36d2494 + 6faf157 commit 6e24bfc
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions dist/fan-control-entity-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 6e24bfc

Please sign in to comment.