benknight / hue-alfred-workflow

An Alfred workflow for controlling Philips Hue lights.
367 stars 34 forks source link

Upgrade to python3 version #67

Closed harrtho closed 1 year ago

harrtho commented 1 year ago

Motivation

I had the same problems as anyone after upgrading to Monterey. After a long time of waiting for a solution, unfortunately it seems that the author of the original alfred-workflow library is inactive (his good right to do whatever he wants to do ๐Ÿ™‚).

As I was using his workflows a lot, I decided to fork and port his library to python3: alfred-pyworkflow. I know the name is not quite creative ๐Ÿ˜…. In the end the best solution would be that the original author would continue, but until this day I will move on with "my" solution.

Proposed Solution

I added the alfred-pyworkflow library and refactored the code to use python3 and the library. The library is still work in progress but I'm currently fixing step by step workflows that I'm using and it looks quite good.

The workflow now will use the location of python3 from the system PATH via. /usr/bin/env python3. I made also some structural changes, as it makes it more easy to zip the code and all dependencies to *.alfredworflow file.

I will also update the README and try to remove the php dependency as in #63 requested, but in the mean time maybe somebody additional can test the workflow? I'm working on Intel Mac, maybe a ARM Mac user?

Requirements

Since Monterey no php and no python is pre-installed, I recommend to use Homebrew to install both dependencies. Homebrew seems also to be the solution for the Alfred Author to manage workflow dependencies with the new Alfred 5 Beta Feature Gallery.

I made a test release with the same 'old' version number at my fork. If the pull request is accepted and the version number is increased the workflow should update by it self to the release at this repo.

Resolves #66 Resolves #64

benknight commented 1 year ago

Wow, this is awesome! I was really hoping someone would take charge of this.

Currently I don't own a Philips Hue system so I can't test this, but I think I will buy one again so that I can.

Could you provide a *.alfredworkflow file for testing? Maybe you can also reach out to a few other users who've commented on this repo's issues to see if they would help you test. I have an ARM Mac, so I can help test on my Macbook Air M1.

Also, doesn't macOS come with python3 preinstalled now? Or is that still necessary to install via Homebrew?

harrtho commented 1 year ago

Thank you :)

Is it not a little expensive to buy a Philips Hue to just test a workflow ๐Ÿ˜„ ?

I published a "release" with a *.alfredworkflow on my fork for testing. Is this enough or should I provide it somewhere else?

I will try to get in touch with some other users.

As far as I know no. It is possible to install python3 as part of the command-line tool / developer tools that are also needed for Homebrew or via Homebrew or directly with the *.pkg file etc... But I can also be wrong and this changed with an update of Monterey?

harrtho commented 1 year ago

Additionally, where did you get the colorpick binary? If it's open source I was thinking about to compile the binary on the fly with the first execution of the workflow.

This could be a next step after der migration, if useful

ninpnin commented 1 year ago

@harrtho Running on M1 MBA, I get this Screenshot 2023-01-22 at 19 39 07

This happens after connecting to the bridge.

EDIT: this issue is fixed now.

ninpnin commented 1 year ago

Don't know if it's a change in implicit float-int conversions between Python2 and Python3, but explicitly converting the tuple to integers here seemed to fix the whole extension.

mschel commented 1 year ago

just tested your release https://github.com/harrtho/alfred-hue/releases/tag/v3.0.8 @harrtho on Intel Mac on 13.2.1 and it's all working again. So +1 for merging into this repo :)