I’ve been using SambaNAS to record in Frigate to a secondary drive on my HA host for some time now. I have an automation which added a bit of a delay to allow SambaNAS to startup before Frigate which was working great. Lately however, it seems that HAOS supervisor isn’t updating that SambaNAS is running for quite a few minutes after HA start-up. What’s the best way to speed this up? Or should I try something else to trigger it?
I’ve been trying various different things as I’d like Frigate to start as soon as SambaNAS does thus minimising my camera’s down time. I also want it to not start Frigate if for any reason there’s an issue with the drive as I don’t want to fill the system drive.
I’ve tried forcing HA to reload the supervisor info for SambaNAS but sometimes I think this happens too soon so it doesn’t happen any quicker than it normally does. Also sometimes it will reload it so fast that the next trigger in the sequence has already happened.
- alias: Frigate - Delay start for media mount
id: Frigate - Delay start for media mount
description: ""
mode: single
trigger:
- trigger: homeassistant
event: start
condition:
- condition: state
entity_id: binary_sensor.frigate_full_access_running
state: "off"
action:
# - wait_for_trigger:
# - platform: state
# entity_id: sensor.home_assistant_supervisor_cpu_percent
# timeout: "00:05:00"
- delay: "00:01:00"
- action: homeassistant.reload_config_entry
target:
device_id: a5be72009fab739c9228879709344c38 #reloads HA Supervisor SambaNAS integration
# - wait_for_trigger:
# - platform: state
# entity_id: binary_sensor.samba_nas_running
# to: "on"
# timeout: "00:05:00"
- action: homeassistant.reload_config_entry
target:
device_id: 29dc09920ca372becfbda88d481063b0 #reloads HA System Monitor integration for sensor.disk_use_percent_frigate
- delay: "00:00:05"
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.samba_nas_running
state: "on"
- condition: numeric_state
entity_id: sensor.disk_use_percent_frigate
above: 0
sequence:
- service: hassio.addon_start
data:
addon: ccab4aaf_frigate-fa
- conditions:
- condition: state
entity_id: binary_sensor.samba_nas_running
state: "on"
- condition: state
entity_id: sensor.disk_use_percent_frigate
state: "unavailable"
sequence:
- service: notify.mobiles
data:
title: "Frigate Startup Failure"
message: "Frigate disk mount has failed"
data:
ttl: 0
car_ui: true
channel: "Important"
priority: high
# - service: notify.gmail
# data_template:
# title: "Frigate Startup Failure"
# message: "Frigate disk mount has failed"
- stop: "Frigate disk mount has failed"
- conditions:
- condition: state
entity_id: binary_sensor.samba_nas_running
state: "off"
- condition: state
entity_id: sensor.disk_use_percent_frigate
state: "unavailable"
sequence:
- service: notify.mobiles
data:
title: "Frigate Startup Failure"
message: "Frigate disk mount has failed"
data:
ttl: 0
car_ui: true
channel: "Important"
priority: high
- stop: "Frigate disk mount has failed"