Jump to content

benknight

Member
  • Posts

    23
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by benknight

  1. Reasonable suggestion.  However the library my workflow relies heavily on is this one: https://github.com/phyllisstein/alp which references Alfred's storage and cache paths.

     

    For now I think I'll have to see this is as just being a tradeoff.  The best solution for right now is probably setting the environment variables manually if I need to test outside of Alfred.

     

    In the future why not have Alfred expose some sort of developer utility (i.e. a bash script) that bootstraps all the Alfred environment variables.

     

    Thanks.

  2. Is there a way inside a workflow's source code to determine whether the user has Alfred 2 or 3?

     

    My workflow stores information in the OS application cache/storage directories, e.g.

    ~/Library/Application Support/Alfred 2/Workflow Data/
     

    I want to update my workflow to use the correct directory for the version of Alfred that's being used, but I don't currently see any way of doing that.

  3. On 10/9/2016 at 0:02 PM, bongobong said:


    Thanks. I was sort of hoping i could get it to go "hp <preset name> or some such. 

    Thanks! 

     

    @bongobong Actually this is possible with some light editing of the workflow source.  Here's a rough guide:

     

    1. Open Alfred Preference, go to "Workflows" and select this workflow.

    2. Create a new script filter: + > Inputs > Script Filter

    3. Double click the new script filter (it will be at the bottom probably)

    4. Edit the filter accordingly:

    1. Set to "Argument optional"
    2. Set the Keyword to whatever you like, such as "hp" to use your example
    3. Set the Placeholder title to whatever you like, e.g. "Set Philips Hue Controller preset..."
    4. In the "script" box, enter
      python -m logic.filters "presets {query}"

      -

    4. Profit

     

    Let me know if it works out for you!

  4. How do you delete presets?  

     

    I attempted save presets twice and each time only 6-7 of lights included in preset actually turned on.  I would like to delete these save presets but see no instruction for how to do so.  

     

    Can you delete save presets, if so how?

     

    Use the "-hue" keyword to find the "Open Presets Storage – Use this to delete, rename, or backup presets" option.  This opens the a directory in Finder.  To delete the preset, just delete the folder pertaining to that preset.

     

    :)

  5. This is a fantastic workflow! Thank you for the time you've put in.

     

    I don't want to start barking ideas but this is more of a question:

    When I set (with my phone) to a preset (lets say blue rain) and then use alfred to save the preset (hue-preset-save or whatever) can it save that current config? Or is saving presets in alfred only for if you've set the lights up through alfred. I ask because I set to a preset using my phone and then saved the preset with alfred but when i go back to that preset through alfred, it doesnt seem to work

     

    Interesting.  That *should* actually work.  Can you repeat the action maybe a few times and tell me if it's consistently failing?

  6. 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

     

    Hey carbon copy, I'm surprised you're having this issue.  As far as I know all Hue devices would depend on this public endpoint working.  I think what you did (manually editing the script) is probably the best approach here.  I would hesitate to program a feature for this because I can't imagine this is a common problem.

  7. Now I totally see why!  It's because you have lights on the system that aren't hue bulbs (5x LivingWhites Adapter, 1x LivingColors Bloom, 1x LivingColors Iris), which I haven't tested this workflow with.  I will fix this is an update.  Sorry for the inconvenience.  As a temporary fix, you can find out the ID number of each bulb and use the "-hue set-group" command so that you're only controlling the hue bulbs which I'm pretty sure will prevent this error.

  8. That's a pretty strange error and there are a few possible scenarios going on here that I can imagine.

     

    The error is telling me that a certain light attribute isn't present even though it's documented in the Philips Hue Lights API.  I wonder if maybe your bridge's software is out of date.  If you try using the iPhone or Android app does it prompt you to update?

     

    There also might be some edge case here which I haven't accounted for.  Is there anything out of the ordinary going on with your Hue lights?  If you turn all of them on do you still get that error?  How many bulbs are there?  What happens if you type "-hue" and try to set the group or save the current state?

  9. Oh no!  If anyone's having issues can you make sure Alfred 2 is completely up to date and then try this:

     

    1. Open up Alfred Preferences

    2. Go to Workflows

    3. Select the Philips Hue Controller workflow

    4. Click the "Debugger" icon

     

    Looks like this (the first one on the left):

     Screen%20Shot%202014-03-20%20at%209.22.4

     

    5. Type "hue" into Alfred

    6. Copy and paste what was spit out into the Debugger console.

     

    That should tell me what's going wrong.

     

    Thanks!

    Ben

  10. UPDATE — I just edited the original post to release version 2.0 of this workflow to you all!

     

    Features include:

    • 'Lights' is now the index result set.
    • New 'All Lights' option for setting the state for all lights in one command.
    • Lights icons are now the actual current light color!
    • Save presets states for all lights.
    • Set which lights the workflow controls using easy group management via `-hue set-group`
    • Set reminders (blink lights after some time delta).
  11. Philips Hue Controller for Alfred

    Quickly and easily control Philips Hue lights with Alfred.

    index.png

    Installation

    1. Download the workflow

    2. The first time you run the workflow it will ask you to press the button on top of the Hue bridge then action the item to authorize the workflow to control your Hue lights. The workflow automatically attempts to find the bridge on your local network. You can also manually specify the bridge's IP address. For example, if your bridge's IP is 192.168.1.126:

     

    hue 192.168.1.126

     

    Read more about features at the project's Github page.

×
×
  • Create New...