Day/night function node for sleep switch
This commit is contained in:
15
climate/master-bedroom/day-night.js
Normal file
15
climate/master-bedroom/day-night.js
Normal file
@ -0,0 +1,15 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const earlyNight = states['binary_sensor.early_night_mode'].state
|
||||
const payload = msg.payload
|
||||
|
||||
if (payload === 'off') {
|
||||
if (earlyNight === 'on') {
|
||||
msg.mode = 'Night Mode'
|
||||
} else {
|
||||
msg.mode = 'Day Mode'
|
||||
}
|
||||
} else if (payload === 'on') {
|
||||
msg.mode = 'Bedtime Mode'
|
||||
}
|
||||
|
||||
return msg
|
Reference in New Issue
Block a user