Files
HA-NerdFlows-Functions/kallen-timer/start.js

21 lines
686 B
JavaScript

const states = global.get('homeassistant.homeAssistant.states')
const room = states['input_select.kallen_activity_room'].state
const activity = states['input_select.kallen_activities'].state
const controlLights = states['input_boolean.kallen_timer_control_lights'].state
const duration = states['input_number.kallen_activity_duration'].state
const fixDuration = parseFloat(duration)
msg.room = room
msg.activity = activity
msg.lights = controlLights
msg.duration = fixDuration
node.status({fill:"green",shape:"dot",text:room})
if (room === 'Basement') {
return[msg,null,null]
} else if (room === 'Kallen Bedroom') {
return [null,msg,null]
} else {
return[null,null,msg]
}