Files
HA-NerdFlows-Functions/lightfx/processing-start.js

89 lines
3.6 KiB
JavaScript

// Set some constants for all of the lights
// Half and half for living room LED strip
const halfLivingRoom1 = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
const halfLivingRoom2 = [20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39]
// Quarters for living room LED strip
const segLivingRoom1 = [0,1,2,3,4,5,6,7,8,9]
const segLivingRoom2 = [10,11,12,13,14,15,16,17,18,19]
const segLivingRoom3 = [20,21,22,23,24,25,26,27,28,29]
const segLivingRoom4 = [30,31,32,33,34,35,36,37,38,39]
// Preset effect segments for living room LED strip
const effectSegLivingRoom1 = [].concat(segLivingRoom1, segLivingRoom3)
const effectSegLivingRoom2 = [].concat(segLivingRoom2, segLivingRoom4)
// Full strip for living room LED strip
const livingRoomFull = [].concat(halfLivingRoom1, halfLivingRoom2)
// Half and half for basement LED strip
const halfBasement1 = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
const halfBasement2 = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]
// Quarters for basement LED strip
const segBasement1 = [0,1,2,3,4,5,6,7]
const segBasement2 = [8,9,10,11,12,13,14,15]
const segBasement3 = [16,17,18,19,20,21,22,23]
const segBasement4 = [24,25,26,27,28,29,30,31]
// Preset effect segments for basement LED strip
const effectSegBasement1 = [].concat(segBasement1, segBasement3)
const effectSegBasement2 = [].concat(segBasement2, segBasement4)
// Full strip for basement LED strip
const basementFull = [].concat(halfBasement1, halfBasement2)
// Adaptive Lighting switches
const adaptiveFirstFloor = [
"switch.adaptive_lighting_living_room",
"switch.adaptive_lighting_dining_room_lamp",
"switch.adaptive_lighting_tina_lamp"]
const adaptiveBasement = [
"switch.adaptive_lighting_basement_studio"
]
// Define light arrays for backup scenes
const lightsTinaDesk = ['light.tina_desk_strip','light.tina_lamp_top','light.tina_lamp_side']
const lightsBasement = ['light.basement_tall_lamp','light.basement_short_lamp','light.basement_stairwell','light.basement_led_strip_1']
const lightsLivingRoom = ['light.living_room_color_1','light.living_room_color_2','light.living_room_color_3','light.living_room_led_strip']
const lightsDiningRoom = ['light.dining_room_lamp']
const lightsStairwell = ['light.stairwell_led_strip']
// Write flow variables
flow.set("halfLivingRoom1", halfLivingRoom1, "diskCon")
flow.set("halfLivingRoom2", halfLivingRoom2, "diskCon")
flow.set("segLivingRoom1", segLivingRoom1, "diskCon")
flow.set("segLivingRoom2", segLivingRoom2, "diskCon")
flow.set("segLivingRoom3", segLivingRoom3, "diskCon")
flow.set("segLivingRoom4", segLivingRoom4, "diskCon")
flow.set("effectSegLivingRoom1", effectSegLivingRoom1, "diskCon")
flow.set("effectSegLivingRoom2", effectSegLivingRoom2, "diskCon")
flow.set("livingRoomFull", livingRoomFull, "diskCon")
flow.set("halfBasement1", halfBasement1, "diskCon")
flow.set("halfBasement2", halfBasement2, "diskCon")
flow.set("segBasement1", segBasement1, "diskCon")
flow.set("segBasement2", segBasement2, "diskCon")
flow.set("segBasement3", segBasement3, "diskCon")
flow.set("segBasement4", segBasement4, "diskCon")
flow.set("effectSegBasement1", effectSegBasement1, "diskCon")
flow.set("effectSegBasement2", effectSegBasement2, "diskCon")
flow.set("basementFull", basementFull, "diskCon")
flow.set("adaptiveFirstFloor", adaptiveFirstFloor, "diskCon")
flow.set("adaptiveBasement", adaptiveBasement, "diskCon")
flow.set('lightsTinaDesk', lightsTinaDesk, 'diskCon')
flow.set('lightsBasement', lightsBasement, 'diskCon')
flow.set('lightsLivingRoom', lightsLivingRoom, 'diskCon')
flow.set('lightsDiningRoom', lightsDiningRoom, 'diskCon')
flow.set('lightsStairwell', lightsStairwell, 'diskCon')