platypush/plugins/light/hue/__init__.py
def connect(self):
        """
        Connect to the configured Hue bridge. If the device hasn't been paired
        yet, uncomment the ``.connect()`` and ``.get_api()`` lines and retry
        after clicking the pairing button on your bridge.
        """

        # Lazy init
        if not self.bridge:
            from phue import Bridge, PhueRegistrationException
            success = False
            n_tries = 0

            while not success:
                try:
                    n_tries += 1
                    self.bridge = Bridge(self.bridge_address)
                    success = True
                except PhueRegistrationException as e:
                    self.logger.warning('Bridge registration error: {}'.
                                        format(str(e)))

                    if n_tries >= self._MAX_RECONNECT_TRIES:
                        self.logger.error(('Bridge registration failed after ' +
                                           '{} attempts').format(n_tries))
                        break

                    time.sleep(self._BRIDGE_RECONNECT_SECONDS)

            self.logger.info('Bridge connected')
            self.get_scenes()
        else:
            self.logger.info('Bridge already connected')

        Connect to the configured Hue bridge. If the device hasn't been paired
        yet, uncomment the ``.connect()`` and ``.get_api()`` lines and retry
        after clicking the pairing button on your bridge.
        
Connect to the configured Hue bridge.
Connect to the configured Hue bridge .
def connect(self):
        if not self.bridge:
            from phue import Bridge, PhueRegistrationException
            success = False
            n_tries = 0
            while not success:
                try:
                    n_tries += 1
                    self.bridge = Bridge(self.bridge_address)
                    success = True
                except PhueRegistrationException as e:
                    self.logger.warning('Bridge registration error: {}'.
                                        format(str(e)))
                    if n_tries >= self._MAX_RECONNECT_TRIES:
                        self.logger.error(('Bridge registration failed after ' +
                                           '{} attempts').format(n_tries))
                        break
                    time.sleep(self._BRIDGE_RECONNECT_SECONDS)
            self.logger.info('Bridge connected')
            self.get_scenes()
        else:
            self.logger.info('Bridge already connected')
def connect ( self ) : if not self . bridge : from phue import Bridge , PhueRegistrationException success = False n_tries = 0 while not success : try : n_tries += 1 self . bridge = Bridge ( self . bridge_address ) success = True except PhueRegistrationException as e : self . logger . warning ( 'Bridge registration error: {}' . format ( str ( e ) ) ) if n_tries >= self . _MAX_RECONNECT_TRIES : self . logger . error ( ( 'Bridge registration failed after ' + '{} attempts' ) . format ( n_tries ) ) break time . sleep ( self . _BRIDGE_RECONNECT_SECONDS ) self . logger . info ( 'Bridge connected' ) self . get_scenes ( ) else : self . logger . info ( 'Bridge already connected' )
Connect to the configured Hue bridge.
Connect to the configured Hue bridge .
"""
        Connect to the configured Hue bridge. If the device hasn't been paired
        yet, uncomment the ``.connect()`` and ``.get_api()`` lines and retry
        after clicking the pairing button on your bridge.
        """ # Lazy init
self