Successful sending of light effects in basement
This commit is contained in:
@ -18,8 +18,8 @@ const effectType = msg.payload.event.type
|
||||
const effectDivide = msg.payload.event.divide
|
||||
const duration = msg.payload.event.duration
|
||||
const delay = duration * 1000
|
||||
const adaptiveSwitchFirstFloor = flow.get("adaptiveFirstFloor")
|
||||
const adaptiveSwitchBasement = flow.get("adaptiveBasement")
|
||||
const adaptiveSwitchFirstFloor = flow.get("adaptiveFirstFloor", "diskCon")
|
||||
const adaptiveSwitchBasement = flow.get("adaptiveBasement", "diskCon")
|
||||
|
||||
//! Use delay in service calls, not duration
|
||||
|
||||
@ -43,6 +43,8 @@ let basementFull = []
|
||||
let livingRoom1 = []
|
||||
let livingRoom2 = []
|
||||
let livingRoomFull = []
|
||||
let colorName1 = effectType
|
||||
let colorName2 = "white"
|
||||
|
||||
if (stateTinaDesk === 'on') {
|
||||
firstFloorLights.push('light.tina_desk_strip','light.tina_lamp_top','light.tina_lamp_side')
|
||||
@ -61,23 +63,38 @@ if (stateBasement === 'on') {
|
||||
}
|
||||
|
||||
if (effectDivide === 'half') {
|
||||
basement1 = flow.get("halfBasement1")
|
||||
basement2 = flow.get("halfBasement2")
|
||||
livingRoom1 = flow.get("halfLivingRoom1")
|
||||
livingRoom2 = flow.get("halfLivingRoom2")
|
||||
basement1 = flow.get("halfBasement1", "diskCon")
|
||||
basement2 = flow.get("halfBasement2", "diskCon")
|
||||
livingRoom1 = flow.get("halfLivingRoom1", "diskCon")
|
||||
livingRoom2 = flow.get("halfLivingRoom2", "diskCon")
|
||||
} else if (effectDivide === 'quarter') {
|
||||
basement1 = flow.get("effectSegBasement1")
|
||||
basement2 = flow.get("effectSegBasement2")
|
||||
livingRoom1 = flow.get("effectSegLivingRoom1")
|
||||
livingRoom2 = flow.get("effectSegLivingRoom2")
|
||||
basement1 = flow.get("effectSegBasement1", "diskCon")
|
||||
basement2 = flow.get("effectSegBasement2", "diskCon")
|
||||
livingRoom1 = flow.get("effectSegLivingRoom1", "diskCon")
|
||||
livingRoom2 = flow.get("effectSegLivingRoom2", "diskCon")
|
||||
} else if (effectDivide === 'full') {
|
||||
basementFull = flow.get("basementFull")
|
||||
livingRoomFull = flow.get("livingRoomFull")
|
||||
basementFull = flow.get("basementFull", "diskCon")
|
||||
livingRoomFull = flow.get("livingRoomFull", "diskCon")
|
||||
}
|
||||
|
||||
//! Implement setting of colors here
|
||||
|
||||
// Set message payloads
|
||||
let sendBasementStripFX = {
|
||||
"payload": {
|
||||
"domain": "lifx",
|
||||
"service": "effect_move",
|
||||
"target": {
|
||||
"entity_id": ["light.basement_led_strip_1"]
|
||||
},
|
||||
"data": {
|
||||
"speed": 0.5,
|
||||
"direction": "right",
|
||||
"power_on": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let sendBasementStrip1 = {
|
||||
"payload": {
|
||||
"domain": "lifx",
|
||||
@ -86,7 +103,9 @@ let sendBasementStrip1 = {
|
||||
"entity_id": ["light.basement_led_strip_1"]
|
||||
},
|
||||
"data": {
|
||||
"zones": basement1
|
||||
"zones": basement1,
|
||||
"color_name": colorName1,
|
||||
"brightness": 255
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,7 +118,43 @@ let sendBasementStrip2 = {
|
||||
"entity_id": ["light.basement_led_strip_1"]
|
||||
},
|
||||
"data": {
|
||||
"zones": basement2
|
||||
"zones": basement2,
|
||||
"color_name": colorName2,
|
||||
"brightness": 255,
|
||||
"power": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let sendBasementLights = {
|
||||
"payload": {
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"target": {
|
||||
"entity_id": [
|
||||
"light.basement_tall_lamp",
|
||||
"light.basement_short_lamp",
|
||||
"light.basement_stairwell"
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"color_name": colorName1,
|
||||
"brightness": 255
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let sendLivingRoomStripFX = {
|
||||
"payload": {
|
||||
"domain": "lifx",
|
||||
"service": "effect_move",
|
||||
"target": {
|
||||
"entity_id": ["light.living_room_led_strip"]
|
||||
},
|
||||
"data": {
|
||||
"speed": 0.5,
|
||||
"direction": "right",
|
||||
"power_on": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -112,7 +167,9 @@ let sendLivingRoomStrip1 = {
|
||||
"entity_id": ["light.living_room_led_strip"]
|
||||
},
|
||||
"data": {
|
||||
"zones": livingRoom1
|
||||
"zones": livingRoom1,
|
||||
"color_name": colorName1,
|
||||
"brightness": 255
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,7 +182,56 @@ let sendLivingRoomStrip2 = {
|
||||
"entity_id": ["light.living_room_led_strip"]
|
||||
},
|
||||
"data": {
|
||||
"zones": livingRoom2
|
||||
"zones": livingRoom2,
|
||||
"color_name": colorName2,
|
||||
"brightness": 255
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let sendLivingRoomLights = {
|
||||
"payload": {
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"target": {
|
||||
"entity_id": [
|
||||
"light.living_room_color_1",
|
||||
"light.living_room_color_2",
|
||||
"light.living_room_color_3"
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"color_name": colorName1,
|
||||
"brightness": 255
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let sendTinaDeskLights = {
|
||||
"payload": {
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"target": {
|
||||
"entity_id": ["light.tina_desk_lights"]
|
||||
},
|
||||
"data": {
|
||||
"color_name": colorName1,
|
||||
"brightness": 255
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let sendDiningRoomLamp = {
|
||||
"payload": {
|
||||
"domain": "light",
|
||||
"service": "turn_off",
|
||||
"target": {
|
||||
"entity_id": ["light.dining_room_lamp"]
|
||||
},
|
||||
"data": {}
|
||||
}
|
||||
}
|
||||
|
||||
if (effectBasement === true) {
|
||||
node.send([null,null,null,null,[sendBasementStripFX,sendBasementLights,sendBasementStrip1,sendBasementStrip2],null])
|
||||
}
|
Reference in New Issue
Block a user