Camera Record Issue, ...Stream already recording to

Error executing script. Unexpected error for call_service at pos 1: Stream already recording to …

That is the error message I am getting. Let me share the background so hopefully I can get some help.

I have an automation set up to call a script when ever the front gate sensor is triggered. The condition of the automation is that the scrip called is “off”, to try and make sure I didn’t call the script again while still running (Think this condition is actually not necessary).

The script records about 10 seconds of footage, saves the file with the same name (each time script runs it overwrites the previous video), and then sends the video out via Telegram. This works great most of the time.

I usually find out there is an issue, when I receive the same video twice. Lets say gate gets triggered at 2pm. I get the correct video. Then at 3pm gate gets triggered again, but I receive the same video I got at 2pm. I don’t get any more videos after that.

I then log in to home assistant, and if I try to manually run the script I get the Error executing script. Unexpected error for call_service at pos 1: Stream already recording to …

I tried to look at logs to figure out what is triggering the issue, but I can’t make much sense. In my example, it would seem that when the automation ran at 3pm, it started recording but it never stopped. The script then ends up sending the previous video, then the future script calls don’t run because they get the camara still in use error.

I couldn’t figure out how to stop recording. The only solution I found was to reboot the camera. For testing purposes I’ve put the cameras power supply behind a relay I can control via home assistant. When I notice the script stopped working I just turn off the relay for 5 seconds, then turn it back on.

I just read https://www.home-assistant.io/integrations/camera/ this time actually going all the way to the bottom. I will try the turn off service turn on service option next time it does it, to see if that is a way I can reset the cameras without having to power down the cameras physically. (Ok, so the way they had written it confused me, but basically the instructions suggest we use camera.turn_off service, which I had tried before and doesn’t work for me)

What I need help with is REAL solutions.

The ideal solution would be to find out what is making the camera ignore the duration setting and stay on recording status. Then fix the issue at its root. A camera.stop_record service would do the trick as well, but seems not at option yet. This brings me to plan B.

Is there a way I can run triggers based on camera.record status? I am thinking maybe an automation that would turn off then on camera service if a camera is recording for more than 1 minute. All my scrips call for camera record durations of under 20 seconds, so a camera record over 1 minute would mean camera is not working properly.

If camera record duration is not a variable we can track, how about the camera.record status? If camara.record is “on” for any camera, and all scripts are “off”, again it would mean the camera is not working properly and I could run a script to reset it.

Or finally, if we can’t get anything from camera.record to track, how about event errors that are logged? Is there a way to run a trigger when “Error executing script. Unexpected error for call_service at pos 1: Stream already recording to …”. The idea would be to create a script to reset the camera after that error pops up.

Thanks in advance for any and all help!

Update.

So I still haven’t figured out what is making the camera get stuck on recording. I’ve tried everything I can think of to manually replicate the issue, but I can’t. At times it goes over a day without any issues, other days every few hours it gets stuck.

I’ve done as much reading as I can regarding camera.record and there isn’t a camera.stop_record feature. What I haven’t been able to find is anything that can track when the camera stops or is not recording.

When the camera is stuck recording, and I try to call the script manually, I get the “…stream already recording to …”. That tells me that the system does have some type of flag that shows if the camera is recording or not.

Seems I would need to set up a command line sensor or a file sensor but I have no idea how I would set up those sensors.

Any news with it?

Any news with it ? having the same annoying issue here.

same issue, can’t pinpoint a cause

1 Like

Perhaps we can add a binary sensor on the stream integration
binary_sensor.stream_is_recording

Also having the same issue on 2 different h.a instances. Mine and my friends one that i set up for him. My automations all work correctly but the record function seems to throw the exact same error intermittently. Quite annoying because it happened around the exact same time somebody stole about 1500bux worth of stuff off him and there are no recordings to show him wtf happened which sucks! It really does seem to be a issue with the camera.record function… Is there any way to let the devs of h.a know so they can implement a fix?

Hi @Feva,

It’s an older thread, but I would like to reactivate it because i have the exact same issue.

Simple Automation that starts recording when a door is opened. It worked a few days, and now i always get this error message, and no mp4 file created.
Before recording, i create a JPG snapshot, and this works well.

Any news about this issue?

Thanks.

Ben

Have you found something?
I do see the same, after several days it is starting to report the error Stream already recording to...
Restart helps but it is not an acceptable workaround…

Is there any fix for this? I think I have the same issue. My camera is recording the first time after reboot, and succesfully save the file, but the next time I get the error “already recording”.

I have tried to make a extra delay after the camera.record, with no success. Its like the record state is not changed, or the file lock is not removed after the automation has run

Same for me sometimes it works for weeks and then only 1 or 2 times