How to get snapshot from camera and save to folder?

Hi All,

I am trying to get a camera to take an image when motion has been detected by an outdoor motion sensor. So what happens now is that when the motion sensor detects something moving then it takes an image but when I look in the folder the image file name is there but the image is blank. It then continues to send the message (using Pushover) to my phone, but obviously with no image.

This is my flow I have:

[{"id":"cb8d64513de8a318","type":"api-call-service","z":"e362206a1f55dcfb","name":"Take Image","server":"391ba46c.ca186c","version":5,"debugenabled":false,"domain":"camera","service":"snapshot","areaId":["office"],"deviceId":["ff4c7a0750efb3d232f4457d27802395"],"entityId":["camera.sliding_door_camera"],"data":"{\"filename\":\"/config/tmp/snapshot_{{ entity_id.name }}.jpg\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"filename","propertyType":"msg","value":"","valueType":"data"}],"queue":"first","x":770,"y":140,"wires":[["8df77deffdf5c47e"]]},{"id":"a3c2a5fdaa5804b4","type":"change","z":"e362206a1f55dcfb","name":"Send Image","rules":[{"t":"set","p":"payload","pt":"msg","to":"Motion has been detected","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Sliding Door","tot":"str"},{"t":"set","p":"attachment","pt":"msg","to":"/config/tmp/snapshot_{{ entity_id.name }}.jpg","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":140,"wires":[["40b3da205ecfd378"]]},{"id":"40b3da205ecfd378","type":"pushover","z":"e362206a1f55dcfb","name":"Motion Detected","device":"","title":"Motion Detected by Sliding Door","priority":0,"sound":"classical","url":"","url_title":"","html":false,"x":1420,"y":140,"wires":[]},{"id":"8df77deffdf5c47e","type":"file","z":"e362206a1f55dcfb","name":"Write Image To file","filename":"/config/tmp//snapshot_{{ entity_id.name }}.jpg","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":990,"y":140,"wires":[["a3c2a5fdaa5804b4"]]},{"id":"391ba46c.ca186c","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]

Any help will be appreciated.

Thanks

Is your snapshot image on disk also empty?

On disk it is there yes. But I feel that if this works then will it automatically override the old image with the new image though?

The write to file is redundant and not necessary. there is also a typo in the file path. You only need the snapshot call service. Just use the entity, leave the device and area blank.

image