hue-alfred-workflow
hue-alfred-workflow copied to clipboard
Support for macOS 12.3+
Hello, since Monterey 12.3 it does not work anymore. There is no /usr/bin/python anymore, only /usr/bin/python3.
Please fix Thanks
/usr/bin/php
is also not available anymore
Yes /usr/bin/php and /usr/bin/python and /usr/bin/python2 do not exist anymore. Only /usr/bin/python3
[11:57:53.220] Logging Started... [11:57:58.518] Philips Hue Controller[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.166E76E4-66A5-477E-B97A-23FC8A6938BA%3E024CCF2C-F278-4295-B1AF-CCF8771F79AB)] Queuing argument '' [11:57:58.588] Philips Hue Controller[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.166E76E4-66A5-477E-B97A-23FC8A6938BA%3E024CCF2C-F278-4295-B1AF-CCF8771F79AB)] Script with argv '(null)' finished [11:57:58.590] ERROR: Philips Hue Controller[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.166E76E4-66A5-477E-B97A-23FC8A6938BA%3E024CCF2C-F278-4295-B1AF-CCF8771F79AB)] Code 127: /bin/bash: /usr/bin/python: No such file or directory
There are dependency issues as well. Even if you try to replace /usr/bin/php and /usr/bin/python with a more correct location (php has to be installed manually or via homebrew), there are dependency errors for example:
Traceback (most recent call last): File "/Users/username/Dropbox/Apps/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AC154D62-5687-4CEF-A3EC-A59E2E3FABD3/logic/setup.py", line 8, in <module> from packages.workflow import Workflow3 as Workflow File "/Users/username/Dropbox/Apps/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AC154D62-5687-4CEF-A3EC-A59E2E3FABD3/logic/packages/workflow/__init__.py", line 16, in <module> from .workflow import Workflow, manager File "/Users/username/Dropbox/Apps/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AC154D62-5687-4CEF-A3EC-A59E2E3FABD3/logic/packages/workflow/workflow.py", line 25, in <module> import cPickle ModuleNotFoundError: No module named 'cPickle'
Yes unfortunately it seems both Python 2 and PHP were removed in recent versions of macOS which is a bummer! When I find time I will try to fix this but it's difficult as I no longer own Philips Hue lights (I switched to Lifx). Pull requests are welcome.
In the mean time, if you're technically savvy enough, re-installing Python 2 and PHP on macOS should solve the issues. Not ideal obviously!
@benknight What was the reason to mix python and php in the first place, what was python missing?
There is a PHP script for the color picker only. The rest is Python
In the mean time, if you're technically savvy enough, re-installing Python 2 and PHP on macOS should solve the issues. Not ideal obviously!
Hi, and thanks for your workflow :)
Is there a specific PHP version required?
@benknight can u precise how to install Python2 (using homebrew for example) and which version of PHP is required ? Thanks
Run the following commands, download and import the modified version and you'll be good to go.
brew install pyenv
pyenv install 2.7.18
ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "/usr/local/bin/python"
Download the following and import. If the workflow asks you to update it, DON'T. It's because I've changed the internal files of the workflow.
I just replaced /usr/bin/python
with /usr/local/bin/python
in 2 different files.
I've tried this Sarpdoruk. The first two commands worked but when I tried the 3rd I get a message saying: ln: /usr/local/bin/python: Permission denied
When use Alfred and type "hue" also get the following error:
Code 127: /bin/bash: /usr/local/bin/python: No such file or directory
Any idea what's happening?
I've tried this Sarpdoruk. The first two commands worked but when I tried the 3rd I get a message saying: ln: /usr/local/bin/python: Permission denied
When use Alfred and type "hue" also get the following error:
Code 127: /bin/bash: /usr/local/bin/python: No such file or directory
Any idea what's happening?
Try running this with "sudo" prefix like below. You will need to enter your password when prompted.
sudo ln -s "${HOME}/.pyenv/versions/sudo 2.7.18/bin/python2.7" "/usr/local/bin/python"
Thanks Sarpdoruk, unfortunately I'm still getting the same Code 127 error. No idea what's happening. It worked fine before the Monterey upgrade, but not anymore. Should I install Python 2?
Thanks Sarpdoruk, unfortunately I'm still getting the same Code 127 error. No idea what's happening. It worked fine before the Monterey upgrade, but not anymore. Should I install Python 2?
Yes, you do need Python2. Actually, that's what the first part of the command does. It installs Python2.7 so that the workflow can use it.
Yeah still not working... and followed the three steps precisely:
brew install pyenv gave me this output
pyenv install 2.7.18 just, well, reinstalled what was already there (and I got this response)
ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "/usr/local/bin/python" gave me this output:
And after downloading the attached .zip and installing the workflow, when I tried to run it with Alfred it looks like this:
Any ideas what could be happening?
Hey guys sorry I've been missing from this conversation. I've update the README with steps for getting the workflow to work again. In the mean time I'm waiting for a Python3-compatible version of this workflow's primary dependency to become available. Once that happens I'll publish a new release and close this issue.
Since I no longer have a Philips Hue system in my possession I'm looking for a contributor to do the Python 3 upgrade. Github user xilopaint is working on a hard fork of the Alfred-Workflow library which aims to support all existing features on Python 3. He hasn't published it yet but the latest source can be pulled from one if his workflow projects. See this comment for more details: https://github.com/deanishe/alfred-workflow/issues/97#issuecomment-1120290043
Morning/Evening all... just wanted to give you an update, as I appear to be the only person suffering issues with this. I've installed Python 2 and done everything per the README, but alas it's still not working for me. Also, I checked the scripts to make sure it says /opt/homebrew/bin/python. Now have the following error... is it just me?
[10:37:54.032] Philips Hue Controller[Script Filter] Queuing argument '' [10:37:54.115] Philips Hue Controller[Script Filter] Script with argv '(null)' finished [10:37:54.116] ERROR: Philips Hue Controller[Script Filter] Code 1: . 10:37:54 workflow.py:2061 DEBUG ---------- Philips Hue Controller (3.0.7) ---------- 10:37:54 workflow.py:1468 DEBUG reading settings from /Users/darren/Library/Application Support/Alfred/Workflow Data/hue-alfred-workflow/settings.json 10:37:54 workflow.py:1468 DEBUG reading settings from /Users/darren/Library/Application Support/Alfred/Workflow Data/hue-alfred-workflow/settings.json 10:37:54 workflow.py:2338 INFO checking for update ... 10:37:54 background.py:230 DEBUG [__workflow_update_check] command cached: /Users/darren/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/hue-alfred-workflow/__workflow_update_check.argcache 10:37:54 background.py:234 DEBUG [__workflow_update_check] passing job to background runner: [u'/usr/bin/python', 'logic/packages/workflow/background.pyc', u'__workflow_update_check'] 10:37:54 workflow.py:2080 ERROR [Errno 2] No such file or directory Traceback (most recent call last): File "logic/packages/workflow/workflow.py", line 2070, in run self.check_update() File "logic/packages/workflow/workflow.py", line 2340, in check_update run_in_background('__workflow_update_check', cmd) File "logic/packages/workflow/background.py", line 235, in run_in_background retcode = subprocess.call(cmd) File "/Users/darren/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 172, in call return Popen(*popenargs, **kwargs).wait() File "/Users/darren/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 394, in init errread, errwrite) File "/Users/darren/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 1047, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory 10:37:54 workflow.py:2103 DEBUG ---------- finished in 0.014s ---------- [10:37:54.118] Philips Hue Controller[Script Filter] { "items": [ { "valid": false, "subtitle": "[Errno 2] No such file or directory", "icon": { "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns" }, "title": "Error in workflow 'Philips Hue Controller'" } ] }
Hey @dscox my bad, I forgot to update some references to the system-installed Python 2 that used to exist before macOS 12.3.
Please download and install v3.0.8 from the releases page here: https://github.com/benknight/hue-alfred-workflow/releases/tag/v3.0.8
Of course, make sure you've also already followed the instructions to install Python 2 via Homebrew (which I'm pretty sure you already did).
It's ALLLLLIIIIIIIIVE!!!
I mean... thanks; it works! Great stuff. Thanks again Ben/all.
hi all, for me homebrew installs to /usr/local/bin/
, so after installing Python 2 per the Alfred instructions, I had to modify the Script Filter and the bash Run Script to use /usr/local/bin/python
. Works great.
@benknight this is an awesome workflow! maybe we can all chip in and send you a Hue bridge and light!
@subelsky ha, thanks! That's odd that it installs to a different location even when you're on the most recent version of macOS.
As for sending me a bridge, thanks for the offer! The reason I don't have a Hue system anymore is twofold - first I'm a nomad so I try to avoid carrying too much, and back in 2017 I switched to using LIFX instead because at the time it was a better system (wider color gamut, better app) but I'm not sure if that's still true.
It's really funny you should say that Ben. I actually went out and bought a LIFX light, as the Hue workflow wasn't working. My intention was to use a LIFX workflow instead (with my new fancy COLOURED light!)... but the LIFX workflows I tried didn't work either. :-(
Soooooo.... don't suppose in your technological wisdom you've created something similar for LIFX have you? I can't seem to find an Alfred workflow that works, and the developer I've messaged isn't too concerned about getting it to function.
I know... I'm a cheeky bastard, but hey... what can I say? :-)
Haha it's an idea I've explored many times. I would say at this particular point I'm not really interested in working on it, but who knows, maybe one day.
To me recollection, I believe the last time I looked LIFX had an API that only worked with an active internet connection (rather than directly with the lights via the local network) so it would be hard to reuse this code, but again there's a good chance that has changed since it's been many years since I explored the possibility.