74hc595 switch no funkcion entities

Sorry for the bad English… (google translator)

I have a problem with esp8266 and 74hc595

After adding the device to home assistant, the switches behind the 74hc595 don’t work. Picture

I don’t know what to do and I couldn’t find anything on the internet that I’m missing. If something is missing, then HA

The code I have flashed …

sn74hc595:
  - id: 'sn74hc595_hub'
    data_pin: GPIO0
    clock_pin: GPIO2
    latch_pin: GPIO5

switch:
  - platform: gpio
    name: "Noc"
    id: OUT04
    pin:
      sn74hc595: sn74hc595_hub
      # Use pin number 0
      number: 0
      inverted: True
  - platform: gpio
    name: "Den"
    pin:
      sn74hc595: sn74hc595_hub
      number: 1
      inverted: True
  - platform: gpio
    name: "Korytnacka 1"
    pin:
      sn74hc595: sn74hc595_hub
      number: 2
      inverted: True
  - platform: gpio
    name: "Korytnacka 2"
    pin:
      sn74hc595: sn74hc595_hub
      number: 3
      inverted: True
  - platform: gpio
    name: "Vianocny Domcek"
    pin:
      sn74hc595: sn74hc595_hub
      number: 4
      inverted: True
  - platform: gpio
    name: "Rezerva 1"
    pin:
      sn74hc595: sn74hc595_hub
      number: 5
      inverted: True
  - platform: gpio
    name: "Rezerva 2"
    pin:
      sn74hc595: sn74hc595_hub
      number: 6
      inverted: True
  - platform: gpio
    name: "Rezerva 3"
    pin:
      sn74hc595: sn74hc595_hub
      number: 7
      inverted: True

Could someone help me?

You could try with different Gpio-pins, 0 and 2 have pullups.
For example Gpio12 / 13 / 14

Also, make sure OE pin is pulled low (GND).

I’ll try OE…

It might be worth mentioning that all outputs (relays) turn on at startup and then turn off beautifully according to the configuration. The strange thing is that only HA does not add entities to my list (to the entity list) and they cannot be controlled as seen in the picture.

Post your full yaml file.

If you removed the API line at a certain point in time, then HA will never know the state of your entities

this is definitely okay… I created a new file several times and also deleted it several times and created a new device again…

esphome:
  name: akvarium
  friendly_name: Akvarium

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "cAqedHcX4KbTdxOkT20cVFyszpy0Lq907Ql/Y+UTQEk="

ota:
  - platform: esphome
    password: "7a411121a48ac40a74694910dc492cd2"

wifi:
  ssid: "Home-Asisstant"
  password: "secret"

  manual_ip:
    # Set this to the IP of the ESP
    static_ip: xxx.yyy.zzz.18
    # Set this to the IP address of the router. Often ends with .1
    gateway: xxx.yyy.zzz.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Akvarium ERROR"
    password: "ZRaPADQ4Zkj0"

captive_portal:

# Example configuration entry
sn74hc595:
  - id: 'sn74hc595_hub'
    #type: spi
    data_pin: GPIO0
    clock_pin: GPIO2
    latch_pin: GPIO5
    oe_pin: GPIO4    ## stabilny pin (13)
    #sr_count: 2
    ##  GPIO2 -> srclk(11)    GPIO0 -> ser(14)  GPIO5 -> rclk(12)
i2c:
  sda: GPIO12
  scl: GPIO13
  scan: true

one_wire:
  - platform: gpio
    pin: GPIO14
#dallas:
#  - pin: 14

switch:
  - platform: gpio
    name: "Noc"
    id: OUT04
    pin:
      sn74hc595: sn74hc595_hub
      # Use pin number 0
      number: 0
      inverted: True
      mode: output
  - platform: gpio
    name: "Den"
    pin:
      sn74hc595: sn74hc595_hub
      number: 1
      inverted: True
  - platform: gpio
    name: "Korytnacka 1"
    pin:
      sn74hc595: sn74hc595_hub
      number: 2
      inverted: True
  - platform: gpio
    name: "Korytnacka 2"
    pin:
      sn74hc595: sn74hc595_hub
      number: 3
      inverted: True
  - platform: gpio
    name: "Vianocny Domcek"
    pin:
      sn74hc595: sn74hc595_hub
      number: 4
      inverted: True
  - platform: gpio
    name: "Rezerva 1"
    pin:
      sn74hc595: sn74hc595_hub
      number: 5
      inverted: True
  - platform: gpio
    name: "Rezerva 2"
    pin:
      sn74hc595: sn74hc595_hub
      number: 6
      inverted: True
  - platform: gpio
    name: "Rezerva 3"
    pin:
      sn74hc595: sn74hc595_hub
      number: 7
      inverted: True

doesn’t have gpio5 exposed

I would like to ask for a solution for HA …

PS: GPIO5 is pin 20 and that is also D1 → D1 MINI is D1 signal for shield relay…

In addition, after flashing, all outputs always light up (turn on) and then you can see how they quickly turn off gradually → I assume that the 74HC595 receives the correct data on all pins as it should

To avoid wrong solutions…

with this setting every steam relay is on

switch:
  - platform: gpio
    name: "Noc"
    id: OUT04
    pin:
      sn74hc595: sn74hc595_hub
      # Use pin number 0
      number: 0
      inverted: True
      mode: output
  - platform: gpio
    name: "Den"
    pin:
      sn74hc595: sn74hc595_hub
      number: 1
      inverted: False
  - platform: gpio
    name: "Korytnacka 1"
    pin:
      sn74hc595: sn74hc595_hub
      number: 2
      inverted: True
  - platform: gpio
    name: "Korytnacka 2"
    pin:
      sn74hc595: sn74hc595_hub
      number: 3
      inverted: False
  - platform: gpio
    name: "Vianocny Domcek"
    pin:
      sn74hc595: sn74hc595_hub
      number: 4
      inverted: True
  - platform: gpio
    name: "Rezerva 1"
    pin:
      sn74hc595: sn74hc595_hub
      number: 5
      inverted: False
  - platform: gpio
    name: "Rezerva 2"
    pin:
      sn74hc595: sn74hc595_hub
      number: 6
      inverted: True
  - platform: gpio
    name: "Rezerva 3"
    pin:
      sn74hc595: sn74hc595_hub
      number: 7
      inverted: False

After adding this example I went to try to remove and add a device and suddenly the entities appeared to be functional and working…

Solution (probably in case this happens to someone too)

turn off for at least 5 hours preflash random setup inverted: True/False