[SOLVED] Trying to understand automation triggering

I have an automation that is supposed to generate an alert whenever a sensor is below a certain value, but it never gets triggered even though that sensor is always below that value. The sensor is defined in configuration.yaml as follows:

- platform: command_line
  name: "Test command"
  unit_of_measurement: days
  scan_interval: 120
  command: "bash /home/homeassistant/.homeassistant/scripts/mycommand.sh"

At present, the bash script contains only the following command:

echo 8

The badge for the sensor appears as expected on the Home page, and it shows the value of that sensor is 8. I configured the following in automation.yaml:

- alias: "Test Command Alert"
  trigger:
    entity_id: sensor.test_command
    platform: numeric_state
    below: 10
  action:
    data:
      message: "This is a test. Did it work?"
      title: "Test Message"
    service: persistent_notification.create

Since the value of the sensor is always below 10, I expect a persistent notification to appear every two minutes, but the only time one is generated is when I trigger the automation manually.

I’m wondering if that automation is edge triggered, i.e., that it is triggered only when there is a change in the value of the sensor, similar to the way in which an interrupt would be handled. Are automations static until other evens occur? Can they be scheduled to perform their tests similar to the way that sensors are scheduled to perform theirs?

Why is that automation never triggered? I’ll be grateful for any help with this.

It will only be triggered when it changes from above 8 to below so if it’s perpetually below 8 it won’t even be triggered.

1 Like

Thanks, @DavidFW1960. I tested it by first generating a value of 10, and then changing it to 8. That fired the automation. Automations are triggered when a value changes and meets the condition of the test. Unless I’m mistaken, this makes them similar to interrupts.