NR and sending Security Camera Image to HA Companion App

Hi All -

I’m sorry for this post, I have spent days reading and trying ot understand what I"m doing wrong. I’m still new to HA/NR and learning, so please grant me a little grace. I’m sure this is something small but my OCD won’t let me move on until I solve it lol.

I want to setup NR to send a HA notification to me when motion is triggered on external cameras when the alarm is on.

I can handle setting up the triggers, etc. But i’m stumped on being able to pull a picture from the camera and send it to my phone via HA Companion App.

I’ve been playing with this setup. It works to send the notification. It does not send the picture. However the picture is being taken, saved to my www folder and IS accessible via the URL (at least from inside my network).

Here’s my flow for this part:

image

Here’s the code:

[{"id":"505af84286fcbda1","type":"inject","z":"8e39d852c849828a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":1060,"wires":[["483523fc0a77d1a2"]]},{"id":"e542b71fd0ad6d7e","type":"api-call-service","z":"8e39d852c849828a","name":"Notify Me","server":"ab971ec0.4114f","version":7,"debugenabled":false,"action":"notify.mobile_app_sm_f926u1","floorId":[],"areaId":[],"deviceId":[],"entityId":[],"labelId":[],"data":"{\"title\":\"Motion Detected\",\"message\":\"Motion has been detected down the side of the house\",\"data\":{\"subtitle\":\"Side motion detector\",\"attachment\":{\"content-type\":\"jpeg\",\"url\":\"http://172.16.0.250:8123/local/1204_windemere_driveway_cam_snapshot.jpg\"}}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"notify","service":"mobile_app_sm_f926u1","x":560,"y":1160,"wires":[[]]},{"id":"483523fc0a77d1a2","type":"api-call-service","z":"8e39d852c849828a","name":"Take Snapshot","server":"ab971ec0.4114f","version":7,"debugenabled":false,"action":"camera.snapshot","floorId":[],"areaId":[],"deviceId":[],"entityId":["camera.XXX_driveway_cam"],"labelId":[],"data":"{\"filename\":\"/config/www/1XXX_driveway_cam_snapshot.jpg\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"camera","service":"snapshot","x":280,"y":1180,"wires":[["5a58cb5deadeb59c"]]},{"id":"5a58cb5deadeb59c","type":"delay","z":"8e39d852c849828a","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":400,"y":1040,"wires":[["e542b71fd0ad6d7e"]]},{"id":"ab971ec0.4114f","type":"server","name":"HA1","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false}]

Apprecaite any input, thank you!

Try using the image key without the full address.

{
    "title": "Motion Detected",
    "message": "Motion has been detected down the side of the house",
    "data": {
        "subtitle": "Side motion detector",
        "image": "/local/1204_windemere_driveway_cam_snapshot.jpg"
    }
}
1 Like

DUDE… that was it. I cannot tell you how long I have been struggling with this, THANK YOU.

Now I can finally move on to some of the other projects!

One other question - will this work when I’m outside of my home network? I do have the Nabu Casa subscription …

Yes, nabu casa will let HA connect from outside your home.

1 Like

Thank you again for your help here.
I love Nodered, but it’s always some small syntax or typo that gets me. I can figure out the big concepts and templates, but I always miss a silly " or ’ or upper/lower case … or in this case using “local” instead of the actual path. And I just dont’ know enough (yet) to be able to spot these things on my own …

Happy New Year to you!

1 Like