18 lines
734 B
JavaScript
18 lines
734 B
JavaScript
const states = global.get('homeassistant.homeAssistant.states')
|
|
const workEndZone = states['binary_sensor.tina_work_end_zone'].state
|
|
const tinawork = msg.tinawork
|
|
|
|
if (tinawork === 'on' && workEndZone === 'on') {
|
|
node.status({fill:"green",shape:"dot",text:"Activated"})
|
|
return[msg,null]
|
|
} else if (tinawork === 'on' && workEndZone === 'off') {
|
|
node.status({fill:"yellow",shape:"dot",text:"Not time to leave yet"})
|
|
return null
|
|
} else if (tinawork === 'off') {
|
|
node.status({fill:"yellow",shape:"dot",text:"No Work Today"})
|
|
return null
|
|
} else {
|
|
node.status({fill:"red",shape:"ring",text:"We fucked up"})
|
|
node.warn("Tina presence flow encountered a situation we did not account for")
|
|
return[null,msg]
|
|
} |