コード例 #1
0
    def tellstick_discovered(service, info):
        """Run when a Tellstick is discovered."""
        _LOGGER.info('Discovered tellstick device')

        if DOMAIN in hass.data:
            _LOGGER.debug('Tellstick already configured')
            return

        host, device = info[:2]

        if not supports_local_api(device):
            _LOGGER.debug('Tellstick does not support local API')
            # Configure the cloud service
            hass.async_add_job(request_configuration)
            return

        _LOGGER.debug('Tellstick does support local API')

        # Ignore any known devices
        if conf and host in conf:
            _LOGGER.debug('Discovered already known device: %s', host)
            return

        # Offer configuration of both live and local API
        request_configuration()
        request_configuration(host)
コード例 #2
0
    def tellstick_discovered(service, info):
        """Run when a Tellstick is discovered."""
        _LOGGER.info('Discovered tellstick device')

        if DOMAIN in hass.data:
            _LOGGER.debug('Tellstick already configured')
            return

        host, device = info[:2]

        if not supports_local_api(device):
            _LOGGER.debug('Tellstick does not support local API')
            # Configure the cloud service
            hass.async_add_job(request_configuration)
            return

        _LOGGER.debug('Tellstick does support local API')

        # Ignore any known devices
        if conf and host in conf:
            _LOGGER.debug('Discovered already known device: %s', host)
            return

        # Offer configuration of both live and local API
        request_configuration()
        request_configuration(host)
コード例 #3
0
    async def async_step_discovery(self, user_input):
        """Run when a Tellstick is discovered."""
        from tellduslive import supports_local_api
        _LOGGER.info('Discovered tellstick device: %s', user_input)
        if supports_local_api(user_input[1]):
            _LOGGER.info('%s support local API', user_input[1])
            self._hosts.append(user_input[0])

        return await self.async_step_user()
コード例 #4
0
ファイル: config_flow.py プロジェクト: zt17521/home-assistant
    async def async_step_discovery(self, user_input):
        """Run when a Tellstick is discovered."""

        _LOGGER.info("Discovered tellstick device: %s", user_input)
        if supports_local_api(user_input[1]):
            _LOGGER.info("%s support local API", user_input[1])
            self._hosts.append(user_input[0])

        return await self.async_step_user()
コード例 #5
0
ファイル: config_flow.py プロジェクト: qq840873731/core-1
    async def async_step_discovery(self, discovery_info):
        """Run when a Tellstick is discovered."""
        await self._async_handle_discovery_without_unique_id()

        _LOGGER.info("Discovered tellstick device: %s", discovery_info)
        if supports_local_api(discovery_info[1]):
            _LOGGER.info("%s support local API", discovery_info[1])
            self._hosts.append(discovery_info[0])

        return await self.async_step_user()
コード例 #6
0
ファイル: config_flow.py プロジェクト: vikr01/home-assistant
    async def async_step_discovery(self, user_input):
        """Run when a Tellstick is discovered."""
        from tellduslive import supports_local_api
        _LOGGER.info('Discovered tellstick device: %s', user_input)
        # Ignore any known devices
        for entry in self._async_current_entries():
            if entry.data[KEY_HOST] == user_input[0]:
                return self.async_abort(reason='already_configured')

        if not supports_local_api(user_input[1]):
            _LOGGER.debug('Tellstick does not support local API')
            # Configure the cloud service
            return await self.async_step_auth()

        self._hosts.append(user_input[0])
        return await self.async_step_user()