Automation section executed twice

Not sure if it is an issue or a weird situation.

Basically, I am adding a custom log to track some specific actions, mainly to easily analyze some automation executions.

I created a script to save this on the logs.

The problem is I am seeing duplicated entries on the log for a single execution:

automation yaml:

alias: SCHEDULE - Riego Rain Factor 11:55PM
description: ""
trigger:
  - platform: time
    at: "23:55:00"
condition: []
action:
  - if:
      - condition: numeric_state
        entity_id: sensor.l0bit0netatmoext_rain_precipitation_today
        above: 1
    then:
      - data: {}
        target:
          entity_id: input_boolean.riego_rain_factor
        action: input_boolean.turn_on
      - action: script.action_add_event_log
        metadata: {}
        data:
          log_message: "ON"
          log_tittle: RainFactor
    else:
      - metadata: {}
        data: {}
        target:
          entity_id: input_boolean.riego_rain_factor
        action: input_boolean.turn_off
      - action: script.action_add_event_log
        metadata: {}
        data:
          log_tittle: Rain Factor
          log_message: "OFF"
mode: single

Script yaml

alias: ACTION - Add LogBook Log
sequence:
  - action: logbook.log
    metadata: {}
    data:
      name: "{{ log_tittle }}"
      message: "{{ log_message }}"
      entity_id: input_text.custom_log_l0bit0
description: ""
fields:
  log_tittle:
    selector:
      text: null
    name: Log_Tittle
  log_message:
    selector:
      text: null
    name: Log_Message

logbook entries:
image

I expected a single line on the logbook. I am missing anything?

Thanks

Hi L0bit0,

I’m not sure. It shouldn’t be happening that quick that it double-taps, and I don’t see it in the code.

An easy fix or check if it is just double-tapping, add a 5 second delay at the end as another action before it’s done. I had to do that with a blueprint for my Aqara cubes bc they would sometimes double-tap and run 2x messing things up.

wird thing is some times it show 2 entries, and others 3 or even more…

I will create a simple script just to add an event log and lets see adding more functionality progressively till I found the issue… i think could be on the “IF” clause… as other scripts looks good.

I tried to reproduce the issue and I can not anymore. :pensive:

only thing I see it can affect is the way to call service input Boolean on/off I used is different

Option 1: using Input Boolean turn ON

  - action: input_boolean.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.riego_rain_factor

Option 2: perform Action Input Boolean turn ON

  - action: input_boolean.turn_on
    target:
      entity_id: input_boolean.riego_rain_factor
    data: {}

As syntax is slightly different.

Anyway, I tried with diferent options and was not able to reproduce (even using same YAML on this post)…

I will keep chcking next executirons in case issu happens again.

NOTE: i do not even restart home assistant from yesterday today.

thansk