Files
HA-NerdFlows-Functions/lightfx/reset.js

32 lines
1.5 KiB
JavaScript

// Set constants
const states = global.get('homeassistant.homeAssistant.states')
const currentSceneBasement = flow.get('currentSceneBasement')
const currentSceneLivingRoom = flow.get('currentSceneLivingRoom')
const currentSceneTinaDesk = flow.get('currentSceneTinaDesk')
const adaptLivingRoom = flow.get('adaptLivingRoom')
const adaptBasement = flow.get('adaptBasement')
const nightLivingRoom = flow.get('nightLivingRoom')
const nightBasement = flow.get('nightBasement')
const stateTinaDesk = flow.get('stateTinaDesk')
const stateLivingRoom = flow.get('stateLivingRoom')
const stateDiningRoom = flow.get('stateDiningRoom')
const stateBasement = flow.get('stateBasement')
const scenesLivingRoom = states["input_select.living_room_scenes"].attributes.options
const scenesBasement = states["input_select.basement_studio_scenes"].attributes.options
const scenesTinaDesk = states["input_select.tina_desk_scenes"].attributes.options
const definedLivingRoom = scenesLivingRoom.includes(currentSceneLivingRoom)
const definedBasement = scenesBasement.includes(currentSceneBasement)
const definedTinaDesk = scenesTinaDesk.includes(currentSceneTinaDesk)
let sendDebug = {
"scenesLivingRoom": scenesLivingRoom,
"scenesBasement": scenesBasement,
"scenesTinaDesk": scenesTinaDesk,
"definedLivingRoom": definedLivingRoom,
"definedBasement": definedBasement,
"definedTinaDesk": definedTinaDesk
}
node.send([sendDebug,null,null,null])
node.status({fill:"green",shape:"dot",text:"Success"})