Fix incorrect comparison of speed "off" by identity instead of by value (#37738)

This commit is contained in:
Eugene Prystupa 2020-07-10 20:45:12 -04:00 committed by GitHub
parent 366354c90c
commit 0fbdb47dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,7 +107,7 @@ class FanEntity(ToggleEntity):
async def async_set_speed(self, speed: str): async def async_set_speed(self, speed: str):
"""Set the speed of the fan.""" """Set the speed of the fan."""
if speed is SPEED_OFF: if speed == SPEED_OFF:
await self.async_turn_off() await self.async_turn_off()
else: else:
await self.hass.async_add_job(self.set_speed, speed) await self.hass.async_add_job(self.set_speed, speed)
@ -128,7 +128,7 @@ class FanEntity(ToggleEntity):
# pylint: disable=arguments-differ # pylint: disable=arguments-differ
async def async_turn_on(self, speed: Optional[str] = None, **kwargs): async def async_turn_on(self, speed: Optional[str] = None, **kwargs):
"""Turn on the fan.""" """Turn on the fan."""
if speed is SPEED_OFF: if speed == SPEED_OFF:
await self.async_turn_off() await self.async_turn_off()
else: else:
await self.hass.async_add_job(ft.partial(self.turn_on, speed, **kwargs)) await self.hass.async_add_job(ft.partial(self.turn_on, speed, **kwargs))