Newbie question: Howto use relais board in automations?

Hi folks.

I´m absolutely new to HA. Maybe my question is too stupid but trust me that I spend some hours of “googeling” without success.
I have HA runing on RPI4 with cc2531 Stick for some Aquara sensors and have an 4port relais board connected.
This is in my configuration.yaml:

rpi_gpio:
switch:

  • platform: rpi_gpio
    ports:
    05: Relais01
    06: Relais02
    invert_logic: true

This gives 2 entities and they are usable in Lovelace board. So far so good.
But I can´t find any way to use these relais in automations…
(The main purpose of my setup is to distribute some water sensors in my house and control my water valve in case of any leakages.)

I would be very happy about a helpful tip.
Thanks in advance

Mathias

You can use the switch services in your automation actions to control them, e.g.

actions:
  - service: switch.toggle      # turn off relay 1 if it was on, otherwise turn it on.
    entity_id: switch.relais01
  - service: switch.turn_on     # turn on relay 2
    entity_id: switch.relais02
  - delay: 5                    # wait 5 seconds
  - service: switch.turn_off    # turn off relay 2
    entity_id: switch.relais02

Thank you very much for your fast response Tom. Now I´m on the right way I think…
But for beginners the first steps are not so easy. :wink:
Thanks again.

Mathias