Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
The type of bulb we're communicating with.
Returns a :py:class:`BulbType ` describing the bulb
type.
When trying to access before properties are known, the bulb type is unknown.
:rtype: yeelight.BulbType
:return: The bulb's type.
"""
if not self._last_properties or any(name not in self.last_properties for name in ["ct", "rgb"]):
return BulbType.Unknown
if self.last_properties["rgb"] is None and self.last_properties["ct"]:
if self.last_properties["bg_power"] is not None:
return BulbType.WhiteTempMood
else:
return BulbType.WhiteTemp
if all(
name in self.last_properties and self.last_properties[name] is None for name in ["ct", "rgb", "hue", "sat"]
):
return BulbType.White
else:
return BulbType.Color
"""
The type of bulb we're communicating with.
Returns a :py:class:`BulbType ` describing the bulb
type.
When trying to access before properties are known, the bulb type is unknown.
:rtype: yeelight.BulbType
:return: The bulb's type.
"""
if not self._last_properties or any(name not in self.last_properties for name in ["ct", "rgb"]):
return BulbType.Unknown
if self.last_properties["rgb"] is None and self.last_properties["ct"]:
if self.last_properties["bg_power"] is not None:
return BulbType.WhiteTempMood
else:
return BulbType.WhiteTemp
if all(
name in self.last_properties and self.last_properties[name] is None for name in ["ct", "rgb", "hue", "sat"]
):
return BulbType.White
else:
return BulbType.Color
def bulb_type(self):
"""
The type of bulb we're communicating with.
Returns a :py:class:`BulbType ` describing the bulb
type.
When trying to access before properties are known, the bulb type is unknown.
:rtype: yeelight.BulbType
:return: The bulb's type.
"""
if not self._last_properties or any(name not in self.last_properties for name in ["ct", "rgb"]):
return BulbType.Unknown
if self.last_properties["rgb"] is None and self.last_properties["ct"]:
if self.last_properties["bg_power"] is not None:
return BulbType.WhiteTempMood
else:
return BulbType.WhiteTemp
if all(
name in self.last_properties and self.last_properties[name] is None for name in ["ct", "rgb", "hue", "sat"]
):
return BulbType.White
else:
return BulbType.Color
:rtype: yeelight.BulbType
:return: The bulb's type.
"""
if not self._last_properties or any(name not in self.last_properties for name in ["ct", "rgb"]):
return BulbType.Unknown
if self.last_properties["rgb"] is None and self.last_properties["ct"]:
if self.last_properties["bg_power"] is not None:
return BulbType.WhiteTempMood
else:
return BulbType.WhiteTemp
if all(
name in self.last_properties and self.last_properties[name] is None for name in ["ct", "rgb", "hue", "sat"]
):
return BulbType.White
else:
return BulbType.Color
def bulb_type(self):
"""
The type of bulb we're communicating with.
Returns a :py:class:`BulbType ` describing the bulb
type.
When trying to access before properties are known, the bulb type is unknown.
:rtype: yeelight.BulbType
:return: The bulb's type.
"""
if not self._last_properties or any(name not in self.last_properties for name in ["ct", "rgb"]):
return BulbType.Unknown
if self.last_properties["rgb"] is None and self.last_properties["ct"]:
if self.last_properties["bg_power"] is not None:
return BulbType.WhiteTempMood
else:
return BulbType.WhiteTemp
if all(
name in self.last_properties and self.last_properties[name] is None for name in ["ct", "rgb", "hue", "sat"]
):
return BulbType.White
else:
return BulbType.Color
:rtype: yeelight.BulbType
:return: The bulb's type.
"""
if not self._last_properties or any(name not in self.last_properties for name in ["ct", "rgb"]):
return BulbType.Unknown
if self.last_properties["rgb"] is None and self.last_properties["ct"]:
if self.last_properties["bg_power"] is not None:
return BulbType.WhiteTempMood
else:
return BulbType.WhiteTemp
if all(
name in self.last_properties and self.last_properties[name] is None for name in ["ct", "rgb", "hue", "sat"]
):
return BulbType.White
else:
return BulbType.Color