DEV Community

Dennis πŸš€
Dennis πŸš€

Posted on • Originally published at Medium on

Control your Philips Hue lights from your Laravel code

Recently I created a package to manage my Philips Hue lights with. I wanted an easy way to signal my lights in my office when something special happens. Things that are special for example could be:

  • New user sign up
  • New paid order
  • New support ticket
  • New newsletter subscription
  • … etc

Here’s a link to the package:

Cannonb4ll/laravel-philips-hue

I’m still doing work on it, but the basics are implemented and fully working.

You can switch lights on and off per ID, but also in a complete group.

Syntax is as easy as this:

(new HueClient)->lights()->on(1)

Some example commands:

$hue = new HueClient();

$hue->groups()->all();
$hue->lights()->all();
$hue->lights()->get(1);
$hue->lights()->on(1);
$hue->lights()->off(1);
$hue->lights()->customState(1, [
 "hue" => 25500,
 "bri" =>200,
 "alert" => 'select'
]);

You can do whatever you want!

Top comments (0)