Detect when frigate stream is offline

hello, is it possible to detect when my camera is offline, perhaps an event that would fire when the stream is no longer playing?

my camera often hangs and i would like to reboot it via a smart power socket.

thanks

I just use an automation to check if the camera is unavailable (the state I find it in when it stops streaming), seems to work well for me.

alias: Reboot Unavailable Cameras
  id: reboot_unavailable_cameras
  mode: single
  triggers:
    - trigger: state
      id: tt-8l_gatekeeper
      entity_id: camera.tt_8l_gatekeeper
      from: null
      to: unavailable
      for:
        hours: 0
        minutes: 0
        seconds: 5
  actions:
    - action: button.press
      target:
        entity_id: button.tt_8l_gatekeeper_reboot

Hello, thanks for answer but I don’t have this entity tt_8l_gatekeeper. Should this be provided by frigate HACS integration ?

That’s the id of my camera, just change it to your cameras id. Also the reboot action is specific to Tapo Camera Control integration, you’ll need to change that to use the switch you mentioned in the OP.

is your pasted format correct? I get YAML parsing error

Error in parsing YAML: bad indentation of a mapping entry (line: 2, column: 5)

and if i unindent, then it saves it but fails to set up

alias: Reboot Unavailable Cameras
id: reboot_unavailable_cameras
mode: single
triggers:
  - trigger: state
    id: front
    entity_id: camera.front
    from: null
    to: unavailable
    for:
      hours: 0
      minutes: 0
      seconds: 5
actions:
  - action: button.press
    target:
      entity_id: switch.smart_socket_2

Your new automation has saved, but waiting for it to setup has timed out. This could be due to errors parsing your configuration.yaml…

Also, just to be sure:
Settings > Automations & Scenes > Create automation > Edit in YAML ?

Ok i managed to create something, will see if it works

Thanks a lot!

Ya I have my automations in seperate files and forgot to compensate for it being a list item, your indentation looks right.

That said you’re using a switch from the looks of it switch.smart_socket_2, but switches aren’t buttons so button.press will have no effect. You need to use switch actions, something like this.

actions:
  - action: switch.turn_off
    target:
      entity_id: switch.smart_socket_2
  - delay:
      seconds: 5
  - action: switch.turn_on
    target:
      entity_id: switch.smart_socket_2