Send if motion sensor is detected and alarm is on

Not sure how to do this.
If my sensor (binary_sensor1) is ‘Detected’ and my house Alarm is ‘Armed away’ (alarm_control) I want it to send a Push Bullet to my phone. But only if house alarm is ‘Armed away’ and nothing else.

I know how to use Push bullet, Sensor and Alarm in Node-RED but not sure how to put it together.
Maybe use a javascript funktion or maybe a switch?

Something like this should work… you would of course modify it to use your home assistant instance, the sensor you want to monitor, alarm panel name, and device you want to notify…


Flow:

[{"id":"4d44ae57.0d5bd8","type":"trigger-state","z":"1ce2dbec.424954","name":"BinarySensor","server":"b2dc7545.2e5d78","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bathroom_motion_sensor_occupancy","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"},{"targetType":"entity_id","targetValue":"alarm_control_panel.alarm","propertyType":"current_state","comparatorType":"is_not","comparatorValueDatatype":"str","comparatorValue":"disarmed","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":130,"y":140,"wires":[["1eeb1c2a.0949a4"],[]]},{"id":"1eeb1c2a.0949a4","type":"api-call-service","z":"1ce2dbec.424954","name":"Notify Phone","server":"b2dc7545.2e5d78","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_ifone","entityId":"","data":"{\"title\":\"~~ALERT~~\",\"message\":\"The bathroom has an intruder!!\",\"data\":{\"sound\":\"default\"}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":350,"y":140,"wires":[[]]},{"id":"b2dc7545.2e5d78","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Node w/ Simple Logic: