Skip to content

Commit 7b14e11

Browse files
authored
Update to fix speed/state bug
the ESPHome firmware requires a state command to be sent along with a speed command. However, this breaks the functionality for other fans that can't use that state command. I made the ability to send the state command along with the speed command for those using the ESPHome firmware for their fans. The setting is optional and will default to false if not included in the config.
1 parent b52e4a6 commit 7b14e11

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dist/fan-control-entity-row.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class CustomFanRow extends Polymer.Element {
8080

8181
this._config = {
8282
customTheme: false,
83+
sendStateWithSpeed: false,
8384
customIsOffColor: '#f44c09',
8485
customIsOnLowColor: '#43A047',
8586
customIsOnMedColor: '#43A047',
@@ -94,6 +95,7 @@ class CustomFanRow extends Polymer.Element {
9495
const config = this._config;
9596
const stateObj = hass.states[config.entity];
9697
const custTheme = config.customTheme;
98+
const sendStateWithSpeed = config.sendStateWithSpeed;
9799
const custOnLowClr = config.customIsOnLowColor;
98100
const custOnMedClr = config.customIsOnMedColor;
99101
const custOnHiClr = config.customIsOnHiColor;
@@ -206,7 +208,9 @@ class CustomFanRow extends Polymer.Element {
206208
this.hass.callService('fan', 'turn_off', {entity_id: this._config.entity});
207209
} else {
208210
this.hass.callService('fan', 'set_speed', {entity_id: this._config.entity, speed: speed});
209-
this.hass.callService('fan', 'turn_on', {entity_id: this._config.entity});
211+
if(this._config.sendStateWithSpeed){
212+
this.hass.callService('fan', 'turn_on', {entity_id: this._config.entity});
213+
}
210214
}
211215
}
212216

0 commit comments

Comments
 (0)