Package: Hue Tools

Author: HCA Central
Version: 4
Added to Library: 11-Nov-23
HCAVersion needed: 18
Keywords: Utility

Package Description:
See the program notes for the programs in this package

Program: Color for time of day

Program Description:
Used to determine the name for the color that represents the appropriate color temperature for the current time of day.

Return value: Returns the Hue name for the color

Program: Create Hue Colors

Program Description:
Run once to add new colors to what is selectable as a color name in the HUE programmer element. You need run this only once as the color names are saved in the HCA file.

Program: Hue Auto Color Temperature

Program Description:
This class is used for Phillips Hue devices to set the color temperature appropriate for the time of day when they are controlled ON.

First add any Hue devices as usual. Then create a new device of type "Hue Auto Color Temperature" and set the "User Class Object" in that device's properties to the name of the Hue device in HCA.

For example, suppose you have a Hue device that in HCA is called "Bedroom - Light". Create a new device of type "Hue Auto Color Temperature" with any name you want - for this example let's call it "Bedroom - Light Proxy". Open the properties of that device and on the "User Class Object" tab set yje "Id of this device" to "Bedroom - Light".

Now you can schedule or use this new device "Bedroom - Light Proxy" in programs and schedules. When you control it ON, or set percentage, it automatically also sets the color temperature appropriate to the time of day.

The color temperature is determined by the program "Color for time of day" also in this package. You can modify that program if you have a better method for determining color temperature than simply by time of day.

Example:
The class program isn't invoked directly but is called by HCA itself to handle ON, OFF, Set-Percent, Change-Percent, and Get-Status for devices of this type.

Parameters:

Name Type Description Default
DeviceName Value HCA Device Name  
DeviceId Value Device Id  
code Value Class actione code  
data Value Class action data  

Program: Hue Repower

Program Description:
Phillips Hue bulbs receive commands from WiFi. but to do so they must be powered on. The bulb can appear off but if it is still receiving power then it can process commands.

Most Hue bulbs are installed as replacements for regular lightbulbs that are controlled from a switch and if that switch gets powered off then the Hue bulbs can't receive commands.

This program looks for all Hue lights in the design and when found it tries to get its status. If that status request fails, then the bulb is probably powered down.

In that case it looks for a tag that you add to a Hue bulb device named "ControlledBy". The value of the tag is the name of the device that controls power to the bulb. If such a tag exists, it then powers that device ON, waits a bit for the bulb to get onto the network, and then sends the Hue bulb a command to go off - turn off its illumination but the bulb remains powered on for further commands.

If you have one switch controlling multiple HUE lights, just add the "ControlledBy" tag to one of them as checking the power for one will have the effect, if needed, of re-powering them all.

Program: Set to colors of the day

Program Description:
Depending upon the current date, changes a HUE light to a color given by the date.

Add tags to this program to mark special days and the colors. Each tag name is of the form Colormmdd, where mmdd is the month and day. The tag value is a comma separated list of any number of color names. The colors are given as the names that appear in the Hue programmer element. For example, to create a special day of July 4th the tag would be:

Color0704

And the tag value could be blue,red

The tag ColorDefault is the color to use if the date isn't found in the tags.

Return value: Result is 0 if it isn't a special day (not found in the tags), or 1 if it is.

Parameters:

Name Type Description Default
Device Object Device to change color  
iDevice Value ith device to change color to (call with 1st device as 0, 2nd device as 1,...) Used to select the next color in the color list 0