Integrating Blue Iris, Pushover, Node-RED, and Amazon Rekognition

Damn it, you’re going to make me write a new guide :). How is Google Vision versus Rekognition?

I can already see it’s got confidence levels built in. That’d at least simplify the flow a bit.

1 Like

The main benefit is that Gvision is somewhat simpler to use. I personally am living more and more in the google ecosystem so that was another motivator.

One quick question: Currently, the GVision and AWS Rekognition components only work on camera streams. Would it be possible to add a feature so that it is possible to upload an image which is then processed by GVision or AWS Rekognition? I’m asking because I’m using a couple of Arlo cameras which do not work with these components, because they don’t provide a normal camera stream.

You can use the local_file camera which has a service for updating the file displayed, then image process that camera. I see that it would be neater to make this a service in the image_processing entity

Thanks a lot for the quick reply! That’s a great idea. Didn’t know the local_file camera existed. Will give it a try.

1 Like

Getting this error on both Snapshot and Rekognition Nodes :anguished:

Help anyone ? I’ve double checked everything and all seems right according to the tutorial .

Is that from the tutorial or the flow I’d posted above?

The tutorial with all the steps !

Here is my current flow :

    {
        "id": "9ef75a0.2f3d2a8",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "f64c46e9.fc8308",
        "type": "server-state-changed",
        "z": "9ef75a0.2f3d2a8",
        "name": "Camera Motion",
        "server": "e94c8527.3f2d08",
        "version": 1,
        "entityidfilter": "binary_sensor.studio_motion",
        "entityidfiltertype": "exact",
        "outputinitially": true,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": false,
        "x": 140,
        "y": 80,
        "wires": [
            [
                "751a2f8a.b5229"
            ],
            []
        ]
    },
    {
        "id": "751a2f8a.b5229",
        "type": "change",
        "z": "9ef75a0.2f3d2a8",
        "name": "Convert",
        "rules": [
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "set",
                "p": "data.base_id",
                "pt": "msg",
                "to": "$match(topic, /binary_sensor.studio_motion/).groups[0].$string()",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "data.camera",
                "pt": "msg",
                "to": "\"camera.\" & $.data.base_id",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "data.image_processing",
                "pt": "msg",
                "to": "\"image_processing.rekognition_person_\" & $.data.base_id",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "data.camera_snapshot",
                "pt": "msg",
                "to": "\"/config/www/camera_snapshot/snapshot_\" & $.data.base_id & \".jpg\"",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "payload.entity_id",
                "pt": "msg",
                "to": "\"image_processing.rekognition_person_\" & $.data.base_id",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 340,
        "y": 80,
        "wires": [
            [
                "ffb77e21.7617d",
                "27b3ba6a.225696"
            ]
        ]
    },
    {
        "id": "ffb77e21.7617d",
        "type": "template",
        "z": "9ef75a0.2f3d2a8",
        "name": "Set Snapshot",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "{\n\t\"data\": {\n\t\t\"entity_id\": \"{{data.camera}}\",\n\t\t\"filename\": \"/config/www/camera_snapshot/snapshot_{{data.base_id}}.jpg\"\n\t}\n}",
        "output": "json",
        "x": 540,
        "y": 80,
        "wires": [
            [
                "7d09acf9.d2ab04"
            ]
        ]
    },
    {
        "id": "7d09acf9.d2ab04",
        "type": "api-call-service",
        "z": "9ef75a0.2f3d2a8",
        "name": "Snapshot",
        "server": "e94c8527.3f2d08",
        "version": 1,
        "debugenabled": false,
        "service_domain": "camera",
        "service": "snapshot",
        "entityId": "{{data.camera}}",
        "data": "{\"filename\":\"{{data.camera_snapshot}}\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 740,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "27b3ba6a.225696",
        "type": "delay",
        "z": "9ef75a0.2f3d2a8",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 240,
        "y": 180,
        "wires": [
            [
                "9c903780.372a48"
            ]
        ]
    },
    {
        "id": "9c903780.372a48",
        "type": "api-call-service",
        "z": "9ef75a0.2f3d2a8",
        "name": "Rekognition",
        "server": "e94c8527.3f2d08",
        "version": 1,
        "debugenabled": false,
        "service_domain": "image_processing",
        "service": "scan",
        "entityId": "",
        "data": "{\"entity_id\":\"{{data.image_processing}}\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 450,
        "y": 180,
        "wires": [
            [
                "c22816bf.3b19a8"
            ]
        ]
    },
    {
        "id": "c22816bf.3b19a8",
        "type": "api-current-state",
        "z": "9ef75a0.2f3d2a8",
        "name": "Person Check",
        "server": "e94c8527.3f2d08",
        "version": 1,
        "outputs": 2,
        "halt_if": "0",
        "halt_if_type": "num",
        "halt_if_compare": "gt",
        "override_topic": false,
        "entity_id": "",
        "state_type": "num",
        "state_location": "",
        "override_payload": "none",
        "entity_location": "aws_data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 680,
        "y": 180,
        "wires": [
            [
                "e1cee831.c348e8"
            ],
            []
        ]
    },
    {
        "id": "e1cee831.c348e8",
        "type": "change",
        "z": "9ef75a0.2f3d2a8",
        "name": "Set Confidence",
        "rules": [
            {
                "t": "set",
                "p": "person_confidence",
                "pt": "msg",
                "to": "aws_data.attributes.Person",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 160,
        "y": 280,
        "wires": [
            [
                "e51e846e.5ed918"
            ]
        ]
    },
    {
        "id": "e51e846e.5ed918",
        "type": "switch",
        "z": "9ef75a0.2f3d2a8",
        "name": "Confidence ",
        "property": "person_confidence",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "80",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 400,
        "y": 280,
        "wires": [
            [
                "24586816.fc4048"
            ]
        ]
    },
    {
        "id": "85df40d3.f705e",
        "type": "pushover",
        "z": "9ef75a0.2f3d2a8",
        "name": "",
        "device": "",
        "title": "Alert",
        "priority": 0,
        "sound": "pushover",
        "url": "",
        "url_title": "",
        "html": false,
        "x": 770,
        "y": 280,
        "wires": []
    },
    {
        "id": "24586816.fc4048",
        "type": "function",
        "z": "9ef75a0.2f3d2a8",
        "name": "Payload",
        "func": "msg.payload = \"Sensor: \" + msg.data.new_state.attributes.friendly_name + \"\\n\" + \"Person Confidence: \" + msg.person_confidence + \"%\";\nmsg.topic = \"Person Detected\";\nmsg.device = \"YourPushoverDeviceName\";\nmsg.priority = 1;\nmsg.image = \"/config/www/camera_snapshot/snapshot_\" + msg.data.base_id + \".jpg\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 600,
        "y": 280,
        "wires": [
            [
                "85df40d3.f705e"
            ]
        ]
    },
    {
        "id": "e94c8527.3f2d08",
        "type": "server",
        "z": "",
        "name": "Home Assistant"
    }
]

Sorry don’t know how to make it a tidy small scroll box !

Yeah, can’t import that since all of the quotes are swapped out. Type in 3 backticks to start a code block, paste it in there, and then do 3 more to close it.

Thanks ! Edited previous post, somehow the code block wasn’t working using the editor built in feature . Really excited about getting this working :smile:

What is the name of your AWS entity, e.g. image_processing.rekognition_person_? You can check the states in the developer tools.

No, it has another extra name :

image_processing.rekognition_person_salaestar . Should I replace all the similar entitie names with it ? I assumed whatever comes after the last _ would be replaced by the last word I have in my entity as it’s also my camera name .

Ahh, that’s why. My flow expects the camera name to match the image_processing.rekognition_person_ name, e.g. binary_sensor.fdc_motion to image_processing.rekognition_person_fdc.

Yours is binary_sensor.studio_motion and image_processing.rekognition_person_salaestar so the regex group fails. Could you change the names of everything to match the 3-letter patterns that I’m using? The naming scheme is mentioned in Step #1. Othewise you’d basically need to rewrite this to get it working.

Yea I’ve already replaced the binary sensor to match mine for exact expression, so far only using 1 camera for testing so no need for the 3 letters regex! (will change that later and I see no error there because the flow goes through and tries to call both the Snapshot and Rekognition nodes)

Changed the entities to match mine and I think it’s partially working now but strangely still getting an API error on the snapshot but none on the Rekognition Node :

Yay just got 2 notifications with 95% match for person :smiley: Just didn’t get the snapshot with it !

Close, I meant change the camera and Rekognition configuration in Home Assistant so you end up with the following:

camera.stu
binary_sensor.stu_motion
image_processing.rekognition_person_stu

It’s based around those 3 letters when it’s swapping out values in the change node. I’m guessing it’s attempting to create an entity that doesn’t exist in HA. You could always attach a debug node and see what it’s trying to pass to the snapshot. A bunch of the code would need to be changed if you’re using a different naming scheme.

1 Like

Appreciate the help @TaperCrimp, think I should be able to manage after that :slightly_smiling_face:

And thanks for writting such an easy and well laid out tutorial that even someone who just got into Home Assistant like me can follow :+1:

Will update once I get it running .

The only thing I’m confused about is why it’s triggering the notifications properly but not getting the screenshot, since both are tied to the convert node it doesn’t make much sense that the rekognition now works without errors but snapshot doesn’t .

Oh well, will just change the names like you suggested !

Found the issue with the debug node :

image

The entity_id it’s passing is only camera. and missing the other part of the entity name, which should be camera.salaestar in my case

@TaperCrimp so got it almost fully working in the meantime, I get all the notifications and so far it’s pretty damn accurate ! Finally can have an alarm and some more proper motion automations without having to worry about my 4 cats running around :smiley:

There’s only 1 thing which is not working, 2 of the parameters in the payload to pushover are not getting passed : msg.topic and msg.image . Also tried with msg.attachment but no go .

Node Red restarted few times and have the pushover modules installed .

Edit : Fully working after installing a new Pushover Node !

1 Like

Any ideas? Mine is throwing API errors out of no where now.