mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix fibaro light state for rgb lights and HC3 (#69884)
This commit is contained in:
parent
9e5c1e37c0
commit
6b5062eec5
@ -2,6 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from contextlib import suppress
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
@ -198,16 +199,21 @@ class FibaroLight(FibaroDevice, LightEntity):
|
|||||||
|
|
||||||
Dimmable and RGB lights can be on based on different
|
Dimmable and RGB lights can be on based on different
|
||||||
properties, so we need to check here several values.
|
properties, so we need to check here several values.
|
||||||
|
|
||||||
|
JSON for HC2 uses always string, HC3 uses int for integers.
|
||||||
"""
|
"""
|
||||||
props = self.fibaro_device.properties
|
props = self.fibaro_device.properties
|
||||||
if self.current_binary_state:
|
if self.current_binary_state:
|
||||||
return True
|
return True
|
||||||
if "brightness" in props and props.brightness != "0":
|
with suppress(ValueError, TypeError):
|
||||||
return True
|
if "brightness" in props and int(props.brightness) != 0:
|
||||||
if "currentProgram" in props and props.currentProgram != "0":
|
return True
|
||||||
return True
|
with suppress(ValueError, TypeError):
|
||||||
if "currentProgramID" in props and props.currentProgramID != "0":
|
if "currentProgram" in props and int(props.currentProgram) != 0:
|
||||||
return True
|
return True
|
||||||
|
with suppress(ValueError, TypeError):
|
||||||
|
if "currentProgramID" in props and int(props.currentProgramID) != 0:
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user