Class: huepi

huepi

new huepi()

huepi Object, Entry point for all interaction with Lights etc via the Bridge.
Source:

Classes

Lightstate

Members

BridgeCache :object

Cache Hashmap of huepi BridgeID and Whitelisted Username
Type:
  • object
Source:

BridgeCacheAutosave :boolean

Autosave Cache Hasmap of huepi BridgeID and Whitelisted Username
Type:
  • boolean
Source:

BridgeConfig :object

Configuration of the Current(active) Bridge
Type:
  • object
Source:

BridgeID :string

ID (Unique, is MAC address) of the Current(active) Bridge
Type:
  • string
Source:

BridgeIP :string

IP address of the Current(active) Bridge
Type:
  • string
Source:

BridgeName :string

Name of the Current(active) Bridge
Type:
  • string
Source:

GroupIds :array

Array of all GroupIds of the Current(active) Bridge
Type:
  • array
Source:

Groups :array

Array of all Groups of the Current(active) Bridge
Type:
  • array
Source:

LightIds :array

Array of all LightIds of the Current(active) Bridge
Type:
  • array
Source:

Lights :array

Array of all Lights of the Current(active) Bridge
Type:
  • array
Source:

LocalBridges :array

Array of all Bridges on the local network
Type:
  • array
Source:

Rules :array

Array of all Rules of the Current(active) Bridge, NOTE: There are no Setter functions yet
Type:
  • array
Source:

ScanningNetwork :bool

get: local network scan in progress / set:proceed with scan
Type:
  • bool
Source:

Scenes :array

Array of all Scenes of the Current(active) Bridge, NOTE: There are no Setter functions yet
Type:
  • array
Source:

Schedules :array

Array of all Schedules of the Current(active) Bridge, NOTE: There are no Setter functions yet
Type:
  • array
Source:

Sensors :array

Array of all Sensors of the Current(active) Bridge, NOTE: There are no Setter functions yet
Type:
  • array
Source:

Username :string

Username for Whitelisting, generated by the Bridge
Type:
  • string
Source:

version :string

version of the huepi interface
Type:
  • string
Source:

Methods

(static) HelperColortemperaturetoCT(ColorTemperature) → {number}

Parameters:
Name Type Description
ColorTemperature number
Source:
Returns:
CT in Mired (micro reciprocal degree)
Type
number

(static) HelperColortemperaturetoHueAngSatBri(Temperature) → {object}

Parameters:
Name Type Description
Temperature number ranges [1000..6600]
Source:
Returns:
[Ang, Sat, Bri] - Ranges [0..360] [0..1] [0..1]
Type
object

(static) HelperColortemperaturetoRGB(Temperature) → {object}

Parameters:
Name Type Description
Temperature number ranges [1000..6600]
Source:
Returns:
[Red, Green, Blue] ranges [0..1] [0..1] [0..1]
Type
object

(static) HelperColortemperaturetoXY(Temperature) → {object}

Parameters:
Name Type Description
Temperature number ranges [1000..6600]
Source:
Returns:
[x, y] - Ranges [0..1] [0..1]
Type
object

(static) HelperCTtoColortemperature(CT) → {number}

Parameters:
Name Type Description
CT number in Mired (micro reciprocal degree)
Source:
Returns:
ColorTemperature
Type
number

(static) HelperGamutXYforModel(Px, Py, Model) → {object}

Tests if the Px,Py resides within the Gamut for the model. Otherwise it will calculated the closesed point on the Gamut.
Parameters:
Name Type Description
Px float Range [0..1]
Py float Range [0..1]
Model string Modelname of the Light to Gamutcorrect Px, Py for
Source:
Returns:
[x, y] - Ranges [0..1] [0..1]
Type
object

(static) HelperHueAngSatBritoColortemperature(Ang, Sat, Bri) → {number}

Parameters:
Name Type Description
Ang float Range [0..360]
Sat float Range [0..1]
Bri float Range [0..1]
Source:
Returns:
Temperature ranges [2200..6500]
Type
number

(static) HelperHueAngSatBritoRGB(Ang, Sat, Bri) → {object}

