Anyone have a working node red setup they can share regarding sending a snapshot of a ip-camera to either telegram or email when a trigger is set?
Im trying to send a snapshot of the camera when someone presses the doorbell.
Any help appreciated!
Anyone have a working node red setup they can share regarding sending a snapshot of a ip-camera to either telegram or email when a trigger is set?
Im trying to send a snapshot of the camera when someone presses the doorbell.
Any help appreciated!
Watching.
I would like to know too.
This is assuming you have the camera as a camera entity within home assistant.
[{"id":"ed80a3f.522526","type":"server-state-changed","z":"5eb3594f.d294b8","name":"","server":"ef067c6f.620e6","entityidfilter":"sensor.doorbell","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":258,"y":1072,"wires":[["9d86b191.fc86a"]]},{"id":"3cf7a731.a08ae8","type":"e-mail","z":"5eb3594f.d294b8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"","x":962,"y":1072,"wires":[]},{"id":"69bc3ab7.bd6104","type":"http request","z":"5eb3594f.d294b8","name":"","method":"GET","ret":"bin","paytoqs":false,"url":"https://example.com{{{data.attributes.entity_picture}}}","tls":"","proxy":"","authType":"basic","x":694,"y":1072,"wires":[["f3a3e80f.3e8e38"]]},{"id":"9d86b191.fc86a","type":"api-current-state","z":"5eb3594f.d294b8","name":"Doorbell Camera","server":"8d00ebbc.99a928","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"camera.doorbell","state_type":"str","state_location":"","override_payload":"none","entity_location":"data","override_data":"msg","x":506,"y":1072,"wires":[["69bc3ab7.bd6104"]]},{"id":"f3a3e80f.3e8e38","type":"function","z":"5eb3594f.d294b8","name":"","func":"msg = {\n to: \"[email protected]\",\n topic: `Doorbell @ ${Date()}`,\n payload: msg.payload,\n filename: \"doorbell.jpg\"\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":834,"y":1072,"wires":[["3cf7a731.a08ae8"]]},{"id":"ef067c6f.620e6","type":"server","z":"","name":"hass.io","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]
I can get the flow to send me the email but the attached “doorbell.jpg” is a unsupported file type.
Do I need to change anything in the http request node?
In URL https://example.com{{{data.attributes.entity_picture}}}
need to change it to point to your ip/hostname and port if needed
After the next release of node-red-contrib-home-assistant-websocket you’ll be able to also do this with the api node.
[{"id":"a1380b10.730358","type":"server-state-changed","z":"5eb3594f.d294b8","name":"","server":"ef067c6f.620e6","entityidfilter":"sensor.doorbell","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":178,"y":1760,"wires":[["b919a22a.9fd0f"]]},{"id":"ff3c4226.fc77d","type":"e-mail","z":"5eb3594f.d294b8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"","x":658,"y":1760,"wires":[]},{"id":"48fcfcd6.e17a24","type":"function","z":"5eb3594f.d294b8","name":"","func":"msg = {\n to: \"[email protected]\",\n topic: `Doorbell @ ${Date()}`,\n payload: msg.payload,\n filename: \"doorbell.jpg\"\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":1760,"wires":[["ff3c4226.fc77d"]]},{"id":"b919a22a.9fd0f","type":"ha-api","z":"5eb3594f.d294b8","name":"","server":"8d00ebbc.99a928","protocol":"http","method":"get","path":"camera_proxy/camera.doorbell","data":"","location":"payload","locationType":"msg","returnType":"arraybuffer","x":402,"y":1760,"wires":[["48fcfcd6.e17a24"]]},{"id":"ef067c6f.620e6","type":"server","z":"","name":"hass.io","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]
Very nice.
I still can’t get the image to send with the email. Guess i need to look at my firewall logs to see. All my cameras are on a separate subnet and blocked from the internet and other subnets.
Didn’t realize there was an implementation of camera_proxy on the websocket API. So this can be done using the current version.
[{"id":"f9e692af.0a1a9","type":"ha-api","z":"5eb3594f.d294b8","name":"","server":"8d00ebbc.99a928","protocol":"websocket","method":"get","path":"","data":"{\"type\":\"camera_thumbnail\",\"entity_id\": \"camera.doorbell\"}","location":"doorbell","locationType":"msg","responseType":"json","x":258,"y":416,"wires":[["a90c544a.c816f8"]]},{"id":"caaab521.854778","type":"inject","z":"5eb3594f.d294b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":128,"y":416,"wires":[["f9e692af.0a1a9"]]},{"id":"89ce4d3c.9f128","type":"e-mail","z":"5eb3594f.d294b8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"","x":514,"y":416,"wires":[]},{"id":"a90c544a.c816f8","type":"function","z":"5eb3594f.d294b8","name":"","func":"msg = {\n topic: `Doorbell Camera @ ${Date()}`,\n payload: 'Doorbell',\n attachments: [{\n \"filename\": \"doorbell.jpg\",\n \"content\": msg.doorbell.content,\n \"encoding\": 'base64'\n }]\n}\nreturn msg;","outputs":1,"noerr":0,"x":386,"y":416,"wires":[["89ce4d3c.9f128"]]}]
Your camera needs to be added to Home Assistant as a camera entity.
This works perfect. Thank you
The door bell flow works great so I thought to make one for when my alarm disarmed and send a pic from my great room camera. Must be missing some small thing cause I get an error in node red.
TypeError: Cannot read property 'content' of undefined
[{"id":"5bc2d360.ccdb5c","type":"ha-api","z":"4e98a45c.8ebdac","name":"","server":"eb4ac6fe.33757","protocol":"websocket","method":"get","path":"","data":"{\"type\":\"camera_thumbnail\",\"entity_id\": \"camera.great_room\"}","location":"alarmdisarmed","locationType":"msg","x":330,"y":400,"wires":[["dd164660.759f68"]]},{"id":"ab132045.1b5508","type":"e-mail","z":"4e98a45c.8ebdac","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"Daves Email","x":650,"y":400,"wires":[]},{"id":"dd164660.759f68","type":"function","z":"4e98a45c.8ebdac","name":"","func":"msg = {\n topic:
Greatroom Camera @ ${Date()},\n payload: 'Alarmdisarmed',\n attachments: [{\n \"filename\": \"greatroom.jpg\",\n \"content\": msg.greatroom.content,\n \"encoding\": 'base64'\n }]\n}\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":400,"wires":[["ab132045.1b5508"]]},{"id":"52f60825.d0eb3","type":"inject","z":"4e98a45c.8ebdac","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":400,"wires":[["5bc2d360.ccdb5c"]]},{"id":"eb4ac6fe.33757","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
You have the api node outputting its results to msg.alarmdisarmed
but you’re trying to access msg.greatroom.content
in the function node where it should be msg.alarmisarmed.content
Thanks. That worked.
Is it possible to send more then one attachment in the same flow/email?
Pretty much the exact same thing but do an api call for each camera and added them to the attachment array in the email.
[{"id":"b8dfca9b.3983e8","type":"inject","z":"5eb3594f.d294b8","name":"","topic":"","payload":"[\"camera.camera1\",\"camera.camera2\",\"camera.camera3\",\"camera.camera4\"]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":194,"y":576,"wires":[["81c0da36.2c7278"]]},{"id":"b242cfff.5de7d","type":"e-mail","z":"5eb3594f.d294b8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"","x":994,"y":576,"wires":[]},{"id":"4ebd7c88.f23b94","type":"function","z":"5eb3594f.d294b8","name":"email","func":"msg = {\n topic: `Cameras @ ${Date()}`,\n payload: 'All Cameras',\n attachments: msg.payload\n}\nreturn msg;","outputs":1,"noerr":0,"x":866,"y":576,"wires":[["b242cfff.5de7d"]]},{"id":"35060d94.be7b02","type":"ha-api","z":"5eb3594f.d294b8","name":"","server":"8d00ebbc.99a928","protocol":"websocket","method":"get","path":"","data":"{\"type\":\"camera_thumbnail\",\"entity_id\": \"{{payload}}\"}","location":"image","locationType":"msg","responseType":"json","x":450,"y":576,"wires":[["ae1183ab.a78d4"]]},{"id":"ae1183ab.a78d4","type":"function","z":"5eb3594f.d294b8","name":"attachment","func":"msg.payload = {\n \"filename\": `${msg.payload.split(\".\")[1]}.jpg`,\n \"content\": msg.image.content,\n \"encoding\": 'base64'\n };\nreturn msg;","outputs":1,"noerr":0,"x":598,"y":576,"wires":[["4bd9657.d4f269c"]]},{"id":"81c0da36.2c7278","type":"split","z":"5eb3594f.d294b8","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":322,"y":576,"wires":[["35060d94.be7b02"]]},{"id":"4bd9657.d4f269c","type":"join","z":"5eb3594f.d294b8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":738,"y":576,"wires":[["4ebd7c88.f23b94"]]}]
Kind of works. The flow sends an email with the five cameras. But doubles up one of the cameras at random. Different camera each time I inject. Also in Node Red debug window I get “Error Message: Invalid format”
Edit: A closer look I find the first inject fails completely. The second inject sends the email but with the error and the email that I receive is the time stamp on the camera images of the fist inject. If that makes sense.
How would you format this differently for the notify domain? I tried this but couldn’t get it to work.
Very nice You know what’s a node !!
I will use this topic about a close question…
I need to get the camera url picture to use visual recognition (watson) to know if my car is there or not.
But the watson node want a real url Where can I found this in node red ?
Tks
Ps: my thumbnail picture is at /tmp/my-image.jpg but it’s not exposed to the web
I’m trying to figure this one out too. I think I have the flow, but not sure what to put into the notify data box.
Did you find any solution?
I am facing the same problem: which url to specify for Watson