homeassistant/components/zha/core/gateway.py
async def async_device_initialized(self, device, is_new_join):
        """Handle device joined and basic information discovered (async)."""
        zha_device = self._async_get_or_create_device(device, is_new_join)

        discovery_infos = []
        for endpoint_id, endpoint in device.endpoints.items():
            async_process_endpoint(
                self._hass, self._config, endpoint_id, endpoint,
                discovery_infos, device, zha_device, is_new_join
            )

        if is_new_join:
            # configure the device
            await zha_device.async_configure()
            zha_device.update_available(True)
        elif zha_device.power_source is not None\
                and zha_device.power_source == MAINS_POWERED:
            # the device isn't a battery powered device so we should be able
            # to update it now
            _LOGGER.debug(
                "attempting to request fresh state for %s %s",
                zha_device.name,
                "with power source: {}".format(
                    ZDOChannel.POWER_SOURCES.get(zha_device.power_source)
                )
            )
            await zha_device.async_initialize(from_cache=False)
        else:
            await zha_device.async_initialize(from_cache=True)

        for discovery_info in discovery_infos:
            async_dispatch_discovery_info(
                self._hass,
                is_new_join,
                discovery_info
            )

        device_entity = async_create_device_entity(zha_device)
        await self._component.async_add_entities([device_entity])
Handle device joined and basic information discovered (async).
Handle device joined and basic information discovered (async).
Handle device joined and basic information discovered ( async ) .
async def async_device_initialized(self, device, is_new_join):
        zha_device = self._async_get_or_create_device(device, is_new_join)
        discovery_infos = []
        for endpoint_id, endpoint in device.endpoints.items():
            async_process_endpoint(
                self._hass, self._config, endpoint_id, endpoint,
                discovery_infos, device, zha_device, is_new_join
            )
        if is_new_join:
            await zha_device.async_configure()
            zha_device.update_available(True)
        elif zha_device.power_source is not None\
                and zha_device.power_source == MAINS_POWERED:
            _LOGGER.debug(
                "attempting to request fresh state for %s %s",
                zha_device.name,
                "with power source: {}".format(
                    ZDOChannel.POWER_SOURCES.get(zha_device.power_source)
                )
            )
            await zha_device.async_initialize(from_cache=False)
        else:
            await zha_device.async_initialize(from_cache=True)
        for discovery_info in discovery_infos:
            async_dispatch_discovery_info(
                self._hass,
                is_new_join,
                discovery_info
            )
        device_entity = async_create_device_entity(zha_device)
        await self._component.async_add_entities([device_entity])
async def async_device_initialized ( self , device , is_new_join ) : zha_device = self . _async_get_or_create_device ( device , is_new_join ) discovery_infos = [ ] for endpoint_id , endpoint in device . endpoints . items ( ) : async_process_endpoint ( self . _hass , self . _config , endpoint_id , endpoint , discovery_infos , device , zha_device , is_new_join ) if is_new_join : await zha_device . async_configure ( ) zha_device . update_available ( True ) elif zha_device . power_source is not None and zha_device . power_source == MAINS_POWERED : _LOGGER . debug ( "attempting to request fresh state for %s %s" , zha_device . name , "with power source: {}" . format ( ZDOChannel . POWER_SOURCES . get ( zha_device . power_source ) ) ) await zha_device . async_initialize ( from_cache = False ) else : await zha_device . async_initialize ( from_cache = True ) for discovery_info in discovery_infos : async_dispatch_discovery_info ( self . _hass , is_new_join , discovery_info ) device_entity = async_create_device_entity ( zha_device ) await self . _component . async_add_entities ( [ device_entity ] )
Handle device joined and basic information discovered (async).
Handle device joined and basic information discovered ( async ) .
"""Handle device joined and basic information discovered (async).""" # configure the device # the device isn't a battery powered device so we should be able # to update it now
self
device
is_new_join