Generic camera.snapshoot in 2022.4 will not overwrite image file

I’m having an issue with the camera.snapshot service in 2022.4
I have an automation set in Node-Red to periodically take snapshots from the RTSP stream which has been working great for as long as I can remember. I noticed the other day that the image hasn’t updated in a week, which is right when I updated to 2022.4.

Doing some testing, calling the camera.snapshot service seems to complete without any errors, but the image doesn’t update. BUT If I delete the image file and call camera.snapshot it will take the snapshot and create the file. But once the file is created, it will never overwrite it with a new image.

This is only happening with the generic cameras, all other cameras the snapshot service is working as it should. I assume it has something to do with the content type. I’ve tried video/mpeg and also image/jpeg (will not take snapshot at all with this one).

Any suggestions?

There was a bug in 2022.4.0 which meant the snapshot didn’t work correctly for streams when imported from yaml. If you click configure on each camera in the integrations page running the latest version it should update .

I’m now on 2022.4.6, have configured, reconfigured, deleted, re-added the cameras multiple times. And they’ve been deleted from YAML since I moved them to the UI.

Just tested again before posting this response and it’s still doing the same. If the image file exists, it will not take the snapshot. If I delete the image, it will snapshot and create it as it should.

Do you know what the proper “content type” should be?

The content type box should be gone on 2022.4.6 because it is automatic now. Can you try it again?

1 Like

OK, I just tried just doing “Configure” on 2022.4.6, did not ask for content type, but did not change the behavior.
Then I removed the camera and re-added. Still the same behavior. Will not overwrite the existing image file.

Ok. Are you able to narrow down whether the generic integration is failing to provide a snapshot vs nodered failing to write it to disc?

What about the node red logs? When I upgraded to 4.6 I was seeing connection errors from NR to HA. I had to reload the NR companion in HACS and reboot the entire system not just the core but the host on HA OS.

If I swap the camera entity in the node to one that’s not a generic camera the snapshots are working just fine. So from that I’d say it’s not on the node red side

Now that I’m home and can check them… NR logs are clean. No connection errors or anything in there.

Right after trying to take a failed snapshot there is nothing in any logs nodered HA core/supervisor? If you call the snap shot from services in dev tools it still doesn’t overwrite the old pic?

Just attempted calling through dev tools. Get the checkmark after clicking on the call service button. Nothing in the config/settings/logs and nothing in supervisor/system. And the file did not update. Deleted the file, clicked call service again, new snapshot image showed up. So I think it’s safe to rule out NR.

Now if I change the camera to any camera brought in through the reolink integration, I can call the snapshot service and it continuously updates the image.

With the other cameras are you saving to the same folder as the generic? If not you could try changing the file path by creating a new folder. Maybe a permission error.

You can use this flow in the meantime to delete the existing file after the image is sent.

[{"id":"1acf2e94bd28534f","type":"file","z":"40e1f8faee5dae4f","name":"","filename":"/media/camera/mailbox/snap101.jpg","appendNewline":true,"createDir":false,"overwriteFile":"delete","encoding":"none","x":2270,"y":320,"wires":[[]]},{"id":"1c5c1ffb4fae70e1","type":"inject","z":"40e1f8faee5dae4f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1940,"y":320,"wires":[["1acf2e94bd28534f"]]}]

They do save to the same folder, but for the purpose of testing I was simply changing the entity from the generic to the other cameras in the same flow, so they were even writing to the same file.

I think deleting the existing file after it’s sent should do it though. I don’t need to keep the image around, just snapshot it and send it then it’s good to delete. Thanks!

@MRobi Is this all working ok for you now?

Just getting back to testing this now. Deleting the file after it sends the notification does fix my issue.

1 Like