2.2.0
Create a new instance of the YeelightSearch class and start searching for new Yeelights once a Yeelight has been found it will create an Yeelight instance and emits the 'found' event light the Yeelight instance as payload
Extends EventEmitter
adds a new light to the lights array
(any)
refresh lights sending a new m-search
Class Yeelight provides all functionality
Extends EventEmitter
(any)
(object)
{
LOCATION: 'yeelight://10.0.0.33:55443',
ID: '0x0000000000000000',
SUPPORT: 'get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_rgb set_hsv set_adjust set_music set_name',
NAME: 'Living Room',
MODEL: 'color',
}
This method is used to retrieve current property of smart LED.
(array)
The parameter is a list of property names and the response contains
a list of corresponding property values. If the requested property name is not recognized by
smart LED, then a empty string value ("") will be returned.
Promise
:
will be invoked after successfull or failed send
getValues('power', 'bright');
Will change the color temperature of the Yeelight
(string)
is the target color temperature. The type is integer and
range is 1700 ~ 6500 (k).
(string
= 'smooth'
)
support two values: 'sudden' and 'smooth'. If effect is 'sudden',
then the color temperature will be changed directly to target value, under this case, the
third parameter 'duration' is ignored. If effect is 'smooth', then the color temperature will
be changed to target value in a gradual fashion, under this case, the total time of gradual
change is specified in third parameter "duration".
(number
= 1000
)
time specifies the total time of the gradual changing. The unit is
milliseconds. The minimum support duration is 30 milliseconds.
Promise
:
will be invoked after successfull or failed send
setColorTemperature(5000);
setColorTemperature(5000, 'sudden');
setColorTemperature(5000, 'smooth', 1000);
This method is used to change the brightness of a smart LED.
(string)
is the target brightness. The type is integer and ranges
from 1 to 100. The brightness is a percentage instead of a absolute value. 100 means
maximum brightness while 1 means the minimum brightness.
(string
= 'smooth'
)
Refer to 'setColorTemperature' method.
(number
= 1000
)
Refer to 'setColorTemperature' method.
Promise
:
will be invoked after successfull or failed send
setBrightness(25);
setBrightness(25, 'sudden');
setBrightness(25, 'smooth', 1000);
This method is used to switch on the smart LED (software managed on/off).
(string
= 'smooth'
)
Refer to 'setColorTemperature' method.
(number
= 1000
)
Refer to 'setColorTemperature' method.
Promise
:
will be invoked after successfull or failed send
turnOn();
turnOn('sudden');
turnOn('smooth', 1000);
This method is used to switch off the smart LED (software managed on/off).
(string
= 'smooth'
)
Refer to 'setColorTemperature' method.
(number
= 1000
)
Refer to 'setColorTemperature' method.
Promise
:
will be invoked after successfull or failed send
turnOff();
turnOff('sudden');
turnOff('smooth', 1000);
This method is used to set the smart LED directly to specified state. If + the smart LED is off, then it will turn on the smart LED firstly and then apply the specified command.
(array)
can be "color", "hsv", "ct", "cf", "auto_dealy_off".
Promise
:
will be invoked after successfull or failed send
setScene(['color', 65280, 70]);
setScene(['hsv', 300, 70, 100]);
setScene(['ct', 5400, 100]);
setScene(['cf', 0, 0, '500,1,255,100,1000,1,16776960,70']);
This method is used to change the color of a smart LED.
(string)
is the target color, whose type is integer.
It should be expressed in hex 0xFFFFFF.
(string
= 'smooth'
)
Refer to 'setColorTemperature' method.
(number
= 1000
)
Refer to 'setColorTemperature' method.
Promise
:
will be invoked after successfull or failed send
setRGB('#ffffff');
setRGB('#ffffff', 'sudden');
setRGB('#ffffff', 'smooth', 1000);
This method is used to change the color of a smart LED.
(string)
"hue" is the target hue value, whose type is integer.
It should be expressed in decimal integer ranges from 0 to 359.
(string)
is the target saturation value whose type is integer.
It's range is 0 to 100.
(string
= 'smooth'
)
Refer to 'setColorTemperature' method.
(number
= 1000
)
Refer to 'setColorTemperature' method.
Promise
:
will be invoked after successfull or failed send
setHSV(100, 50);
setHSV(100, 50, 'sudden');
setHSV(100, 50, 'smooth', 1000);
This method is used to change brightness, CT or color of a smart LED without knowing the current value, it's main used by controllers.
(string)
the direction of the adjustment. The valid value can be:
(string)
the property to adjust. The valid value can be:
Promise
:
will be invoked after successfull or failed send
setAdjust('increase', 'bright');
This method is used to start or stop music mode on a device. Under music mode, no property will be reported and no message quota is checked.
(number)
the action of set_music command. The valid value can be:
(string)
the IP address of the music server.
(string)
the TCP port music application is listening on
Promise
:
will be invoked after successfull or failed send
setMusicMode(0, '10.0.0.1', 4000);
This method is used to start a color flow. Color flow is a series of smart LED visible state changing. It can be brightness changing, color changing or color temperature changing.
(number)
is the total number of visible state changing
before color flow stopped. 0 means infinite loop on the state changing.
(string)
is the action taken after the flow is stopped.
(string)
is the expression of the state changing series.
Promise
:
will be invoked after successfull or failed send
startColorFlow(4, 2, '1000, 2, 2700, 100, 500, 1, 255, 10, 500, 2, 5000, 1');