Jump to content

carboncopy

Member
  • Posts

    1
  • Joined

  • Last visited

Posts posted by carboncopy

  1. Ben, first and foremost, AMAZING workflow!!!! Thank you!

     

    I have a small suggestion, would it be possible for you allow for the user to set the IP of their HUE bridge via the "-hue set-bridge" command? Something like "-hue set-bridge 192.168.2.20".

     

    The reason why is because for people like me that get an empty response from "http://www.meethue.com/api/nupnp", we are not able to get the bridge to pair. I had to modify the setup.py script so that I could pair my bridge.

     

    You can see in bold the change I made below. I know that it is not a good permanent change, but it was good enough for me to get it to work.

     

    class HueAlfredSetup:

        def setup(self):
            r = requests.get('http://www.meethue.com/api/nupnp')
            bridges = r.json()
           

            # Changed "If not" to an "If" so that it skips to the else.
            if bridges:
                print 'No bridges found on your network.'
            else:
                # Statically assigned the IP address of my bridge.

                bridge_ip = '192.168.2.20'
                settings = alp.Settings()

                # Create API user for the workflow
                r = requests.post(
                    'http://{bridge_ip}/api'.format(bridge_ip=bridge_ip),
                    data=json.dumps({'devicetype': 'Alfred 2'}))

                resp = r.json()[0]

                if resp.get('error'):
                    print 'Setup Error: %s' % resp['error'].get('description')
                else:
                    settings.set(bridge_ip=bridge_ip, group='')
                    settings.set(username=resp['success']['username'])
                    print 'Success! You can now control your lights by using the "hue" keyword.'

            return None

×
×
  • Create New...