Alert with condition

Been trying to find out if its possible to set up an alert based on a condition. I have read other similar post, but so far no luck.

The case:
I would like an alert if my garage door is open, but only if a boolean is off.

Could I somehow set this up as a binary sensor with a template stating that the binary sensor is off if door is open and boolean is on, and on if door is open and boolean is off. This way the alert can trigger if the binary sensor is on. And how do one write this template?

Yes using a template binary sensor would be the way to go. What are your entity_ids for the door and input_boolean?

You might also want to think of an alert automation that contains the check for the boolean within a simple condition.

input_boolean.bryggedag
and
binary_sensor.garasjedor

Do you have an example of how this would look like?

binary_sensor:
  - platform: template
    sensors:
      garage_alert_sensor:
        friendly_name: "Garage Alert Sensor"
        value_template: "{{ is_state('input_boolean.bryggedag', 'off') and is_state('binary_sensor.garasjedor', 'on') }}"

The sensor to use in your alert will be binary_sensor.garage_alert_sensor

Thank you so much! I will test this when back home tonight!

Sure. Without testing, an automation could look like:

  - alias: "Garage door open alert"
    trigger:
      platform: state
      entity_id: binary_sensor.garasjedor
      to: 'on'
    condition:
      condition: state
      entity_id: input_boolean.bryggedag
      state: 'off'
    action:
      # alert

That’s not how alerts work. That would require a notification service. Different beastie.

There’s always more than one way to skin a cat. @mrhaugland was asking me for an automation example.

He was also asking about alerts, which you don’t control with automations. Though admittedly he may have been confusing ‘notification’ with ‘alert’

Thank you both. I was indeed asking for alerts, but always interested to know if there are other ways. So thanks for the automation example. I was under the impression that an automation would require notification, not alert, and then I would need a repeated notification.

That’s correct.