benknight Posted June 23, 2013 Posted June 23, 2013 (edited) Philips Hue Controller for Alfred Quickly and easily control Philips Hue lights with Alfred. Installation Download the workflow 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. Edited August 22, 2017 by benknight Linking to latest release so I don't have to manually update the download link every gd time DJay and jesused 1 1
dviper48 Posted June 24, 2013 Posted June 24, 2013 F-ing awesome! Looking forward to the updates you have planned. Saving light-states as presets will be a great feature. I'd also like to see an "All" option under "Hue Lights". That way colors/brightnesses/etc. can be applied to all lights at once or individual lights. Keep up the good work!
benknight Posted June 24, 2013 Author Posted June 24, 2013 Good idea! The "all" option in the lights menu is a no brainer. I'll add that soon. I'll also be pushing a fix that makes the filter script run much faster. Please let me know if you run into any issues! Ben
Martin Posted October 19, 2013 Posted October 19, 2013 Thanks for this Any way I can make my own presets (like the Movie and Party presets)?
jamc Posted October 22, 2013 Posted October 22, 2013 Thanks my friend. I have copied your shared Workflow and was very practice facility. Congratulations for your idea.
Cedrick Posted October 29, 2013 Posted October 29, 2013 Workflow looks great and very useful for me. Unfortunately I instantly get "No bridges found on your network" when typing setup-hue in alfred. (Running Mavericks)
info_fiend Posted November 4, 2013 Posted November 4, 2013 Very slick. This is a great help to me. Thanks!!!! Would there be any way to group lights together, so that one might apply a brightness / color to multiple lights at once? DJay 1
DJay Posted November 16, 2013 Posted November 16, 2013 Love this workflow. Thanks for your work an sharing. I'm new the the Philips hue and was hoping to find a gerat workflow here. So I did. Groups would be great in the Workflow. Hope development is going on. Thanks again.
benknight Posted March 18, 2014 Author Posted March 18, 2014 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).
DJay Posted March 18, 2014 Posted March 18, 2014 thanks for your work and the update. unfortunately the workflow didn't work anymore after updating. what I can do is -hue set-bridge and the bridge is connected but after that when I type hue there is nothing to select. I removed the workflow and installed it again but no hue, nowhere. Thanks in advance for your help.
benknight Posted March 21, 2014 Author Posted March 21, 2014 (edited) 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): 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 Edited March 21, 2014 by benknight
DJay Posted March 21, 2014 Posted March 21, 2014 Thanks for your reply Ben. Here's the content from the Debugger console Starting debug for 'Philips Hue Controller' [ERROR: alfred.workflow.input.scriptfilter] Code 1: Traceback (most recent call last): File "hue_filter.py", line 181, in <module> results = hue_filter.get_results(alp.args()) File "hue_filter.py", line 143, in get_results lights = self._get_lights() File "hue_filter.py", line 96, in _get_lights self._load_lights_data_from_api() File "hue_filter.py", line 63, in _load_lights_data_from_api self._create_light_icon(lid, light_data) File "hue_filter.py", line 76, in _create_light_icon light_data['state']['xy'][0], KeyError: 'xy' [ERROR: alfred.workflow.input.scriptfilter] Code 1: Traceback (most recent call last): File "hue_filter.py", line 181, in <module> results = hue_filter.get_results(alp.args()) File "hue_filter.py", line 143, in get_results lights = self._get_lights() File "hue_filter.py", line 96, in _get_lights self._load_lights_data_from_api() File "hue_filter.py", line 63, in _load_lights_data_from_api self._create_light_icon(lid, light_data) File "hue_filter.py", line 76, in _create_light_icon light_data['state']['xy'][0], KeyError: 'xy'
benknight Posted March 21, 2014 Author Posted March 21, 2014 (edited) 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? Edited March 21, 2014 by benknight
DJay Posted March 21, 2014 Posted March 21, 2014 Thanks for your reply Ben. I use the latest hue Bridge Firmware. And with the hup iOS App everything work as expected. There are 12 Lights (5x hue bulbs, 5x LivingWhites Adapter, 1x LivingColors Bloom, 1x LivingColors Iris). Also with third party Apps everything is good. What I noticed is that when I typ the word hue in Alfred starting with the letters hu in the list there is your hue workflow alongside withe other OS X App with the name hue. When the word hue is finished, your workflow is not in the Alfred list. Select your workflow when its up in the list with hu it brings me the default search. (see screenshot) Sorry that there is not more I can say. :/ Thanks again for your Ideas on this.
benknight Posted March 21, 2014 Author Posted March 21, 2014 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.
carboncopy Posted April 23, 2014 Posted April 23, 2014 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
Carlos-Sz Posted April 23, 2014 Posted April 23, 2014 I hope next week I’ll be testing this workflow!
Carlos-Sz Posted April 26, 2014 Posted April 26, 2014 It works! Thank you for sharing it. I’m still testing but so far I’m easily controlling my home office.
benknight Posted May 23, 2014 Author Posted May 23, 2014 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. carboncopy 1
jk12 Posted May 23, 2014 Posted May 23, 2014 Thanks for posting this! I finally got this working after changing as noted. 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
Pennyworth Posted September 25, 2014 Posted September 25, 2014 Does anyone know how I can customize this workflow so that I can quickly access presets with a keyword like "hue p" ?
m021478 Posted September 28, 2014 Posted September 28, 2014 (edited) Does anyone know how I can customize this workflow so that I can quickly access presets with a keyword like "hue p" ? I would also like to know how to quickly access the presets, but I'd like do it by using a hotkey (like using one of the function ('F') keys on my keyboard to go strait to the presets). Any suggestions would be greatly appreciated... Thanks! Edited September 28, 2014 by m021478
ST1 Posted October 1, 2014 Posted October 1, 2014 (edited) Hi, your workflow is really really great!!! But I have one problem: Alfred doesn't sync the hue presets over dropbox sync??? Is it my fault...??? I don't know....can you help me? Thanks a lot... Edited October 2, 2014 by ST1
ST1 Posted October 10, 2014 Posted October 10, 2014 Hi, is it o.k. that the white (only) bulbs are not shown?? I can only see and control the coloured hue bulbs...?????????????????????? Thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now