PHP Class Phue\Light

Inheritance: implements phue\LightInterface
Show file Open project: sqmk/phue Class Usage Examples

Protected Properties

Property Type Description
$attributes stdClass Light attributes
$client Client Phue client
$id integer Id

Public Methods

Method Description
__construct ( integer $id, stdClass $attributes, Client $client ) Construct a Phue Light object
__toString ( ) : string __toString
getAlert ( ) : string Get alert
getBrightness ( ) : integer Get brightness
getColorMode ( ) : string Get color mode of light
getColorTemp ( ) : integer Get Color temperature
getEffect ( ) : string Get effect mode
getHue ( ) : integer Get hue
getId ( ) : integer Get light Id
getModel ( ) : AbstractLightModel Get model
getModelId ( ) : string Get model Id
getName ( ) : string Get assigned name of light
getRGB ( ) : array Get calculated RGB
getSaturation ( ) : integer Get saturation
getSoftwareVersion ( ) : string Get software version
getType ( ) : string Get type
getUniqueId ( ) : string Get unique id
getXY ( ) : array Get XY
isOn ( ) : boolean Is the light on?
isReachable ( ) : boolean Get whether or not the bulb is reachable.
setAlert ( string $mode = SetLightState::ALERT_LONG_SELECT ) : self Set light alert
setBrightness ( integer $level = SetLightState::BRIGHTNESS_MAX ) : self Set brightness
setColorTemp ( integer $value ) : self Set Color temperature
setEffect ( string $mode = SetLightState::EFFECT_NONE ) : self Set effect
setHue ( integer $value ) : self Set hue
setName ( string $name ) : self Set name of light
setOn ( boolean $flag = true ) : self Set light on/off
setRGB ( integer $red, integer $green, integer $blue ) : self Set XY and brightness calculated from RGB
setSaturation ( integer $value ) : self Set saturation
setXY ( float $x, float $y ) : self Set XY

Method Details

__construct() public method

Construct a Phue Light object
public __construct ( integer $id, stdClass $attributes, Client $client )
$id integer Id
$attributes stdClass Light attributes
$client Client Phue client

__toString() public method

__toString
public __toString ( ) : string
return string Light Id

getAlert() public method

Get alert
public getAlert ( ) : string
return string Alert mode

getBrightness() public method

Get brightness
public getBrightness ( ) : integer
return integer Brightness level

getColorMode() public method

Get color mode of light
public getColorMode ( ) : string
return string Color mode

getColorTemp() public method

Get Color temperature
public getColorTemp ( ) : integer
return integer Color temperature value

getEffect() public method

Get effect mode
public getEffect ( ) : string
return string effect mode

getHue() public method

Get hue
public getHue ( ) : integer
return integer Hue value

getId() public method

Get light Id
public getId ( ) : integer
return integer Light id

getModel() public method

Get model
public getModel ( ) : AbstractLightModel
return Phue\LightModel\AbstractLightModel Light model

getModelId() public method

Get model Id
public getModelId ( ) : string
return string Model Id

getName() public method

Get assigned name of light
public getName ( ) : string
return string Name of light

getRGB() public method

Get calculated RGB
public getRGB ( ) : array
return array red, green, blue key/value

getSaturation() public method

Get saturation
public getSaturation ( ) : integer
return integer Saturation value

getSoftwareVersion() public method

Get software version
public getSoftwareVersion ( ) : string
return string

getType() public method

Get type
public getType ( ) : string
return string Type

getUniqueId() public method

Get unique id
public getUniqueId ( ) : string
return string Unique Id

getXY() public method

Get XY
public getXY ( ) : array
return array X, Y key/value

isOn() public method

Is the light on?
public isOn ( ) : boolean
return boolean True if on, false if not

isReachable() public method

Get whether or not the bulb is reachable.
public isReachable ( ) : boolean
return boolean

setAlert() public method

Set light alert
public setAlert ( string $mode = SetLightState::ALERT_LONG_SELECT ) : self
$mode string Alert mode
return self This object

setBrightness() public method

Set brightness
public setBrightness ( integer $level = SetLightState::BRIGHTNESS_MAX ) : self
$level integer Brightness level
return self This object

setColorTemp() public method

Set Color temperature
public setColorTemp ( integer $value ) : self
$value integer Color temperature value
return self This object

setEffect() public method

Set effect
public setEffect ( string $mode = SetLightState::EFFECT_NONE ) : self
$mode string Effect mode
return self This object

setHue() public method

Set hue
public setHue ( integer $value ) : self
$value integer Hue value
return self This object

setName() public method

Set name of light
public setName ( string $name ) : self
$name string
return self This object

setOn() public method

Set light on/off
public setOn ( boolean $flag = true ) : self
$flag boolean True for on, false for off
return self This object

setRGB() public method

Set XY and brightness calculated from RGB
public setRGB ( integer $red, integer $green, integer $blue ) : self
$red integer Red value
$green integer Green value
$blue integer Blue value
return self This object

setSaturation() public method

Set saturation
public setSaturation ( integer $value ) : self
$value integer Saturation value
return self This object

setXY() public method

Set XY
public setXY ( float $x, float $y ) : self
$x float X value
$y float Y value
return self This object

Property Details

$attributes protected property

Light attributes
protected stdClass $attributes
return stdClass

$client protected property

Phue client
protected Client,phue $client
return Client

$id protected property

Id
protected int $id
return integer