Improve deCONZ fan platform handling unsupported commands (#41779)

* Improve handling unsupported commands

* Raise valueerror on unsupported speed

* Fix linting
This commit is contained in:
Robert Svensson authored and GitHub committed 2020-10-13 19:34:33 +02:00
1 parent 7f9db59209
commit 267d97e80e
2 files changed
+20 -1

No files matched your search

+4
View File
@@ -105,7 +105,11 @@ class DeconzFan(DeconzDevice, FanEntity):
async def async_set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
if speed not in SPEEDS:
raise ValueError(f"Unsupported speed {speed}")
data = {"speed": SPEEDS[speed]}
await self._device.async_set_state(data)
async def async_turn_on(self, speed: str = None, **kwargs) -> None: