Front-end broke automation?

I had been using the Surveillance Card to show my cameras on the front-end. I have automations that are triggered when any of the cameras detect motion. At that point the automations worked fine but I was having problems with the surveillance card. So I decided to create my own area for cameras. The new front-end looks like this:

The 4 small thumbnails remain in place and don’t change. The large display is a conditional card - whichever camera detects motion is displayed. This is what I think broke the one of the scripts my automation calls - the active camera is being displayed as I take a snapshot from it. Specifically when motion is detected the script now fails when it takes a snapshot with the error: "Failed to call service script. API returned status ERROR 404/
The crazy thing is that the snapshot is taken and saved but the automation stops because of this script error.

So my question is how do I fix this? Do I need to temporarily disable the camera display on the UI to take the snapshot without an error? I’m just not sure what to do about this and would really appreciate your input. Thanks for taking the time to read this.

If you do this, does the automation work then?

I can’t see how anything you do with your dashboards could affect the output of a result at all. I would be looking at your API calls, check docs to see if the URL has changed etc. Check your system logs too, see if you have anything there.

Thanks @hawksj for suggestions - I’m really open to any ideas.

I’ve checked all of the logs I can think of. I know there are other items that can be turned on to send debugging info to logs but I’m not sure what I should turn on to get more info about this. The only error I’ve seen is what the script displays when I run it manually. I’ll have to see if there is something with the Reolink cameras that I can turn on.

I’ll have to look at how to turn off the camera - I haven’t tried that yet. If something is detecting motion, that’s really the last thing I’d like to disable even for a few moments. I will try that today though and post back.

I do have a lot of API calls but most of them are webhooks to HA to turn items on and off. Nothing that I can think of that would use a camera. There are a few that run from HA but they run pumps or write to an external log about my X10 stuff. My guess is that the Reolink camera interface has API calls that I don’t see but are part of the functionality. They are the only cameras I have working with motion at the moment. I have yet to do ftp triggers from the 2 old foscam cameras.

The reason I thought it was the dashboard is because whatever camera triggers motion (and being displayed in the conditional card) is also the camera an automation is taking a snapshot from at the same time. I guess the only way to see if this is what is the cause is to disable the camera while the script takes the snapshot then go from there.

Thanks - it always helps to have someone else’s input when troubleshooting.

Well if you want to test if your recent dashboard additions are the cause of it breaking then I’d just delete the cards you recently added. I don’t think it will change anything but it will write it off as the cause.

What does the script do? Can you post YAML so we might find out what is 404’ing?

This has been throwing the error regularly until 16 minutes ago - it ran without a problem. Here’s the script - not much to it - just taking the snapshot (there’s a lot more to the automation but this is where the error shows up).

alias: garage_camera_motion_snapshot
sequence:
  - service: camera.snapshot
    data:
      filename: /config/www/tmp/GarageCameraMotionTrigger.jpg
    target:
      device_id: 676f81f2d3857c1e3d89efca6fa80ef5
mode: single
icon: mdi:camera

There is a separate but similar script for the front doorbell camera too.

Error 404 is typically an object does not exist error, so it sounds like you are trying to display the snapshot before it is done being saved to the storage media

Unfortunately, I didn’t have as much time to work on this today as I hoped but this is what I did get done:

I have 5 conditional cards - 2 of which don’t have motion triggers yet. The three that are working are

garage no motion (the default)
garage motion
front doorbell motion

so the majority of the time the garage camera is displayed.

I put a camera icon on each of these three entities which triggers a camera snapshot (no automation/script call). It didn’t matter which garage camera card I clicked the icon on (motion or no motion) I got an error. Either the API/404 error or an unknown error. I did get a picture saved for all of these clicks despite the error.

When I clicked the front door camera which was not active/no motion/no default show I received no error and got a picture saved.

I decided to change the camera view from live to auto and that had no effect on the results.

I did have debugging turned on when I first started today and did get this one error: 2023-12-15 10:50:52.517 ERROR (MainThread) [homeassistant.components.onvif] Fetch snapshot image failed from Garage Camera, falling back to FFmpeg; Unknown error: Failed to authenticate to http://192.168.1.xx:x/cgi-bin/api.cgi?cmd=onvifSnapPic&channel=0 Now that I look at this again, this is not where I’m saving the pictures. I’ll have to look into what is trying to save this in an alternate location. I think this is also when it was running from the script so I’ll have to check the error tomorrow when it is just triggering from the camera entity in the ui.

I didn’t leave debugging on since it was spewing so many entries. My hope is to have more time to get back to this tomorrow and check the logs more when I trigger my snapshots.

@WallyR at this point all I’m doing is just saving the snapshot (which it does) - so the automation which uses the snapshot doesn’t come in to play. Any idea how saving a snapshot could cause a 404? If I get the same error entry tomorrow, I will know that something is trying to save the snapshot to another location and this would be the cause. It’s just not something I’m directly doing.

FINALLY figured out my problem! As is usually the case, it pays to read the documentation. The Reolink integration suggests that one not use another integration with it and I was. I was using ONVIF for the PTZ commands. I removed ONVIF and changed my camera commands and voila all is working well.

Again, thanks to those that took the time to help me sort through my problems. I may just be bald by the time I get HA working as I would like it to be.