2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2020-07-31 13:26:23 -07:00
2021-12-03 00:44:16 -08:00
export const lightOperations : INodeProperties [ ] = [
2020-07-31 13:26:23 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-07-31 13:26:23 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'light' ] ,
2020-07-31 13:26:23 -07:00
} ,
} ,
options : [
{
name : 'Delete' ,
value : 'delete' ,
2020-08-04 02:10:13 -07:00
description : 'Delete a light' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a light' ,
2020-07-31 13:26:23 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
2020-08-04 02:10:13 -07:00
description : 'Retrieve a light' ,
2022-07-10 13:50:51 -07:00
action : 'Get a light' ,
2020-07-31 13:26:23 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-07-31 13:26:23 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Retrieve many lights' ,
2022-09-08 08:10:13 -07:00
action : 'Get many lights' ,
2020-07-31 13:26:23 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
2022-01-12 22:51:58 -08:00
description : 'Update a light' ,
2022-07-10 13:50:51 -07:00
action : 'Update a light' ,
2020-10-22 06:46:03 -07:00
} ,
2020-07-31 13:26:23 -07:00
] ,
default : 'update' ,
2020-10-22 06:46:03 -07:00
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-07-31 13:26:23 -07:00
2021-12-03 00:44:16 -08:00
export const lightFields : INodeProperties [ ] = [
2020-07-31 13:26:23 -07:00
/* -------------------------------------------------------------------------- */
/* light:delete */
/* -------------------------------------------------------------------------- */
{
displayName : 'Light ID' ,
name : 'lightId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'delete' ] ,
resource : [ 'light' ] ,
2020-07-31 13:26:23 -07:00
} ,
} ,
default : '' ,
} ,
2020-08-03 01:06:46 -07:00
2020-07-31 13:26:23 -07:00
/* -------------------------------------------------------------------------- */
/* light:getAll */
/* -------------------------------------------------------------------------- */
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'light' ] ,
2020-07-31 13:26:23 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'light' ] ,
returnAll : [ false ] ,
2020-07-31 13:26:23 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-07-31 13:26:23 -07:00
} ,
2020-08-03 01:06:46 -07:00
2020-07-31 13:26:23 -07:00
/* -------------------------------------------------------------------------- */
/* light:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'Light ID' ,
name : 'lightId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
resource : [ 'light' ] ,
2020-07-31 13:26:23 -07:00
} ,
} ,
default : '' ,
} ,
2020-08-03 01:06:46 -07:00
2020-07-31 13:26:23 -07:00
/* -------------------------------------------------------------------------- */
/* light:update */
/* -------------------------------------------------------------------------- */
{
2022-06-03 10:23:49 -07:00
displayName : 'Light Name or ID' ,
2020-07-31 13:26:23 -07:00
name : 'lightId' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>' ,
2020-07-31 13:26:23 -07:00
typeOptions : {
loadOptionsMethod : 'getLights' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'light' ] ,
2020-07-31 13:26:23 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'On' ,
name : 'on' ,
type : 'boolean' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'light' ] ,
2020-07-31 13:26:23 -07:00
} ,
} ,
2020-08-03 01:06:46 -07:00
default : true ,
2022-06-20 07:54:01 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
2022-05-06 14:01:25 -07:00
description : 'On/Off state of the light' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'light' ] ,
operation : [ 'update' ] ,
2020-07-31 13:26:23 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Alert Effect' ,
name : 'alert' ,
type : 'options' ,
options : [
{
2020-08-04 02:10:13 -07:00
name : 'None' ,
2020-07-31 13:26:23 -07:00
value : 'none' ,
2020-08-04 02:10:13 -07:00
description : 'The light is not performing an alert effect' ,
2020-07-31 13:26:23 -07:00
} ,
{
name : 'Select' ,
value : 'select' ,
2022-05-06 14:01:25 -07:00
description : 'The light is performing one breathe cycle' ,
2020-07-31 13:26:23 -07:00
} ,
{
name : 'LSelect' ,
value : 'lselect' ,
2022-08-17 08:50:24 -07:00
description :
'The light is performing breathe cycles for 15 seconds or until an "alert": "none" command is received' ,
2020-07-31 13:26:23 -07:00
} ,
] ,
default : '' ,
2020-08-03 01:06:46 -07:00
description : 'The alert effect, is a temporary change to the bulb’ s state' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Brightness' ,
name : 'bri' ,
type : 'number' ,
typeOptions : {
minValue : 1 ,
maxValue : 254 ,
} ,
default : 100 ,
2022-08-17 08:50:24 -07:00
description :
'The brightness value to set the light to. Brightness is a scale from 1 (the minimum the light is capable of) to 254 (the maximum).' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Brightness Increments' ,
name : 'bri_inc' ,
type : 'number' ,
typeOptions : {
minValue : - 254 ,
maxValue : 254 ,
} ,
default : 0 ,
2022-08-17 08:50:24 -07:00
description :
'Increments or decrements the value of the brightness. This value is ignored if the Brightness attribute is provided.' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Color Temperature' ,
name : 'ct' ,
type : 'number' ,
default : 0 ,
2022-08-17 08:50:24 -07:00
description :
'The Mired color temperature of the light. 2012 connected lights are capable of 153 (6500K) to 500 (2000K).' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Color Temperature Increments' ,
name : 'ct_inc' ,
type : 'number' ,
typeOptions : {
minValue : - 65534 ,
maxValue : 65534 ,
} ,
default : 0 ,
2022-08-17 08:50:24 -07:00
description :
'Increments or decrements the value of the ct. ct_inc is ignored if the ct attribute is provided.' ,
2020-07-31 13:26:23 -07:00
} ,
2020-08-03 01:06:46 -07:00
{
displayName : 'Coordinates' ,
name : 'xy' ,
type : 'string' ,
default : '' ,
placeholder : '0.64394,0.33069' ,
2022-08-17 08:50:24 -07:00
description :
'The x and y coordinates of a color in CIE color space. The first entry is the x coordinate and the second entry is the y coordinate. Both x and y are between 0 and 1' ,
2020-08-03 01:06:46 -07:00
} ,
{
displayName : 'Coordinates Increments' ,
name : 'xy_inc' ,
type : 'string' ,
default : '' ,
placeholder : '0.5,0.5' ,
2022-08-17 08:50:24 -07:00
description :
'Increments or decrements the value of the xy. This value is ignored if the Coordinates attribute is provided. Any ongoing color transition is stopped. Max value [0.5, 0.5]' ,
2020-08-03 01:06:46 -07:00
} ,
2020-07-31 13:26:23 -07:00
{
displayName : 'Dynamic Effect' ,
name : 'effect' ,
type : 'options' ,
options : [
{
2020-08-04 02:10:13 -07:00
name : 'None' ,
2020-07-31 13:26:23 -07:00
value : 'none' ,
} ,
{
name : 'Color Loop' ,
value : 'colorloop' ,
} ,
] ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The dynamic effect of the light' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Hue' ,
name : 'hue' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
maxValue : 65535 ,
} ,
default : 0 ,
2022-08-17 08:50:24 -07:00
description :
'The hue value to set light to.The hue value is a wrapping value between 0 and 65535. Both 0 and 65535 are red, 25500 is green and 46920 is blue.' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Hue Increments' ,
name : 'hue_inc' ,
type : 'number' ,
typeOptions : {
minValue : - 65534 ,
maxValue : 65534 ,
} ,
default : 0 ,
2022-08-17 08:50:24 -07:00
description :
'Increments or decrements the value of the hue. Hue Increments is ignored if the Hue attribute is provided.' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Saturation' ,
name : 'sat' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
maxValue : 254 ,
} ,
default : 0 ,
2022-08-17 08:50:24 -07:00
description :
'Saturation of the light. 254 is the most saturated (colored) and 0 is the least saturated (white).' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Saturation Increments' ,
name : 'sat_inc' ,
type : 'number' ,
typeOptions : {
minValue : - 254 ,
maxValue : 254 ,
} ,
default : 0 ,
2022-08-17 08:50:24 -07:00
description :
'Increments or decrements the value of the sat. This value is ignored if the Saturation attribute is provided.' ,
2020-07-31 13:26:23 -07:00
} ,
{
displayName : 'Transition Time' ,
name : 'transitiontime' ,
type : 'number' ,
typeOptions : {
minVale : 1 ,
} ,
default : 4 ,
2022-08-17 08:50:24 -07:00
description :
'The duration in seconds of the transition from the light’ s current state to the new state' ,
2020-07-31 13:26:23 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;