Automation trigger does not kicking in

Hi,

I am trying to automatically start my washing machine when my solar panels charge external battery to min 25%

I have added that trigger:


wait_for_trigger:
  - trigger: numeric_state
    entity_id:
      - sensor.master_battery
    above: 25
continue_on_timeout: true
timeout:
  hours: 0
  minutes: 30
  seconds: 0
  milliseconds: 0

The problem is that script not picking up that battery is already above 25% and starts only when timeout is kicked in.

this is from trace:

Wykonano: 17 czerwca 2025 10:30:36
Wynik:

result: true
state: 30

The numeric state above X trigger only fires when IT CROSSES the threshold you’ll need to find something other to trigger on.

what do you mean by crosses ?

It does not fire Because it is now above or below the it fires because the state crossed from above to below or via e versa. It’s a threshold.

It will fire once the moment it crosses from x to y.

If instead it was already y… It never crossed anything. So nothing happens.

1 Like

Please post the complete automation. What you have posted is just a Wait action… which will only be executed after an actual trigger and any conditions you have.

Here is full automation

alias: Codzienny cykl zmywarki
description: ""
triggers:
  - trigger: time
    at: "08:30:00"
conditions:
  - condition: state
    entity_id: sensor.dishwasher_door
    state: closed
actions:
  - wait_for_trigger:
      - trigger: numeric_state
        entity_id:
          - sensor.master_battery
        above: 25
    continue_on_timeout: true
    timeout:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - repeat:
      sequence:
        - action: switch.turn_on
          metadata: {}
          data: {}
          target:
            entity_id: switch.dishwasher_power
        - delay:
            hours: 0
            minutes: 0
            seconds: 20
            milliseconds: 0
      until:
        - condition: state
          entity_id: switch.dishwasher_power
          state: "on"
  - action: select.select_option
    metadata: {}
    data:
      option: dishcare_dishwasher_program_pre_rinse
    target:
      entity_id: select.dishwasher_active_program
  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
  - if:
      - condition: state
        entity_id: switch.v_kd_req_wash
        state: "on"
    then:
      - action: select.select_option
        metadata: {}
        data:
          option: dishcare_dishwasher_program_auto_2
        target:
          entity_id: select.dishwasher_active_program
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.v_kd_req_wash
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.zmywarka_do_wypakowania
mode: single

So better than trigger is to use a loop where battery level is checked and loop kicks some time of delay if percent is lower than set ?

something like this:

repeat:
  sequence:
    - delay:
        hours: 0
        minutes: 10
        seconds: 0
        milliseconds: 0
  until:
    - condition: numeric_state
      entity_id: sensor.master_battery
      below: 25

I would have the battery as the trigger and a time condition of after: 8:30 as a condition.
That will be the same thing but there is no waiting.

And no… don’t loop.

EDIT:

So like this:

alias: Codzienny cykl zmywarki
description: ""
triggers:
  - trigger: numeric_state
    entity_id: sensor.master_battery
    above: 25
conditions:
  - condition: state
    entity_id: sensor.dishwasher_door
    state: closed
  - condition: time
    after: "08:30:00"
actions:
  - repeat:
      sequence:
        - action: switch.turn_on
          metadata: {}
          data: {}
          target:
            entity_id: switch.dishwasher_power
        - delay:
            hours: 0
            minutes: 0
            seconds: 20
            milliseconds: 0
      until:
        - condition: state
          entity_id: switch.dishwasher_power
          state: "on"
  - action: select.select_option
    metadata: {}
    data:
      option: dishcare_dishwasher_program_pre_rinse
    target:
      entity_id: select.dishwasher_active_program

########
All above is fine but having a delay for 20 minutes is not adviced.
Is there any other way you could do this then that would be better.
########

  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
  - if:
      - condition: state
        entity_id: switch.v_kd_req_wash
        state: "on"
    then:
      - action: select.select_option
        metadata: {}
        data:
          option: dishcare_dishwasher_program_auto_2
        target:
          entity_id: select.dishwasher_active_program
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.v_kd_req_wash
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.zmywarka_do_wypakowania
mode: single

Bu according to what NathanCu said, if battery state will be higher than 25 before 8:30 cycle will not happen, while it should, right?

Yes you are right…
Sorry.

You need

alias: Codzienny cykl zmywarki
description: ""
triggers:
  - trigger: time
    at: "08:30:00"
  - trigger: numeric_state
    entity_id:
      - sensor.master_battery
    above: 25
conditions:
  - condition: state
    entity_id: sensor.dishwasher_door
    state: closed
  - condition: time
    after: "08:30:00"
  - condition: numeric_state
    entity_id: sensor.master_battery
    above: 25
actions:
  - repeat:
      sequence:
        - action: switch.turn_on
          metadata: {}
          data: {}
          target:
            entity_id: switch.dishwasher_power
        - delay:
            hours: 0
            minutes: 0
            seconds: 20
            milliseconds: 0
      until:
        - condition: state
          entity_id: switch.dishwasher_power
          state: "on"
  - action: select.select_option
    metadata: {}
    data:
      option: dishcare_dishwasher_program_pre_rinse
    target:
      entity_id: select.dishwasher_active_program
  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
  - if:
      - condition: state
        entity_id: switch.v_kd_req_wash
        state: "on"
    then:
      - action: select.select_option
        metadata: {}
        data:
          option: dishcare_dishwasher_program_auto_2
        target:
          entity_id: select.dishwasher_active_program
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.v_kd_req_wash
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.zmywarka_do_wypakowania
mode: single
1 Like

Thank you - have place this one in test and will see how it worked tomorrow - will let you know - anyway - thank you for your time and look into this :slight_smile:

It looks like it kicks in well - thank you all for help me understand how it works :slight_smile:

1 Like