lilp69
(lilp)
August 26, 2024, 9:53am
1
Hi,
I have three automations.
To be more clear on my automations, I wish to regroup those 3 in 1.
The automations :
alias: Désactivation autres mode alarmes Présence
description: Désactive les autres modes d'alarmes Présence
trigger:
- platform: state
entity_id:
- automation.frigate_notifications
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: automation.frigate_notifications
state: "on"
sequence:
- metadata: {}
data:
stop_actions: true
target:
entity_id:
- automation.frigate_night
- automation.frigate_away
action: automation.turn_off
mode: single
alias: Désactive les autres modes d'alarmes Away
description: Désactive les autres modes d'alarmes Away
trigger:
- platform: state
entity_id:
- automation.frigate_away
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: automation.frigate_away
state: "on"
enabled: true
sequence:
- metadata: {}
data:
stop_actions: true
target:
entity_id:
- automation.frigate_night
- automation.frigate_notifications
action: automation.turn_off
mode: single
alias: Désactive les autres modes d'alarmes Night
description: Désactive les autres modes d'alarmes Night
trigger:
- platform: state
entity_id:
- automation.frigate_night
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: automation.frigate_night
state: "on"
sequence:
- metadata: {}
data:
stop_actions: true
target:
entity_id:
- automation.frigate_away
- automation.frigate_notifications
action: automation.turn_off
mode: single
I try to regroup in this one :
alias: Désactivation automatique des autres alarmes
description: Désactive les autres modes d'alarmes
trigger:
- platform: state
entity_id:
- automation.frigate_notifications
- platform: state
entity_id:
- automation.frigate_away
- platform: state
entity_id:
- automation.frigate_night
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: automation.frigate_notifications
state: "on"
sequence:
- metadata: {}
data:
stop_actions: true
target:
entity_id:
- automation.frigate_night
- automation.frigate_away
action: automation.turn_off
- conditions:
- condition: state
entity_id: automation.frigate_away
state: "on"
sequence:
- action: automation.turn_off
metadata: {}
data:
stop_actions: true
target:
entity_id:
- automation.frigate_night
- automation.frigate_notifications
- conditions:
- condition: state
entity_id: automation.frigate_night
state: "on"
sequence:
- action: automation.turn_off
metadata: {}
data:
stop_actions: true
target:
entity_id:
- automation.frigate_notifications
- automation.frigate_away
But automations not working, and I’ve this message :
Stopped because only a single execution is allowed
Hellis81
(Hellis81)
August 26, 2024, 10:01am
2
Automations shouldn’t be turned on and off like this.
Either you should use scripts or you should add conditions to limit when the automation runs.
Either way, what you have created looks like a big mess.
We need to start from the beginning.
Post all the relevant automations.
lilp69
(lilp)
August 26, 2024, 11:49am
3
Automations are:
alias: Frigate Away
description: Notification Frigate away
use_blueprint:
path: SgtBatten/Stable.yaml
input:
camera: camera.r4252_smart_outdoor_camera_2
notify_device: 1336b603037d01a61d6de3e445a6d7f4
message: Un {{label}} a été détecté dehors
attachment: snapshot
update_thumbnail: true
icon: mdi:cctv
disable_times: []
labels:
- person
- dog
- cat
silence_timer: 1
title: Alerte mouvement
alias: Frigate Night
description: Alertes Frigate la nuit
use_blueprint:
path: SgtBatten/Stable.yaml
input:
camera: camera.r4252_smart_outdoor_camera_2
notify_device: 1336b603037d01a61d6de3e445a6d7f4
message: Un mouvement a été détecté dehors
attachment: snapshot
update_thumbnail: true
icon: mdi:cctv
disable_times: []
labels:
- person
silence_timer: 1
alias: Frigate Présence
description: Notification Frigate lors de la présence
use_blueprint:
path: SgtBatten/Stable.yaml
input:
camera: camera.r4252_smart_outdoor_camera_2
notify_device: 1336b603037d01a61d6de3e445a6d7f4
message: Un mouvement a été détecté dehors
attachment: snapshot
update_thumbnail: true
icon: mdi:cctv
disable_times:
- "0"
- "1"
- "2"
- "3"
- "4"
- "5"
- "6"
- "7"
- "8"
- "23"
labels:
- dog
- cat
silence_timer: 1
alias: Notification Frigate Away
description: ""
trigger:
- platform: state
entity_id:
- automation.frigate_away
from: "off"
to: "on"
- platform: state
entity_id:
- automation.frigate_away
from: "on"
to: "off"
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: automation.frigate_away
state: "off"
sequence:
- data:
title: Alarme absence
message: |
L'alarme a été désactivé en mode absence.
action: script.notify
- conditions:
- condition: state
entity_id: automation.frigate_away
state: "on"
sequence:
- data:
title: Alarme absence
message: |
L'alarme a été activé en mode absence.
action: script.notify
mode: single
alias: Alarm
description: Alarme
trigger:
- platform: state
entity_id:
- binary_sensor.detecteur_ouverture_porte_baie_vitree_contact
from: "off"
to: "on"
condition:
- condition: state
entity_id: automation.frigate_away
state: "on"
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_cat_count
state: "1"
sequence:
- data:
title: Mouvement détecté
message: >
Mouvement détecté: {{
states('sensor.r4252_smart_outdoor_camera_cat_count') }}
personne détectée. {{
states('image.r4252_smart_outdoor_camera_person') }}
action: script.notify
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_dog_count
state: "1"
sequence:
- data:
title: Mouvement détecté
message: >
Mouvement détecté: {{
states('sensor.r4252_smart_outdoor_camera_cat_count') }}
personne détectée.
action: script.notify
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_person_count
state: "1"
sequence:
- data:
title: Mouvement détecté
message: >
Mouvement détecté: {{
states('sensor.r4252_smart_outdoor_camera_cat_count') }}
personne détectée.
action: script.notify
alias: Activation auto alarme nuit
description: Activation auto alarme nuit
trigger:
- platform: time
at: "23:00:00"
- platform: time
at: "06:00:00"
condition:
- condition: state
entity_id: automation.frigate_away
state: "off"
action:
- choose:
- conditions:
- condition: time
after: "23:00:00"
before: "06:00:00"
sequence:
- target:
entity_id: automation.frigate_notifications
data:
stop_actions: true
action: automation.turn_off
- target:
entity_id:
- automation.frigate_night
data: {}
action: automation.turn_on
- if:
- condition: state
entity_id: automation.frigate_night
state: "on"
then:
- metadata: {}
data:
title: Alarme nuit activée
message: Alarme activée
action: script.notify
else:
- metadata: {}
data:
title: Alarme nuit non activée
message: Alarme non activée
action: script.notify
- conditions:
- condition: time
after: "06:00:00"
before: "23:00:00"
sequence:
- target:
entity_id:
- automation.frigate_night
data:
stop_actions: true
action: automation.turn_off
- target:
entity_id:
- automation.frigate_notifications
data: {}
action: automation.turn_on
- if:
- condition: state
entity_id: automation.frigate_notifications
state: "on"
then:
- metadata: {}
data:
title: Alarme présence activée
message: Alarme activée
action: script.notify
else:
- metadata: {}
data:
title: Alarme présence non activée
message: Alarme non activée
action: script.notify
mode: single
On my dashboard, to enable each alarm mode :
- type: custom:bubble-card
card_type: separator
name: Alarme
icon: mdi:alert
- type: horizontal-stack
cards:
- type: custom:button-card
entity: automation.frigate_away
show_name: true
name: Away
color_type: card
color: rgb(66, 134, 244)
icon: mdi:shield-lock
state:
- value: 'on'
color: green
- value: 'off'
color: red
- type: custom:button-card
entity: automation.frigate_night
color_type: card
color: rgb(66, 134, 244)
icon: mdi:shield-moon-outline
show_name: true
name: Nuit
state:
- value: 'on'
color: green
- value: 'off'
color: red
- type: custom:button-card
entity: automation.frigate_notifications
color_type: card
size: 50%
show_name: true
name: Mode maison
color: rgb(66, 134, 244)
icon: mdi:shield-account-variant
state:
- value: 'on'
color: green
- value: 'off'
color: red
Yes, it’s a big mess.
If you’ve solution to clean this, I’ll be happy.
danleongjy
(Daniel Leong)
August 26, 2024, 12:13pm
4
If I understand your intention, you have 3 automations and you only want one of them to be enabled at any given time? You are getting “only a single execution is allowed” because your automation mode is single
, and the automation changes the states of the 3 automations and triggers upon the state change of the 3 automations. I.e. the automation executing the actions causes itself to trigger again. And the automation instance that runs (eg. the one that was due to an automation being turned off) may prevent the one you are interested in (i.e. the one that is aware of which specific automation is on) from running.
To avoid this, I’d suggest to use an input_select
with options 'Away, ‘Night’ and ‘Notifications’. Then your automation would trigger on the state changes of the input_select
but act on the automations
:
trigger:
- platform: state
entity_id: input_select.xxx
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.xxx
state: Away
sequence:
- action: automation.turn_off
target:
entity_id:
- automation.frigate_night
- automation.frigate_notifications
- conditions:
- condition: state
entity_id: input_select.xxx
state: Night
sequence:
- action: automation.turn_off
target:
entity_id:
- automation.frigate_away
- automation.frigate_notifications
- conditions:
- condition: state
entity_id: input_select.xxx
state: Notifications
sequence:
- action: automation.turn_off
target:
entity_id:
- automation.frigate_night
- automation.frigate_away
Personally, I turn automations on and off all the time with no issues. But it is important that you are aware of what you are doing, and that the automations don’t take too long to execute (otherwise you may interrupt an in-progress automation with unexpected results).
lilp69
(lilp)
August 26, 2024, 12:28pm
5
I create the input select, and the automations. But when, I click on alarm mode, other mode doesn’t disable :
alias: Test alarm
description: ""
trigger:
- platform: state
entity_id:
- input_select.alarm
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.alarm
state: Away
sequence:
- action: automation.turn_off
target:
entity_id:
- automation.frigate_night
- automation.frigate_notifications
data:
stop_actions: true
- conditions:
- condition: state
entity_id: input_select.alarm
state: Night
sequence:
- action: automation.turn_off
target:
entity_id:
- automation.frigate_away
- automation.frigate_notifications
data:
stop_actions: true
- conditions:
- condition: state
entity_id: input_select.alarm
state: Notifications
sequence:
- action: automation.turn_off
target:
entity_id:
- automation.frigate_night
- automation.frigate_away
data:
stop_actions: true