Newbie + bash script + pi relay board + on/off specific days

Hi everyone,

I just installed the Home Assistant and while reading the docs got a bit confused.
Can someone please just tell me on a very high logical level how this can be implemented and then I can read / do the deep dive and implement my little project by myself?
Initial data:

  • raspberry PI + PI Relay Board + I connected a pump on the relay
  • a bash script does echo in /sys…/gpio/… and can switch the relay on/off as such
  • I need the relay to be switched on on certain days of the week (that I can choose graphically from the GUI) for a predefined customizable amount of time (also in the GUI)

Dilemmas:

  • where to start
  • should I make one script for ON, one script for OFF
  • can I embed in the automation logic “run script with ON” (script will return immediately) + “wait 10 min” + “run script with OFF” or what approach should I use ?
  • if I do this point then will I not get false positives in the GUI ? (showing that the script is OFF when in fact I did ON and I am just during the waiting period; given that the switch returns immediately after doing ON I’d say I would get a “false negative” in the GUI claiming it is off)

From pure logic / design what would be the most optimal way to design this?

Thank you and sorry for really being completely confused at the moment.

In the meantime I managed to read a bit about the concepts of Home Assistant.
As such the general overview/concept I implemented is the following:

  • I created a switch that sent a signal on a certain GPIO pin thus switching my relay (for the pump) to ON
  • I created a script that did: switch on, delay X minutes (X = variable I passed to it), switch off
  • I took the alarm clock (+ its dashboard) from here:
    How to create the alarm clock in HASS?
  • That alarm code came with a trigger that was fired when the current day + hour:minutes match what I had set via the Dashboard
    That trigger called the script for my switch and with 5 minutes.