A separate common library for this project and rytilahti/python-miio
Create this issue according https://github.com/rytilahti/python-miio/pull/1035#discussion_r628799916/
I totally agree with @rytilahti that it should be a simple library with helper classes and shared data. And in my opinion, having the data in the .yaml file would be great for simplifying future contributors, but it is not necessary.
So maybe something like this?
class ModelInfo: model: str color_temp: Optional[Tuple[int,int]] = None has_night_light: bool = False has_background_light: bool = False supports_color: bool = False # other properties? @property def supports_color_temp(self) -> bool: return self.color_temp is not None # ... and so on for other potential helpers _MODELS = { # or store data in yaml for easier editing, requires an extra dependency though :-( "bslamp1": ModelInfo(model="bslamp2", color_temp=(1700, 6500), supports_color=True, supports_night_light=True), ... } def supported_models(): return _MODELS.keys() def get_model_info(model: str) -> ModelInfo: if model not in _MODELS: _LOGGER.warning("Unknown model %s, please open an issue and supply features for this light. Returning generic information." % model) return ModelInfo(model="generic") return _MODELS.get(model)