Trigger Facebox recognition with Node-Red automation

I’m trying to trigger facial detection via Facebox based on a motion sensor trigger. I’m using Node-RED and can’t figure out how to either parse the .msg payload or use the right node to accomplish the following:

  1. Motion is detected
  2. Call image_processing scan service for the appropriate camera entity
  3. Check image_process.detect_face service and evaluate name attribute

If step 3 returns a specific name (already trained with Facebox), then announce via TTS.

I’ve gotten this to work when I use the EVENTS_ALL node, but with it, there’s no way to trigger via an input (e.g., motion).

Any suggestions on how I can check the image_process.detect_face service based on a trigger?

I’m running HA 0.99.3 in Docker on an Intel NUC.

I’ve made some progress on this and am not giving up. By using the current state node, I can check the msg properties for matched faces. The issue I’m running into now is parsing that message payload and using a switch node to evaluate what face was matched.

I think this is one way of going about this, but there may be other methods to check what matched face attributes are present and then route for actioning (e.g., TTS announcmeent, camera cast, etc.).

The Node-RED flow is viewable on Pastebin here.

Finally got this working without fail now. This was a fun project that helped push me out of my comfort zone with Node-RED.

What’s happening is:

  1. A trigger event occurs; in this case, when the door to the garage is opened.
  2. This kicks off an image processing scan using the Facebox camera near the garage entrance door
  3. a Get Status node checks the status of the image_processing.facebox_camera entity that scanned in the prior step
  4. This message payload is passed through a Change node that sets the payload from msg.payload (which would normally be 0/1 depending on if face match occurred) to the matched_faces object. This object includes any matches based on your trained Facebox model. If no matches are detected, the object will be empty.
  5. The transformed msg.payload is passed through a Switch node, which then routes the TTS announcement based on whose face was detected

Pastebin dump of flow

The pastebin of the flow returns a 404 error, any chance you can re-post the code?