(self)
return result
Return parameters for a devices request.
Return parameters for a devices request.
Return parameters for a devices request .
def parameters(self) -> dict[str, Any]:
        """Return parameters for a devices request."""
        result = {}

        features = self.state.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
        supported_color_modes = self.state.attributes.get(light.ATTR_SUPPORTED_COLOR_MODES, [])

        if self.support_color:
            result['color_model'] = 'rgb'

        if features & light.SUPPORT_COLOR_TEMP or light.color_temp_supported(supported_color_modes):
            min_temp = self.state.attributes.get(light.ATTR_MAX_MIREDS, 153)
            max_temp = self.state.attributes.get(light.ATTR_MIN_MIREDS, 500)
            result['temperature_k'] = {
                'min': color_util.color_temperature_mired_to_kelvin(min_temp),
                'max': color_util.color_temperature_mired_to_kelvin(max_temp)
            }
        elif light.COLOR_MODE_RGBW in supported_color_modes:
            result['temperature_k'] = {
                'min': self.default_white_temperature_k,
                'max': self.cold_white_temperature_k
            }
        elif light.COLOR_MODE_RGB in supported_color_modes or light.COLOR_MODE_HS in supported_color_modes:
            result['temperature_k'] = {
                'min': self.default_white_temperature_k,
                'max': self.default_white_temperature_k
            }

        if features & light.SUPPORT_EFFECT:
            supported_scenes = self.get_supported_scenes(
                self.get_scenes_map_from_config(self.entity_config),
                self.state.attributes.get(light.ATTR_EFFECT_LIST) or []
            )
            if supported_scenes:
                result['color_scene'] = {
                    'scenes': [
                        {'id': s}
                        for s in supported_scenes
                    ]
                }

        return result
def parameters ( self ) -> dict [ str , Any ] : result = { } features = self . state . attributes . get ( ATTR_SUPPORTED_FEATURES , 0 ) supported_color_modes = self . state . attributes . get ( light . ATTR_SUPPORTED_COLOR_MODES , [ ] ) if self . support_color : result [ 'color_model' ] = 'rgb' if features & light . SUPPORT_COLOR_TEMP or light . color_temp_supported ( supported_color_modes ) : min_temp = self . state . attributes . get ( light . ATTR_MAX_MIREDS , 153 ) max_temp = self . state . attributes . get ( light . ATTR_MIN_MIREDS , 500 ) result [ 'temperature_k' ] = { 'min' : color_util . color_temperature_mired_to_kelvin ( min_temp ) , 'max' : color_util . color_temperature_mired_to_kelvin ( max_temp ) } elif light . COLOR_MODE_RGBW in supported_color_modes : result [ 'temperature_k' ] = { 'min' : self . default_white_temperature_k , 'max' : self . cold_white_temperature_k } elif light . COLOR_MODE_RGB in supported_color_modes or light . COLOR_MODE_HS in supported_color_modes : result [ 'temperature_k' ] = { 'min' : self . default_white_temperature_k , 'max' : self . default_white_temperature_k } if features & light . SUPPORT_EFFECT : supported_scenes = self . get_supported_scenes ( self . get_scenes_map_from_config ( self . entity_config ) , self . state . attributes . get ( light . ATTR_EFFECT_LIST ) or [ ] ) if supported_scenes : result [ 'color_scene' ] = { 'scenes' : [ { 'id' : s } for s in supported_scenes ] } return result