#Running script on entity change

1 messages · Page 1 of 1 (latest)

rain slate
#

I have a camera, that's integrated via the Frigate addon, that the rtsp feed keeps crashing on. I created the following automation so that if it changes to "Unavailable" it should run a shell command that ssh's in and restarts the service. I can run the actions manually (three dots, run actions) and it restarts the service fine. But it does not fire off automatically when the camera feed changes to "Unavailable" Any ideas?

description: Reset Backyard Camera
triggers:
  - trigger: state
    entity_id:
      - camera.backyard
    to: unavailable
actions:
  - action: shell_command.restart_backyard_cam_rtsp
    data: {}
mode: single```
granite slate
#

What do you see in the traces?

rain slate
#

@granite slate Where at in the Traces? Sorry.. this is the first time trying to troubleshoot an automation.

neat falcon
#

Have you actually confirmed the camera.backyard entity changes state to unavailable?

#

Or is it just that the stream stops working.

rain slate
#

I manually reset the service then within a minute it went back offline.

#

Then in Traces, I see Executed: May 2, 2025 at 1:17:17 PM

#

and I see that it says that it ran the command..

neat falcon
#

Ok, well everything seems to be working as intended then?

#

(Well except for your camera)

rain slate
#

Hmm.. just weird that if I run the action manually, it resets the stream.. but if it's automatic, it doesn't. 😦

#

I just need to ditch that camera... but figured I'd try to "fix" it in the meantime.

neat falcon
#

maybe try adding some arbitrary delay like 1 minute or something

#

maybe whatever makes it go unavailable also makes it temporarily stop accepting connections or something

rain slate
#

is that here?

#

nm. that was 1 second 🙂