Parameters:
Name Type Description
Ang float Range [0..360]
Sat float Range [0..1]
Bri float Range [0..1]
Source:
Returns:
[Red, Green, Blue] - Ranges [0..1] [0..1] [0..1]
Type
object

(static) HelperModelCapableCT(Model) → {boolean}

Parameters:
Name Type Description
Model string
Source:
Returns:
Model is capable of CT
Type
boolean

(static) HelperModelCapableXY(Model) → {boolean}

Parameters:
Name Type Description
Model string
Source:
Returns:
Model is capable of XY
Type
boolean

(static) HelperRGBtoColortemperature(Red, Green, Blue) → {number}

Parameters:
Name Type Description
Red float Range [0..1]
Green float Range [0..1]
Blue float Range [0..1]
Source:
Returns:
Temperature ranges [2200..6500]
Type
number

(static) HelperRGBtoHueAngSatBri(Red, Green, Blue) → {object}

Parameters:
Name Type Description
Red float Range [0..1]
Green float Range [0..1]
Blue float Range [0..1]
Source:
Returns:
[Ang, Sat, Bri] - Ranges [0..360] [0..1] [0..1]
Type
object

(static) HelperRGBtoXY(Red, Green, Blue) → {object}

Parameters:
Name Type Description
Red float Range [0..1]
Green float Range [0..1]
Blue float Range [0..1]
Source:
Returns:
[x, y] - Ranges [0..1] [0..1]
Type
object

(static) HelperToStringArray(Items) → {string}

Parameters:
Name Type Description
Items multiple Items to convert to StringArray
Source:
Returns:
String array containing Items
Type
string

(static) HelperXYtoColortemperature(x, y, Brightness) → {number}

Parameters:
Name Type Description
x float
y float
Brightness float Optional
Source:
Returns:
Temperature ranges [1000..6600]
Type
number

(static) HelperXYtoRGB(x, y, Brightness) → {object}

Parameters:
Name Type Description
x float
y float
Brightness float Optional
Source:
Returns:
[Red, Green, Blue] - Ranges [0..1] [0..1] [0..1]
Type
object

(static) HelperXYtoRGBforModel(x, y, Brightness, Model) → {object}

Parameters:
Name Type Description
x float
y float
Brightness float Optional
Model string Modelname of the Light
Source:
Returns:
[Red, Green, Blue] - Ranges [0..1] [0..1] [0..1]
Type
object

_BridgeCacheLoad()

Loads the BridgeCache, typically on startup
Source:

_BridgeCacheSave()

Saves the BridgeCache, typically on Whitelist new Device or Device no longer whitelisted as is the case with with @BridgeCacheAutosave on @_BridgeCacheAddCurrent and @_BridgeCacheRemoveCurrent NOTE: Saving this cache might be considered a security issue To counter this security issue, arrange your own load/save code with proper encryption
Source:

_BridgeCacheSelectFromLocalBridges()

Selects the first Bridge from LocalBridges found in BridgeCache and stores in BridgeIP defaults to 1st Bridge in LocalBridges if no bridge from LocalBridges is found in BridgeCache Internally called in PortalDiscoverLocalBridges and NetworkDiscoverLocalBridges
Source:

BridgeCreateUser(DeviceName)

Whitelists the Username stored in this object. Note: a buttonpress on the bridge is requered max 30 sec before this to succeed. please only use this once per device, Username is stored in cache.
Parameters:
Name Type Description
DeviceName string Optional device name to Whitelist.
Source:

BridgeDeleteUser(UsernameToDelete)

Parameters:
Name Type Description
UsernameToDelete string Username that will be revoked from the Whitelist. Note: Username stored in this object need to be Whitelisted to succeed.
Source:

BridgeGetConfig(ConfigBridgeIP, ConfigTimeOut)

Function to retreive BridgeConfig before Checking Whitelisting. ONCE call BridgeGetConfig Before BridgeGetData to validate we are talking to a hue Bridge available members (as of 'apiversion': '1.11.0'): name, apiversion, swversion, mac, bridgeid, replacesbridgeid, factorynew, modelid
Parameters:
Name Type Description
ConfigBridgeIP string Optional BridgeIP to GetConfig from, otherwise uses huepi.BridgeIP (this/self).
ConfigTimeOut string Optional TimeOut for network request, otherwise uses 60 seconds.
Source:

