What's new

Updated Hue Utility - huetil Control and manage your Hue system from Asuswrt-Merlin or Raspbian

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

JGrana

Very Senior Member
I had once posted a port of a utility that allowed you to manage and control a Hue Lighting system from Asuswrt-merlin - mhue.

I was never really happy with the command syntax and lack of a few features. So, I've spent a few months working on a very different and updated version.

I call it huetil

This utility's command line syntax (IMHO) is easier and more flexible. And there are more features to better manage your lights and groups.

There are 2 major "commands" - set and play.
Set is used to turn a light, a group of lights or a "scene" on/off. For lights/groups, I believe it is also easier to set many of the attributes - color, brightness level, hue, saturation etc. And, these can be set on one command line.
The play command is used to run some of the more dynamic effects the Philips Hue API provides. Things like loop colors, increment or decrement (automatically) light attributes like brightness, hue, saturation, etc.

I also added the ability to refer to a light or group by either it's Hue Bridge ID or by the name you gave it when you set it up.
huetil also has numerous utility commands for you to look at all your lights, groups or scenes and get detailed information about them

I also added a "save/restore" function. You can "save" the attributes for any or all the lights and groups. This is quite handy when trying different color/brightness/hue/saturation etc. settings for lights. A way to get back to a previous saved state (via "restore"). The save command can save the settings in it's "saved" directory or you can specify a filename for trying different looks.

The basic command syntax is:

Code:
huetil set (light or group) (the ID or name) attribute(s)

For example, to turn a light on (lets call it Living_room or ID 18) set it's color to blue and brightness low, say 50:

Code:
huetil set light Living_room on color blue bri 50

And, I am now changing a number of my utilities to support (in one script) either Asuswrt-Merlin routers or Raspbian Raspberry Pi. The install will figure out which it is running on and adjust things appropriate.
I also have supplied (optionally, install will ask if you want to download them), some example shell scripts that use huetil.
Two in particular a more geared to Asuswrt-Merlin routers:

hueshowspeed - If you are running spdMerln, this script will grab the last speedtest run and set the color of a light to either green (speed is good), yellow (speed is dipping but still ok and red (speed is not good). If the speed does drop below your "LOW" setting it also flashes the red light for approx. 20 seconds.

hueshowload - like the showspeed script, this script checks the last 5 minutes load average (using uptime) and will set the color of a light to green (load avg is ok), yellow (getting busy) and red (your router is taxed).

The script is hosted on github:

Code:
https://github.com/JGrana01/huetil

The Readme is pretty extensive and shows all the commands/features in better detail. Much too long for me to include in this post.

Code:
https://github.com/JGrana01/huetil/blob/main/README.md

See the Readme for installation instructions. Pretty much follows the standard Asuswrt-Merlin Addons philosophy. For Linux/Raspbian/Raspberry Pi, it install the script in /use/local/sbin and the confg file and examples/created files in $HOME/.config/huetil

Its a fun script and nice way to create much more dynamic "scenses" than the Hue app provides.
 
Last edited:
There is an update to huetil.

I have added the ability to set the color of a light or group using RGB values. I.e red is 255 0 0, blue 0 0 255 and purple 255 0 255.

The Philips Hue API doesn’t support RGB values so I convert RGB to CIE xy. There will be some loss of accuracy - but with the lights, hardly noticeable ;-)

I have also added additional ouput to both the “info” and “getcolor“ commands to show the calculated RGB and ANSI Hex codes along with the Hue xy values.

The Readme has been updated to better describe these changes


There is also a new example script in the ”examples” folder called cyclrgb. It will go through numerous combinations of R G B (default increments of 25), setting the light to the values and displaying the RGB values.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top