pacmax beta

Alfred Pac by benknight on GitHub

Hue Alfred Workflow

An Alfred workflow for controlling Philips Hue lights.

From their README

Philips Hue Controller for Alfred

Quickly and easily control Philips Hue lights with Alfred.

Download the latest version on the releases page.

⚠️ Using this workflow macOS 12.3+ ⚠️

Last updated March 15, 2023

This workflow used to have a dependency on Python 2 which was removed in macOS version 12.3. As of version 3.1, Python 3 support has been added. However if you're using an older version of workflow, it will no longer work after macOS upgrade.

Features

Bridge Compatibility

This workflow supports multiple bridge types:

  • Philips Hue Bridge (all generations including Bridge Pro)
  • deCONZ bridge (Raspberry Pi and other platforms)
  • HomeKit-compatible bridges

Control the state of lights and rooms

  • Set brightness for lights or groups
  • Set color for lights or groups (using CSS color names or HEX codes)
  • Set colorloop effect on lights or groups
  • Set reminders
  • Set groups to custom scenes you've configured in the Philips Hue app
  • Rename lights
Light control
Group control

Note: groups:0 as seen above is autocompleted by the workflow after selecting room name, or in this case "All lights". Group '0' always refers to all lights. Each room name is associated with a specific group ID on the bridge. Remember this ID if you wish to create hotkeys for rooms (see below).

Color Harmonies

This workflow has some bonus custom color science logic built in that let's you use color wheel relationships such as analogous, complementary, triad, etc. to set group colors. Give it a try to see how it works:

Set harmony

Hotkeys API

This workflow uses a special action string format that you can use to create a hotkey for any action you could otherwise perform using the hue keyword, which follows the following pattern:

<lights|groups>:<id>:<function>:<value>

Some example valid action strings are:

groups:0:on                    # Turn on all lights (note: Group "0" refers to all lights)
groups:0:off
groups:0:color:random          # Set all lights to a random color
groups:0:color:red
groups:1:set:<scene_name>      # Set a scene on group with ID "1"
lights:1:color:random
lights:1:color:bada55
lights:1:reminder:180          # 180 seconds
lights:1:bri:50                # 50 percent
lights:2:rename:Kitchen
lights:3:effect:colorloop      # Turn on colorloop effect on light with id "3"

Combine multiple commands into one hotkey

You can combine multiple commands into one hotkey by joining action strings with |, for example:

groups:0:on|lights:1:color:random

To create a new hotkey, open Alfred Preferences.app, go to Workflows and select the Philips Hue Controller workflow in the sidebar. In the main panel right click and select Triggers > Hotkey. Set the text argument to the action string, then connect that to the same block as the other preloaded hotkeys.

To make this even easier, open history.txt inside of the Workflow's directory (right click Philips Hue Controller, select "Open in Finder") and there you can see history of all commands. This makes creating a hotkey for setting a scene easier, for example, since scenes have long ID strings e.g. ESyAHbZCG8RJTxi.

Setup & 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:

Setup

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.103:

hue 192.168.1.103

Troubleshooting

If you're having issues connecting to your bridge (especially with newer models like the Hue Bridge Pro), see TROUBLESHOOTING.md for detailed solutions.

Credits

Thanks to iconsphere, To Uyen, Setyo Ari Wibowo, Austin Condiff, H Alberto Gongora, Andreis Kirma, and Ananth from the Noun Project for icons.

Latest release

  • 3.28 months ago, 1.1 MBDownload

    What's Changed

    • Hue Bridge Pro compatibility — Switched to HTTPS for all bridge communication to support Hue Bridge Pro
    • Robust error handling — Improved error messages and fallbacks when connecting to bridges (Bridge Pro, deCONZ, standard)
    • Documentation — Added TROUBLESHOOTING.md guide and a test_bridge_connection.py diagnostic script
13 earlier releases
  • 3.13 years ago, 1.2 MBDownload

    Adds support for Python 3.

  • 3.0.84 years ago, 1.5 MBDownload

    Replaces references to local Python 2.7 with Homebrew-installed Python 2.7 (temporary fix for macOS 12.3+ which removed Python 2 from system).

    IMPORTANT: Using this version requires that you have already installed Python 2 using Homebrew. Instructions here: https://www.alfredapp.com/help/kb/python-2-monterey/

  • 3.0.65 years ago, 1.5 MBDownload

    Fixes logic issue in bridge setup from #57

  • 3.0.55 years ago, 1.5 MBDownload

    #57 Handle multiple queries at once #56 Recalling scenes for deconz bridge

  • 3.0.45 years ago, 1.5 MBDownload
    • Compatibility with deConz bridge #52
  • 3.0.36 years ago, 1.5 MBDownload
    • Support filtering results when setting scenes and effects. Fixes #49
  • 3.0.26 years ago, 1.5 MBDownload
  • 3.0.18 years ago, 1.5 MBDownload
    • Fixes an issue where some users received an error Error: Invalid color. Please use a 6-digit hex color. when attempting to set the light color. Thanks to @brichards for discovering the bug in #44 and submitting a fix.
  • 3.09 years ago, 1.5 MBDownload
    • Groups and presets are gone, replaced by rooms and scenes configured via the Philips Hue app.
    • Simplified configuration, no more "-hue" commands
    • Hold down <kbd>command</kbd> to enter another command. Making multiple commands is now easier, e.g. turn off the bedroom; set the kitchen white; etc.
    • Automatic updates!
    • Shuffle command improved to ensure each light changes to a new color.
    • Migrated to Alfred-Workflow from alp — #32

    Alfred 2 is no longer supported!

    From this version forward, only Alfred 3 is supported. Download an older version to use the workflow with Alfred 2.

  • 2.59 years ago, 1.2 MBDownload
    • Adds color harmony modes to "All lights" #24
    • Adds ability to specify lights order in -hue set-group #31
    • Adds "Shuffle" action to "All Lights"
    • Adds Alfred 3 support #28
    • Fixes invalid color strings in Set color... actions #30
    • Fixes bug where presets wouldn't save state that was set outside the workflow
    • Adds support for gamut A lights (i.e. better color for new hue bulbs, light strips, LivingBloom, etc) #33
  • 2.4.110 years ago, 926 KBDownload
    • Improved setup & reconnection: if bridge IP changes, the workflow will automatically look for it again and update the IP address if found.
  • 2.411 years ago, 926 KBDownload
    • Support for dimmables and on/off lights. Fixes #17
    • "Set color" now has "Random" option
    • Hotkeys for any workflow action e.g. lights:all:color:random
    • Code cleanup & refactors. All workflow logic moved into a logic package.
  • 2.312 years ago, 1.1 MBDownload
    • Bugfix: #17
    • Adds the ability to set Hotkeys for user-created presets.