Node red and problem

Hi,

I have node red installed and I want to set up like this.

If ac is turned on and My phone is not_home and wife phone is not_home then send notificatio.
I have set this in node red with bolean AND logic. But problem is that it work like OR sentence. So i got notification also if both is home and I just turn on AC.

I don’t use Node Red, but I’m pretty sure the boolean logic nodes only evaluate true/false payloads. strings and numbers are attempted to be converted to a boolean. The string “not_home” would convert to false. But so would “home”. And so would “on”. You’re going to need to convert the payloads to true/false before sending to the BooleanLogic node.

As I know this statues output true and false. Upper is True and down is False.

You should set two flows:
For turning on the ac: The state change node only for the AC, then current status node for the presence. Use switch nodes to check the states.

For the notification, the ac needs to be a current state node, because what triggers the notification is the presence detection.
Try using both presence nodes, then the and, then the ac state.

For turning off automatically:
Sorry, i don’t remember right now, but The Hook Up has a video on node red where he explains it. (with another use case, but the same presence principle)

I think that set up is correct. Please look at more detialed settings.

image
image

image

Attach a “debug” node to any of your trigger-state nodes and look at the payload they send. If the payload is anything other than a boolean “true” or “false” it probably doesn’t do what you want.

Try it with a different AND/OR Gate logic node?

node-red-contrib-bool-gate

I try and now I found problem. I do not get output true or false.
But i got input off or cool.
How can I transform off, fan or cool to true or false?

Try a function node with if statement

So

if (msg.payload == "off") {
  msg.payload = false;
} else {
  msg.payload = true;
}
return msg;

[{"id":"eed459be.2ae1b8","type":"trigger-state","z":"fac037bf.a42d78","name":"","entityid":"climate.ac, person.blaz, person.monika","entityidfiltertype":"substring","debugenabled":false,"constraints":[{"id":"2w45erjnmdy","targetType":"entity_id","targetValue":"climate.ac","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"id":"0s0egrtzz0v","targetType":"entity_id","targetValue":"person.blaz","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"not_home"},{"id":"u080y232hwm","targetType":"entity_id","targetValue":"person.monika","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"not_home"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":306,"y":1216,"wires":[["2b2e44f6.7f2dbc"],[]]},{"id":"2b2e44f6.7f2dbc","type":"api-call-service","z":"fac037bf.a42d78","name":"","version":1,"service_domain":"notify","service":"ios_blazs_iphone","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":664,"y":1216,"wires":[[]]}]
1 Like

Just stumbled across this! Cut my nodes down by about 30!