Automating a dishwasher with conditions

I am fairly new to HA. Been running it for about 4 months to monitor my solar and energy, but now to try and integrate the rest of the systems it can see (playing and tinkering)

For my first automation, i have created one to start the dishwasher from a single button push in HA.
That all appears to work well. It turns on, selects the required programme and starts the operation.
Next step, i want to set a condition that it will only run if the solar battery is above 80% charge, or the time is within my off peak electricity window.
I have added the conditions as i think they should be, but it completely ignores the conditions and runs the dishwasher anyway.

Could anyone point the novice in the correct direction please?
If i can sort that bit out, getting really ambitious, i would like it to pause on the condition fail until the battery does exceed 80%, or the time window is meet (so i could trigger the dishwasher at 22:00 as i go to bed, but it wouldnt start until 00:30

alias: Run Dishwasher
description: ""
trigger: []
condition:
  - condition: or
    conditions:
      - condition: time
        after: "00:30:00"
        before: "03:00:00"
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
          - sun
      - condition: numeric_state
        entity_id: sensor.battery_soc
        above: 80
        below: 99
action:
  - type: turn_on
    device_id: 81cb98f4b68f79dfbd4a5e2a2540f5a5
    entity_id: switch.401070425728006747_bsh_common_setting_powerstate
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - device_id: 81cb98f4b68f79dfbd4a5e2a2540f5a5
    domain: select
    entity_id: select.401070425728006747_programs
    type: select_option
    option: Dishcare.Dishwasher.Program.Eco50
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - device_id: 81cb98f4b68f79dfbd4a5e2a2540f5a5
    domain: button
    entity_id: button.401070425728006747_start_pause
    type: press
mode: single

TIA

If when you post yaml, place ``` before and after the code and it will format it correctly so its easier for people to read.

You dont appear to have any trigger on the above automation?

Also, how are you triggering it? as if you click run automation via the UI rather than via an actual trigger the automation will run and ignore all conditions.

Thanks, i have updated the post to show the coding

I have a button in a Dashboard to trigger the automation, as that was the only way i could work out how to fire it, so i guess i need to go back a step first.

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: automation.trigger
  target:
    entity_id: automation.run_dishwasher
  data:
    skip_condition: true
entity: input_button.dishwasher_start

From the docs

You must have a trigger for an automation. Otherwise move your conditions and actions into a script, then call the script from your button.

Add a button helper, show that button on the front end and use the state of that button helper to trigger the automation.

EDIT: Or what @Didgeridrew said :point_up_2:

I guess that’s your problem.

That’s not good practice with automations. Work out a combination of triggers and conditions that allow for “instant evaluation”. For example, trigger on the battery SoC going above 80% and on the time, with conditions to match.

Perhaps have the front end set an input boolean (toggle) helper, then use the state of that as one of the triggers.

Sorry, but this is where i got lost.
I have a button helper already, but trying to tie A to B to C i think is where i have got lost and i never ended up using it.

The button helper has an entity of input_button.dishwasher_start
So do i put this as the trigger in the Automation and then use the frontend button to trigger the entity?

I havent even started looking at scripts yet :open_mouth:

Yes.

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: input_button.press
  target:
    entity_id: input_button.dishwasher_start 
entity: input_button.dishwasher_start
alias: Run Dishwasher
description: ""
trigger:
  - platform: state
    entity: input_button.dishwasher_start
condition:
  - condition: or
    conditions:
      - condition: time
        after: "00:30:00"
        before: "03:00:00"
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
          - sun
      - condition: numeric_state
        entity_id: sensor.battery_soc
        above: 80
        below: 99
action:
  - type: turn_on
    device_id: 81cb98f4b68f79dfbd4a5e2a2540f5a5
    entity_id: switch.401070425728006747_bsh_common_setting_powerstate
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - device_id: 81cb98f4b68f79dfbd4a5e2a2540f5a5
    domain: select
    entity_id: select.401070425728006747_programs
    type: select_option
    option: Dishcare.Dishwasher.Program.Eco50
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - device_id: 81cb98f4b68f79dfbd4a5e2a2540f5a5
    domain: button
    entity_id: button.401070425728006747_start_pause
    type: press
mode: single

Thank you
i’ll test that later

Thank you, i’ll look into this.
As i said, its a little ambitious, as i’ll be going further down the rabbit hole. Bit of a steep learning curve this programming.

Thank you all for the assistance
The basics is now working, so it wont trigger unless the conditions are met.

Now to read up on scripts and see if i can get it to pause the start until the conditions are met