How can I avoid getting messages when there are no people in the pictures

Some time ago I set up a "MotionEye" where I run some "Motion Detection" on the video part.

I then run a "Motion Notification" by two scripts.
And then throw this information into my HA, where I have access to "Deepstack" running an "Image processing".

My problem is that when a Motion Detection happens, my e.g. xxxxxx_detection_latest.jpg image updated.

This starts a flow in NodeRed, which then sends a message by Telegram to me about "People in front / garden / etc." ...
But I get a lot of fake messages, as the image is updated based on Motion Detection starting, so during that period I can receive e.g. 10 pictures / messages, where only 2 of them are with people.

Is there any possibility to optimize my flow, so I can test the image for whether there is actually one / more people in the image and if there is, then it sends a message like now?
So I do not get 60-70% error pictures.

My flow is:

Presumably your Deepstack Image Processing returns a status about what was detected in each image processed (I'm not at all familiar with it). Use that in a function node or switch node to either drop the image (forward it to an unconnected output or return null) if the "person detected" status is false, or send it on to telegram if person detected is true for that image.

Since I live on a corner, I need to use an "inside polygon" function to filter out dog walkers in the street or on the sidewalk, based on the location of their "detection box" lower right point being inside my perimeter or not for each person detection image before alerting.

Your pastebin link didn't work for me, it put in extra crap which broke importing your flow.

Paste your flow using the </> Preformatted text feature of this forum.

[{"id":"f32199e2.4d8208","type":"debug","z":"6b79cc41.b09ad4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":360,"wires":[]},{"id":"9a07f5c7.a90968","type":"tail","z":"6b79cc41.b09ad4","name":"","filetype":"text","split":"[\\r]{0,1}\\n","filename":"/config/www/snapshots/foran_detection_latest.jpg","inputs":0,"x":220,"y":360,"wires":[["f32199e2.4d8208","50ba0a87.571214"]]},{"id":"50ba0a87.571214","type":"split","z":"6b79cc41.b09ad4","name":"simulate images/msg","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":560,"y":400,"wires":[["badb8bc2.52b6e8"]]},{"id":"badb8bc2.52b6e8","type":"trigger","z":"6b79cc41.b09ad4","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"250","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":760,"y":400,"wires":[["1cf1bb6f.eebf85","c583f4a0.30e3a8"]]},{"id":"1cf1bb6f.eebf85","type":"function","z":"6b79cc41.b09ad4","name":"Message prep","func":"var today = new Date();\nvar hour = ('0'+today.getHours()).slice(-2);\nvar min = ('0'+today.getMinutes()).slice(-2);\nvar sec = ('0'+today.getSeconds()).slice(-2);\ntoday = hour+':'+min+':'+sec;\nmsg.payload = \n{\n  \"data\": \n  {\n    \"title\": \"Detection Foran!\",  \n    \"message\": \"Der blev fanget en eller flere personer foran! kl.\"+today,\n    \"data\": {\n        \"image\": \"/config/www/snapshots/foran_detection_latest.jpg\",\n        \"sound\": {\n            \"name\": \"default\",\n            \"critical\": 1,\n            \"volume\": 0\n        },\n        \"attachment\": {\n            \"content-type\": \"jpg\"\n        }\n    }\n  }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":540,"wires":[["9f91f95c.e9da38"]]},{"id":"c583f4a0.30e3a8","type":"api-call-service","z":"6b79cc41.b09ad4","name":"Notify Detection Telegram","server":"392cba7b.806846","version":1,"debugenabled":false,"service_domain":"notify","service":"casahabot","entityId":"","data":"{\"message\":\"Detection Foran!\",\"data\":{\"photo\":[{\"file\":\"/config/www/snapshots/foran_detection_latest.jpg\",\"caption\":\"Der blev fanget en eller flere personer foran!\"}]}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1130,"y":480,"wires":[[]]},{"id":"15e97b2d.fd0795","type":"inject","z":"6b79cc41.b09ad4","name":"Test notification","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":620,"y":480,"wires":[["1cf1bb6f.eebf85","c583f4a0.30e3a8"]]},{"id":"9f91f95c.e9da38","type":"api-call-service","z":"6b79cc41.b09ad4","name":"Notify Detection Thomas","server":"392cba7b.806846","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_mi_9t_pro","entityId":"","data":"{}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1130,"y":540,"wires":[[]]},{"id":"392cba7b.806846","type":"server","name":"Home Assistant","addon":true}]

Hi @wb666greene
I have now added the code, I can see where you are going... and will see in my flow for the image_processing if I can get some info about "if something is detected" and if I can get that info, then I can see if I based on then info then can get it to send a message...

[{"id":"b6648267.9ce2d","type":"api-call-service","z":"6b79cc41.b09ad4","name":"Foran-UVCG3","server":"392cba7b.806846","version":1,"debugenabled":false,"service_domain":"image_processing","service":"scan","entityId":"image_processing.foran_detection","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":780,"y":220,"wires":[["6baeb8c6.9dc748"]]},{"id":"97c81f15.2e795","type":"trigger-state","z":"6b79cc41.b09ad4","name":"OFF --> ON - Foran Detection","server":"392cba7b.806846","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.foranmotionsensor","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off","propertyValue":"old_state.state"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":170,"y":160,"wires":[["b6648267.9ce2d","3f90a309.1a2e8c"],[]]},{"id":"8afc1ae6.45f848","type":"trigger-state","z":"6b79cc41.b09ad4","name":"Still Recording?","server":"392cba7b.806846","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.foranmotionsensor","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":780,"y":300,"wires":[["b6648267.9ce2d"],[]]},{"id":"6baeb8c6.9dc748","type":"delay","z":"6b79cc41.b09ad4","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":990,"y":220,"wires":[["8afc1ae6.45f848"]]},{"id":"3f90a309.1a2e8c","type":"debug","z":"6b79cc41.b09ad4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":790,"y":120,"wires":[]},{"id":"392cba7b.806846","type":"server","name":"Home Assistant","addon":true}]

I can't do anything with your flow, too many nodes that are unknown to my system.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.