(self)
return self._capabilities
Return capabilities for entity.
Return capabilities for entity.
Return capabilities for entity .
def capabilities(self) -> list[AbstractCapability]:
        """Return capabilities for entity."""
        if self._capabilities is not None:
            return self._capabilities

        self._capabilities = []
        state = self.state
        entity_config = self.config.get_entity_config(state.entity_id)

        for capability_class, config_key in (
                (CustomModeCapability, const.CONF_ENTITY_CUSTOM_MODES),
                (CustomToggleCapability, const.CONF_ENTITY_CUSTOM_TOGGLES),
                (CustomRangeCapability, const.CONF_ENTITY_CUSTOM_RANGES)):
            if config_key in entity_config:
                for instance in entity_config[config_key]:
                    capability = capability_class(
                        self.hass, self.config, state, instance, entity_config[config_key][instance]
                    )

                    if capability.supported():
                        self._capabilities.append(capability)

        for Capability in caps.CAPABILITIES:
            capability = Capability(self.hass, self.config, state)
            if capability.supported() and capability.instance not in [c.instance for c in self._capabilities]:
                self._capabilities.append(capability)

        return self._capabilities
def capabilities ( self ) -> list [ AbstractCapability ] : if self . _capabilities is not None : return self . _capabilities self . _capabilities = [ ] state = self . state entity_config = self . config . get_entity_config ( state . entity_id ) for capability_class , config_key in ( ( CustomModeCapability , const . CONF_ENTITY_CUSTOM_MODES ) , ( CustomToggleCapability , const . CONF_ENTITY_CUSTOM_TOGGLES ) , ( CustomRangeCapability , const . CONF_ENTITY_CUSTOM_RANGES ) ) : if config_key in entity_config : for instance in entity_config [ config_key ] : capability = capability_class ( self . hass , self . config , state , instance , entity_config [ config_key ] [ instance ] ) if capability . supported ( ) : self . _capabilities . append ( capability ) for Capability in caps . CAPABILITIES : capability = Capability ( self . hass , self . config , state ) if capability . supported ( ) and capability . instance not in [ c . instance for c in self . _capabilities ] : self . _capabilities . append ( capability ) return self . _capabilities