Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_model_specs(self, **kwargs):
"""
Return the specifications (e.g. color temperature min/max) of the bulb.
"""
if self.model is not None and self.model in _MODEL_SPECS:
return _MODEL_SPECS[self.model]
_LOGGER.debug("Model unknown (%s). Providing a fallback", self.model)
if self.bulb_type is BulbType.White:
return _MODEL_SPECS["mono"]
if self.bulb_type is BulbType.WhiteTemp:
return _MODEL_SPECS["ceiling1"]
# BulbType.Color and BulbType.Unknown
return _MODEL_SPECS["color"]
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 get_model_specs(self, **kwargs):
"""
Return the specifications (e.g. color temperature min/max) of the bulb.
"""
if self.model is not None and self.model in _MODEL_SPECS:
return _MODEL_SPECS[self.model]
_LOGGER.debug("Model unknown (%s). Providing a fallback", self.model)
if self.bulb_type is BulbType.White:
return _MODEL_SPECS["mono"]
if self.bulb_type is BulbType.WhiteTemp:
return _MODEL_SPECS["ceiling1"]
# BulbType.Color and BulbType.Unknown
return _MODEL_SPECS["color"]
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