Hi,
I have an issue with frigate that will crash my home assistant VM due to out of memory caused by frigate. It occurs when some camera become unavailable for x reason.
So I thought of making an automation that will check if the camera becomes unavailable, turn off all frigate features and turn them back on when it becomes available again.
I don’t know anything about blueprints, so I asked AI to write and of course it has errors.
If someone could help my fix this, I would appreciate!
Thanks!!
blueprint:
name: Frigate Camera Availability Automation with Delay and Extra Condition
description: Automates Frigate settings based on camera availability with a delay and extra condition.
domain: automation
variables:
camera_entity:
description: The entity ID of the camera to monitor.
required: true
frigate_motion_entity:
description: The entity ID of the Frigate motion entity for the camera.
required: true
frigate_object_detection_entity:
description: The entity ID of the Frigate object detection entity for the camera.
required: true
frigate_record_entity:
description: The entity ID of the Frigate record entity for the camera.
required: true
notification_title:
description: Title of the notification to send.
default: "Camera Unavailable"
notification_message:
description: Message of the notification to send.
default: "Camera '{{ camera_entity }}' is unavailable."
delay_time:
description: Delay time in seconds before turning off Frigate features.
default: 30
extra_condition_entity:
description: The entity ID of the extra condition to check.
default: ''
extra_condition_state:
description: The desired state of the extra condition entity.
default: ''
trigger:
- platform: state
entity_id: '{{ camera_entity }}'
to: 'unavailable'
- platform: state
entity_id: '{{ camera_entity }}'
to: 'available'
action:
- service: notify.mobile_app_your_device_name
data:
title: '{{ notification_title }}'
message: '{{ notification_message }}'
- if:
condition:
condition: template
value: "{{ trigger.to_state.state == 'unavailable' }}"
then:
- delay:
seconds: '{{ delay_time }}'
- service: frigate.set_motion
data:
entity_id: '{{ frigate_motion_entity }}'
state: 'off'
- service: frigate.set_object_detection
data:
entity_id: '{{ frigate_object_detection_entity }}'
state: 'off'
- service: frigate.set_record
data:
entity_id: '{{ frigate_record_entity }}'
state: 'off'
- elif:
condition:
condition: and
conditions:
- condition: template
value: "{{ trigger.to_state.state == 'available' }}"
- condition: template
value: "{{ extra_condition_entity.state == extra_condition_state }}"
then:
- service: frigate.set_motion
data:
entity_id: '{{ frigate_motion_entity }}'
state: 'on'
- service: frigate.set_object_detection
data:
entity_id: '{{ frigate_object_detection_entity }}'
state: 'on'
- service: frigate.set_record
data:
entity_id: '{{ frigate_record_entity }}'
state: 'on'
I spent some time reading about blueprints and I came up with this, but the automation doesn’t get triggered when the camera becomes unavailable or available