Initial commit

This commit is contained in:
2023-09-28 12:28:27 -04:00
commit 25780c8c5d
30 changed files with 1777 additions and 0 deletions

View File

@ -0,0 +1,48 @@
const states = global.get('homeassistant.homeAssistant.states')
const vacationMode = states['input_boolean.vacation_mode'].state
const overnight = states['input_boolean.kallen_overnight'].state
const kallenLoc = states['person.kallen_stork'].state
const nightVolume = states['input_number.kallen_bedroom_google_speaker_night_volume'].state
const brightness = states['switch.adaptive_lighting_kallen_bedroom'].attributes.brightness_pct
const fadeDay = states['input_number.wakeup_lights_fade_day'].state
const fadeNight = states['input_number.wakeup_lights_fade_night'].state
const hotDay = states['input_boolean.hot_day'].state
const heatWarning = states['binary_sensor.heat_warning'].state
const fanSeparate = states['binary_sensor.kallen_fan_separate_schedule'].state
const topic = msg.topic
const toggle = msg.toggle
let fan = []
if (hotDay === 'on' || heatWarning === 'on') {
fan = 'on'
} else {
fan = 'off'
}
if (vacationMode === 'off' && overnight === 'off' && kallenLoc === 'home') {
if (topic === 'kallen-fan' && fanSeparate === 'on') {
node.status({fill:"green",shape:"dot",text:"Fan"});
return[null,null,null,msg]
} else if (toggle === 'off') {
msg.brightness = brightness
msg.fade_day = fadeDay * 60
msg.fade_night = fadeNight * 60
msg.fan = fan
node.status({fill:"green",shape:"dot",text:"Wakeup"});
return[null,msg,null,null]
} else if (toggle === 'on') {
msg.volume = nightVolume
node.status({fill:"green",shape:"dot",text:"Sleep"});
return[null,null,msg,null]
}
} else {
if (topic === 'boolean') {
msg.toggle = 'off'
node.status({fill:"red",shape:"ring",text:"Blocked"});
return [msg,null,null,null]
} else {
node.status({fill:"red",shape:"ring",text:"Blocked"});
return null
}
}

View File

@ -0,0 +1,16 @@
var states = global.get('homeassistant.homeAssistant.states')
var schedMode = states['input_select.scheduled_climate_mode_kallen_fan'].state
msg.topic = 'common'
msg.voice = 'Joanna'
if (schedMode === 'White Noise') {
node.status({fill:"green",shape:"dot",text:"White Noise"});
return[msg,null,null]
} else if (schedMode === 'Fan') {
node.status({fill:"green",shape:"dot",text:"Fan"});
return[null,msg,null]
} else {
node.status({fill:"blue",shape:"dot",text:"N/A"});
return[null,null,msg]
}