BridgeGetData()

Update function to retreive Bridge data and store it in this object. Consider this the main 'Get' function. Typically used for Heartbeat or manual updates of local data.
Source:

BridgeGetDescription(ConfigBridgeIP, ConfigTimeOut)

Function to retreive BridgeDescription before Checking Whitelisting. ONCE call BridgeGetDescription Before BridgeGetData to validate we are talking to a hue Bridge REMARK: Needs a fix of the hue bridge to allow CORS on xml endpoint too, just like on json endpoints already is implemented.
Parameters:
Name Type Description
ConfigBridgeIP string Optional BridgeIP to GetConfig from, otherwise uses huepi.BridgeIP (this/self).
ConfigTimeOut string Optional TimeOut for network request, otherwise uses 60 seconds.
Source:

GroupAlertLSelect(GroupNr, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Transitiontime number optional
Source:

GroupAlertNone(GroupNr, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Transitiontime number optional
Source:

GroupAlertSelect(GroupNr, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Transitiontime number optional
Source:

GroupCreate(Name, Lights)

Note: Bridge doesn't accept lights in a Group that are unreachable at moment of creation
Parameters:
Name Type Description
Name string New name of the light Range [1..32]
Lights multiple LightNr or Array of Lights to Group
Source:

GroupDelete(GroupNr)

Parameters:
Name Type Description
GroupNr number
Source:

GroupEffectColorloop(GroupNr, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Transitiontime number optional
Source:

GroupEffectNone(GroupNr, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Transitiontime number optional
Source:

GroupGetId(GroupNr) → {string}

Parameters:
Name Type Description
GroupNr number GroupNr
Source:
Returns:
GroupId
Type
string

GroupGetNr(GroupId) → {number}

Parameters:
Name Type Description
GroupId string GroupId
Source:
Returns:
GroupNr
Type
number

GroupOff(GroupNr, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Transitiontime number optional
Source:

GroupOn(GroupNr, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Transitiontime number optional
Source:

GroupSetAttributes(GroupNr, Name, Lights)

Note: Bridge doesn't accept lights in a Group that are unreachable at moment of creation
Parameters:
Name Type Description
GroupNr number
Name string New name of the light Range [1..32]
Lights multiple LightNr or Array of Lights to Group
Source:

GroupSetBrightness(GroupNr, Brightness, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Brightness Range [0..255]
Transitiontime number optional
Source:

GroupSetColortemperature(GroupNr, Colortemperature, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Colortemperature number Range [2200..6500] for the 2012 model
Transitiontime number optional
Source:

GroupSetCT(GroupNr, CT, Transitiontime)

Parameters:
Name Type Description
GroupNr number
CT number micro reciprocal degree
Transitiontime number optional
Source:

GroupSetHSB(GroupNr, Hue, Saturation, Brightness, Transitiontime)

Sets Gamut Corrected values for HSB
Parameters:
Name Type Description
GroupNr number
Hue number Range [0..65535]
Saturation number Range [0..255]
Brightness number Range [0..255]
Transitiontime number optional
Source:

GroupSetHue(GroupNr, Hue, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Hue number Range [0..65535]
Transitiontime number optional
Source:

GroupSetHueAngSatBri(GroupNr, Ang, Sat, Bri, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Ang Range [0..360]
Sat Range [0..1]
Bri Range [0..1]
Transitiontime number optional
Source:

GroupSetLights(GroupNr, Lights)

Note: Bridge doesn't accept lights in a Group that are unreachable at moment of creation
Parameters:
Name Type Description
GroupNr number
Lights multiple LightNr or Array of Lights to Group
Source:

GroupSetName(GroupNr, Name)

Parameters:
Name Type Description
GroupNr number
Name string New name of the light Range [1..32]
Source:

GroupSetRGB(GroupNr, Red, Green, Blue, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Red Range [0..1]
Green Range [0..1]
Blue Range [0..1]
Transitiontime number optional
Source:

GroupSetSaturation(GroupNr, Saturation, Transitiontime)

Parameters:
Name Type Description
GroupNr number
Saturation Range [0..255]
Transitiontime number optional
Source:

GroupSetState(GroupNr, State)

Parameters:
Name Type Description
GroupNr number
State LightState
Source:

GroupSetXY(GroupNr, X, Y, Transitiontime)

Parameters:
Name Type Description
GroupNr number
X float
Y float
Transitiontime number optional
Source:

GroupsGetData()

Source:

GroupsGetZero()

Source:

LightAlertLSelect(LightNr, Transitiontime)

Parameters:
Name Type Description
LightNr number
Transitiontime number optional
Source:

LightAlertNone(LightNr, Transitiontime)

Parameters:
Name Type Description
LightNr number
Transitiontime number optional
Source:

LightAlertSelect(LightNr, Transitiontime)

Parameters:
Name Type Description
LightNr number
Transitiontime number optional
Source:

LightEffectColorloop(LightNr, Transitiontime)

Parameters:
Name Type Description
LightNr number
Transitiontime number optional
Source:

LightEffectNone(LightNr, Transitiontime)

Parameters:
Name Type Description
LightNr number
Transitiontime number optional
Source:

LightGetId(LightNr) → {string}

Parameters:
Name Type Description
LightNr number LightNr
Source:
Returns:
LightId
Type
string

LightGetNr(LightId) → {number}

Parameters:
Name Type Description
LightId string LightId
Source:
Returns:
LightNr
Type
number

LightOff(LightNr, Transitiontime)

Parameters:
Name Type Description
LightNr number
Transitiontime number optional
Source:

LightOn(LightNr, Transitiontime)

Parameters:
Name Type Description
LightNr number
Transitiontime number optional
Source:

LightSetBrightness(LightNr, Brightness, Transitiontime)

Parameters:
Name Type Description
LightNr number
Brightness Range [0..255]
Transitiontime number optional
Source:

LightSetColortemperature(LightNr, Colortemperature, Transitiontime)

Parameters:
Name Type Description
LightNr number
Colortemperature number Range [2200..6500] for the 2012 model
Transitiontime number optional
Source:

LightSetCT(LightNr, CT, Transitiontime)

Parameters:
Name Type Description
LightNr number
CT number micro reciprocal degree
Transitiontime number optional
Source:

LightSetHSB(LightNr, Hue, Saturation, Brightness, Transitiontime)

Sets Gamut Corrected values for HSB
Parameters:
Name Type Description
LightNr number
Hue number Range [0..65535]
Saturation number Range [0..255]
Brightness number Range [0..255]
Transitiontime number optional
Source:

LightSetHue(LightNr, Hue, Transitiontime)

Parameters:
Name Type Description
LightNr number
Hue number Range [0..65535]
Transitiontime number optional
Source:

LightSetHueAngSatBri(LightNr, Ang, Sat, Bri, Transitiontime)

Parameters:
Name Type Description
LightNr number
Ang Range [0..360]
Sat Range [0..1]
Bri Range [0..1]
Transitiontime number optional
Source:

LightSetName(LightNr, Name)

Parameters:
Name Type Description
LightNr number
Name string New name of the light Range [1..32]
Source:

LightSetRGB(LightNr, Red, Green, Blue, Transitiontime)

Parameters:
Name Type Description
LightNr number
Red Range [0..1]
Green Range [0..1]
Blue Range [0..1]
Transitiontime number optional
Source:

LightSetSaturation(LightNr, Saturation, Transitiontime)

Parameters:
Name Type Description
LightNr number
Saturation Range [0..255]
Transitiontime number optional
Source:

LightSetState(LightNr, State)

Parameters:
Name Type Description
LightNr number
State LightState
Source:

LightSetXY(LightNr, X, Y, Transitiontime)

Parameters:
Name Type Description
LightNr number
X float
Y float
Transitiontime number optional
Source:

LightsGetData()

Source:

LightsGetNew()

Source:

LightsSearchForNew()

Source:

NetworkDiscoverLocalBridges()

Creates the list of hue-Bridges on the local network
Source:

PortalDiscoverLocalBridges()

Retreives the list of hue-Bridges on the local network from the hue Portal
Source:

RulesGetData()

Source:

ScenesGetData()

Source:

SchedulesGetData()

Source:

SensorsGetData()

Source: