Fix deconz typing (#68143)

This commit is contained in:
Robert Svensson 2022-03-15 10:51:26 +01:00 committed by GitHub
parent 376ac1bd83
commit 283f4555a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@
from __future__ import annotations
from collections.abc import ValuesView
from typing import Any, cast
from typing import Any
from pydeconz.group import Group
from pydeconz.light import (
@ -220,15 +220,11 @@ class DeconzBaseLight(DeconzDevice, LightEntity):
elif "IKEA" in self._device.manufacturer:
data["transition_time"] = 0
if (
alert := FLASH_TO_DECONZ.get(cast(str, kwargs.get(ATTR_FLASH)))
) is not None:
if (alert := FLASH_TO_DECONZ.get(kwargs.get(ATTR_FLASH, ""))) is not None:
data["alert"] = alert
del data["on"]
if (
effect := EFFECT_TO_DECONZ.get(cast(str, kwargs.get(ATTR_EFFECT)))
) is not None:
if (effect := EFFECT_TO_DECONZ.get(kwargs.get(ATTR_EFFECT, ""))) is not None:
data["effect"] = effect
await self._device.set_state(**data)
@ -244,9 +240,7 @@ class DeconzBaseLight(DeconzDevice, LightEntity):
data["brightness"] = 0
data["transition_time"] = int(attr_transition * 10)
if (
alert := FLASH_TO_DECONZ.get(cast(str, kwargs.get(ATTR_FLASH)))
) is not None:
if (alert := FLASH_TO_DECONZ.get(kwargs.get(ATTR_FLASH, ""))) is not None:
data["alert"] = alert
del data["on"]