Need to a loop in a script

Hi,

I write a script which works fine.
it waters my garden : 15 minutes pump 1 then 15 minutes pump 2, not a big deal.
So the script lasts 30 minutes, I would like to call it automatically several times when the weather is pretty hot.

The number of time would be an input_slider.

Any idea ?

1 Like

Post the script…

Hi dxcoco2,

thanks for the reply.

Here is the script I’d like to run a couple of times (arrosage_start.yaml) :

alias : Choregraphie arrosage
sequence :
- service: switch.turn_off
  data:
      entity_id: group.arrosage
- service: switch.turn_on
  data:
      entity_id: switch.vanne_1
-  delay:
      seconds : 5
- service: switch.turn_on
  data:
      entity_id: switch.vanne_3
-  delay :
      minutes : 12
- service: switch.turn_off
  data :
      entity_id: group.arrosage
-  delay :
      seconds : 5
- service: switch.turn_on
  data :
      entity_id: switch.vanne_2
-  delay :
      seconds : 5
- service: switch.turn_on
  data :
      entity_id: switch.vanne_4
-  delay :
      seconds : 45
      minutes : 18
- service: input_boolean.turn_off
  data :
      entity_id: input_boolean.arrosage_start

Here is the service which calls the script (service_arrosage_start.yaml) : 
alias: "Lancer l'arrosage"
trigger:
- platform: state
  entity_id: input_boolean.arrosage_start
  from : 'off'
  to : 'on'
action:
- service: homeassistant.turn_on
  entity_id: script.arrosage_start
- service: notify.free_david
  data:
    message: Demarrage sequencement arrosage

I repeat my wish : I’d like to add an input_slider which number selected will be the number of times I execute my script arrosage_start.yaml.

Regards