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

pull/46386/head
Shay Levy 2021-02-11 11:40:03 +02:00 committed by GitHub
parent 1f5fb8f28a
commit 6015161dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

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)