Simple indicator that will have multiple conditions

Hello,

Im running frigate and I set automation alerts. I want to have simple indicator in my dashboard if all alerts are enabled. I know that I can create one card per alert like this:

image

But I want to combain conditions (I have like 6 alerts - 1 per camera) how can I get it working ?

Second thing. How can I create some kind of toggle button that will turn on / off all alerts ?

Hi @spec8320 and welcome to the community :smile:

Just to make sure I understand your need. The alerts you’re talking about are actually automations ?
→ You’re looking to show “something” only if a defined list of automation are all enabled ?
For this purpose, you could use the conditional card to show something only if all alert are enabled :

type: conditional
conditions:
  - condition: state
    entity: automation.alert_1
    state: "on"
  - condition: state
    entity: automation.alert_2
    state: "on"
card:
  type: markdown
  content: All alerts are enabled

This is just an idea since there is several ways to address it. You might want to list which alerts are enabled, or create a boolean entity which contains true if all alerts are enabled, false otherwise.
Many ideas depending on what would be your expected result.

Concerning the second point, assuming you’re talking about several automations that you’d like to turn on/off all together. There is an action (usable in scripts, or even directly through buttons) which can turn on, turn off, or toggle automations, see below an example :

action: automation.turn_{off | turn_on | toggle}
data: {}
target:
  entity_id:
    - automation.alert_1
    - automation.alert_2

Finally, assuming I understood your initial request, I think a nice way to handle this would be to create your own virtual switch in the yaml config.
Setting its state via templating to return truewhen all alerts are enabled, false otherwise.
Setting its turn_on and turn_offactions to turn on/off the automations.
This would allow to handle everything you’re looking for (assuming I got you right) in a single solution.

switch:
  - platform: template
    switches:
      frigate_alerts:
        value_template: "{{ is_state('automation.alert_1', 'on') && is_state('automation.alert_2', 'on')  }}"
        turn_on:
          action: automation.turn_on
          target:
            entity_id: 
              - automation.alert_1
              - automation.alert_2
        turn_off:
          action: automation.turn_off
          target:
            entity_id: 
              - automation.alert_1
              - automation.alert_2

You would end up with an entity that reflect exactly what you’re looking for (state true if all alerts are enabled, false otherwise) and switching it on or off would enable/disable all alerts.

Hope this help.
Cheers !

1 Like