Home / News / I Built a CLI Tool for Philips Hue That Every Developer Needs

I Built a CLI Tool for Philips Hue That Every Developer Needs

Tired of switching between your terminal and mobile apps just to control your smart lights? What if you could manage your entire Philips Hue setup with simple commands, integrate it into your scripts, and automate everything from cron jobs?
I spent the last few months building exactly that – a comprehensive PHP library with a powerful CLI tool that puts smart home control where it belongs: in your terminal.

The Problem Every Developer Faces
Picture this: You’re deep in a coding session, multiple terminals open, when you need to adjust your lighting. You have to:

  1. Grab your phone
  2. Find the Hue app
  3. Navigate through the interface
  4. Adjust settings
  5. Get back to coding (and lose your flow)

There had to be a better way.

Meet the Solution: Hue CLI

hue on "Office"
hue brightness 75 "Desk Lamp"
hue color "#FF5733" --all

That’s it. Three commands, and you’re back to coding.

Getting Started in 60 Seconds
Install globally via Composer:

composer global require oguzhantogay/philips-hue-client

Auto-discover your bridge and set up authentication:

hue discover
hue setup

You’re ready to control your lights from any terminal, anywhere.

CLI Commands That Actually Make Sense
Basic Control:

hue on "Living Room"
hue off "Bedroom"
hue brightness 75 "Office"
hue color "#FF5733" "Desk Lamp"
hue color red --all

Scene Management:

hue scenes
hue scene activate "Relax"

Built-in Effects:

hue effect party --duration=60
hue effect sunrise --room="Bedroom" --duration=600
hue effect alert "Front Door" --times=3

Interactive Mode:

hue interactive

Real Developer Workflows
Morning Routine – Add to your shell startup script:

alias morning="hue scene activate 'Energizing' && hue brightness 90 --all"

Focus Mode – Create a focus script:

hue brightness 95 "Office"
hue color "#FFFFFF" "Desk Lamp"
hue brightness 30 "Living Room"
echo "Focus mode activated!"

Pomodoro Timer Integration:

hue color green "Desk Lamp"    # Start focus
hue color yellow "Desk Lamp"   # Break time
hue color blue "Desk Lamp"     # Long break

Automation with Cron
The real power comes with automation:

# Morning energizer (weekdays at 7 AM)
0 7 * * 1-5 hue scene activate "Morning Energy"

# Evening wind-down (every day at 9 PM)
0 21 * * * hue brightness 30 --all && hue color "#FF6600" --all

# Late night auto-off (midnight)
0 0 * * * hue off --all

# Weekend party mode (Fridays at 7 PM)
0 19 * * 5 hue effect party --duration=3600

Beyond the CLI: Complete PHP Library
The CLI is powered by a full-featured PHP library that includes:

  • Auto Bridge Discovery – No more hunting for IP addresses
  • Real-time Events – React to motion sensors and state changes
  • Fluent API – Chain commands naturally
  • Framework Integration – Laravel and Symfony adapters included
  • 100% Tested – Production-ready code

Quick Library Example:

use OguzhanTogay\HueClient\HueClient;

$client = new HueClient($bridgeIp, $username);

$client->lights()
       ->getByName('Living Room')
       ->on()
       ->setBrightness(75)
       ->setColor('#FF5733')
       ->transition(1000);

Why This Matters
As developers, we live in terminals. We script everything, automate workflows, and prefer keyboard shortcuts over GUI navigation. Smart home control should fit seamlessly into this environment.
This CLI tool isn’t just about convenience – it’s about:

  • Workflow Integration: Commands that fit into existing scripts
  • Speed: Milliseconds vs. seconds for mobile apps
  • Automation: Easy integration with cron, CI/CD, and monitoring
  • Consistency: Same interface across all environments
  • Remote Control: SSH into any system and control lights

What Developers Are Building
The community is already creating amazing automations:

  • Build Status Indicators: Lights change color based on CI/CD status
  • Meeting Room Availability: Automatic lighting based on calendar
  • Security Systems: Motion-triggered lighting sequences
  • Productivity Tools: Pomodoro timers with visual feedback
  • Gaming Setups: Dynamic lighting that responds to game events

Installation and Resources
Install the CLI globally:

composer global require oguzhantogay/philips-hue-client

Or add to your project:

composer require oguzhantogay/philips-hue-client

Links:

GitHub Repository

Complete Documentation

Join the Community
Found this useful? Here’s how you can help:

  • Star the repository on GitHub
  • Report bugs or suggest features
  • Contribute code or documentation
  • Share your automation scripts

What smart home automations are you building? Drop a comment with your wildest CLI automation ideas!

Tagged:

Leave a Reply

Your email address will not be published. Required fields are marked *