Script with checkbox and custom input time

Hello!

I have a complicate question. I think.

So, lets begin.
My parents are farmers. Im running over MQTT (Arduino Mega + Ethernet Shield + 16 Relay Board) an automation to water vegetables.

1-9 relays - drip hoses with solenoids. (switch.d1 - switch.d9)
16 - PUMP (switch.d16)

I made an script to Run all 9 - one by one with 30 min runtime, 1 min overlay when switching from lets say 1 to 2 (avoiding switching too fast and ruin the pump). But this script is not what we really need this days because in few greenhouses we got tomates, few got cucumber and so on. The tomatoes needs more water than others, maybe some days we dont need to water cucumbers and only tomatoes.

Now - i need a script with “inputs?”

  1. My parents want to select in the morning with a checkbox what greenhouses to water.
  2. They want to set custom time - if its too hot outside, they want to set 1 hour and not 30 minutes.

How can i do that? I searched alot and im not sure its achievable. But if it is, it will be awesome.

Thanks in advance!

You’ll have to add some input helpers. These are entities whose state is entered by the user in the UI.

You can use their states in templates in your automation.
For example

  action:
    - service: timer.start
      target:
        entity_id: timer.your_timer
      data:
        duration: '{{ states("input_number.time_minutes")|int * 60 }}'
1 Like

Im gonna test it and post my code here if working. Thank you so much!

As above, use some helpers.

Also, check out my thread it may help.

1 Like