Went i press the Switch to ON the relay go to OFF

The system is Backwards, all works “fine” but backwards, this happen only with the GPIO that are connected to the relays.

And went I restart the server all the relays connect to the Raspberry BEGGING in ON mode.

This is the code for the bottoms

Example configuration.yaml entry
switch:

  • platform: rpi_gpio
    ports:
    02: Button2
    03: Button3
    04: Button4
    05: Button5
    06: Button6
    07: Button7
    08: Button8
    09: Button9
    10: Button10
    11: Button11
    12: Button12
    13: Button13
    14: Button14
    15: Button15
    16: Button16
    17: Button17
    18: Button18
    19: Button19
    20: Button20
    21: Button21
    22: Button22
    23: Button23
    24: Button24
    25: Button25
    26: Button26

Hey Carlos and welcome to the Home Assistant community!

Please take a look at formatting your code (#11) since otherwise it’s sometimes hard to spot issues :slight_smile:
Looking at the docs this might be an easy fix:
Add invert_logic to your switch configuration (for example):

switch:
  - platform: rpi_gpio
    invert_logic: true
    ports:
# ...
1 Like

First, thanks for your fast answer, your solution was accurate! :white_check_mark:

Second,Thanks for the advice, I will read the section that you mentioned.

I was putting that line in the wrong area. Now my system is fully operational.