ph_rgb2milight PowerHome formula function
Description
Converts an RGB color value to an appropriate color value suitable for sending to a MiLight controller 
Syntax
ph_rgb2milight ( ai_r, ai_g, ai_b )
Argument Description
ai_r Integer. The Red component. Valid values are 0 to 255
ai_g Integer. The Green component. Valid values are 0 to 255
ai_b Integer. The Blue component. Valid values are 0 to 255
Return value
Integer. Returns a MiLight color value in the range of 0 to 255 
Usage
Unlike Philips Hue bulbs, MiLight bulbs have a rather limited color range supporting a total of only 255 color values (a limited version of Hue and Saturation color values combined). Use this function to convert RGB color values into a value representing the closest MiLight approximation 
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_rgb2milight(255,0,255) - Returns 220 which when sent to a MiLight controller will result in a violet color for the bulb