Fix Shelly relay device set to light appliance type (#46181)

This commit is contained in:
Shay Levy
2021-02-11 11:40:03 +02:00
committed by Franck Nijhof
parent 953491d509
commit 4034a274f7

View File

@@ -187,6 +187,11 @@ class ShellyLight(ShellyBlockEntity, LightEntity):
async def async_turn_on(self, **kwargs) -> None:
"""Turn on light."""
if self.block.type == "relay":
self.control_result = await self.block.set_state(turn="on")
self.async_write_ha_state()
return
params = {"turn": "on"}
if ATTR_BRIGHTNESS in kwargs:
tmp_brightness = int(kwargs[ATTR_BRIGHTNESS] / 255 * 100)