Move master bedroom last mode context to object
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
const states = global.get('homeassistant.homeAssistant.states')
|
const states = global.get('homeassistant.homeAssistant.states')
|
||||||
const toggle = msg.payload
|
const toggle = msg.payload
|
||||||
const ac = global.get('masterBedroom.aircon.installed', "diskCon")
|
const ac = global.get('masterBedroom.aircon.installed', "diskCon")
|
||||||
const mbrLastMode = flow.get("mbrLastMode", "diskCon")
|
const lastMode = flow.get("masterBedroom.lastMode", "diskCon")
|
||||||
const bedTemp = states['input_number.master_bedroom_bedtime_temp'].state
|
const bedTemp = states['input_number.master_bedroom_bedtime_temp'].state
|
||||||
|
|
||||||
let setTemp = bedTemp
|
let setTemp = bedTemp
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
const mbrLastMode = flow.get('mbrLastMode', "diskCon")
|
const lastMode = flow.get('masterBedroom.lastMode', "diskCon")
|
||||||
const linkSource = msg._linkSource
|
const linkSource = msg._linkSource
|
||||||
|
|
||||||
let setTime = []
|
let setTime = []
|
||||||
let setType = []
|
let setType = []
|
||||||
let setTopic = []
|
let setTopic = []
|
||||||
|
|
||||||
if (mbrLastMode === 'day') {
|
if (lastMode === 'day') {
|
||||||
setTime = 'day'
|
setTime = 'day'
|
||||||
setType = 'manual'
|
setType = 'manual'
|
||||||
setTopic = 'manual-day'
|
setTopic = 'manual-day'
|
||||||
} else if (mbrLastMode === 'night') {
|
} else if (lastMode === 'night') {
|
||||||
setTime = 'night'
|
setTime = 'night'
|
||||||
setType = 'manual'
|
setType = 'manual'
|
||||||
setTopic = 'manual-night'
|
setTopic = 'manual-night'
|
||||||
} else if (mbrLastMode === 'bedtime') {
|
} else if (lastMode === 'bedtime') {
|
||||||
setTime = 'bedtime'
|
setTime = 'bedtime'
|
||||||
setType = 'manual'
|
setType = 'manual'
|
||||||
setTopic = 'manual-bedtime'
|
setTopic = 'manual-bedtime'
|
||||||
|
@ -6,15 +6,15 @@ const nightMode = states["input_boolean.night_mode"].state
|
|||||||
const goodnight = states["input_boolean.goodnight"].state
|
const goodnight = states["input_boolean.goodnight"].state
|
||||||
const coolingActive = states['input_boolean.master_bedroom_cooling_on'].state
|
const coolingActive = states['input_boolean.master_bedroom_cooling_on'].state
|
||||||
|
|
||||||
let mbrLastMode = []
|
let lastMode = []
|
||||||
|
|
||||||
if (sleeping === 'on' || nightMode === 'on' || goodnight === 'on') {
|
if (sleeping === 'on' || nightMode === 'on' || goodnight === 'on') {
|
||||||
mbrLastMode = 'bedtime'
|
lastMode = 'bedtime'
|
||||||
} else if (earlyNight === 'on' || giveMeDarkness === 'on' || coolingActive === 'on') {
|
} else if (earlyNight === 'on' || giveMeDarkness === 'on' || coolingActive === 'on') {
|
||||||
mbrLastMode = 'night'
|
lastMode = 'night'
|
||||||
} else {
|
} else {
|
||||||
mbrLastMode = 'day'
|
lastMode = 'day'
|
||||||
}
|
}
|
||||||
|
|
||||||
flow.set("mbrLastMode", mbrLastMode, "diskCon")
|
flow.set("masterBedroom.lastMode", lastMode, "diskCon")
|
||||||
node.status({ fill: "green", shape: "dot", text: `Last Mode Set: ${mbrLastMode}`})
|
node.status({ fill: "green", shape: "dot", text: `Last Mode Set: ${lastMode}`})
|
Reference in New Issue
Block a user