Automation triggers multiple times at same time

Can’t for the life of me work out why, but the automation is triggering 3 times at the same time.

There is only one trigger, and a few conditions however when the automation runs, it runs 3 times, and one will always pass even if all conditions are failing to be met.

This is the yaml


alias: Current above next or average
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.agile_current_rate
condition:
  - condition: or
    conditions:
      - condition: template
        value_template: >
          {{ states('sensor.agile_current_rate')|float >
          states('sensor.agile_avg_rate')|float }}
      - condition: template
        value_template: "{{ states('sensor.owl_intuition_solar_exporting')|float > 400}}"
      - condition: template
        value_template: >
          {{ states('sensor.agile_current_rate')|float >
          states('sensor.agile_next_rate')|float }}
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.battery_settings
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.battery_settings
  - device_id: idhere!
    domain: mobile_app
    type: notify
    message: not charging
    title: above av or next
mode: single

Any ideas why this seems to be broken?

Does turning off the switch affect the sensor state?

Zoom in to the history graph for sensor.agile_current_rate at 3pm.

Also it looks to me like you could use three numeric state triggers (and no conditions) rather than triggering on every state change.

Thank you for your response.

No, turning off the switch does not affect the sensor state at all. Looking at the history, there is only one recorded log for sensor.agile_current_rate at 3pm.

So, if I have 3 triggers, do they work as an AND as AND and OR arent options for triggers.

thanks

A State Trigger will trigger when there’s a change in an entity’s state or any of its attributes. To limit the State Trigger to listen only for changes in the entity’s state, add the to: option with no value.


  - platform: state
    entity_id:
      - sensor.agile_current_rate
    to:

1 Like

And triggers are OR logic. Which is what you have chosen for your conditions.

2 Likes

thank you both, will give it a bash!