Esphome bk7231n relay on at boot

I have a problem with gpio p23 name Pulsante.
If set inverted true on boot turn on the relay but I set ALWAYS_OFF.

esphome:
  name: uv_drink_water
  friendly_name: UV Drink Water

bk72xx:
  board: generic-bk7231n-qfn32-tuya

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true
  ap:
    ssid: ${device_name}
    password: !secret ap_password

logger:

web_server:
  port: 80
  auth:
    username: admin
    password: !secret web_server_password

time:
  - platform: homeassistant
    id: homeassistant_time

api:
  encryption:
    key: !secret api_encryption_key

ota:
  password: !secret ota_password

switch:
  - platform: gpio
    id: relay
    name: "Relay"
    pin: P7
    restore_mode: ALWAYS_OFF

binary_sensor:
  - platform: gpio
    pin:
      number: P6
      inverted: true
    name: Sensore Di Flusso
    id: sensore_di_flusso
    filters:
      - delayed_off: 2min
    on_press:
      then:
        - switch.turn_on:
            id: relay
    on_release:
      then:
        - switch.turn_off:
            id: relay
  - platform: gpio
    name: Pulsante
    pin:
      number: P23
      inverted: true 
    on_click:
      min_length: 50ms
      max_length: 2s
      then:
        - switch.turn_on: relay

Is it supposed to be inverted? What is triggering the relay? Is it the actual gpio switch of the relay or is it 1 of tbe 2 binary sensor gpio’s floating. They’re turn_on action is to turn on Relay…

You need to look at the logs and see what is turning the relay On. Is the relay active high or active low? Have you tried using a pull-up/pull down?

What have you tried to do to fix the problem?
What device is this even for? You know we arent psychics in here, right?

If you dont provide any useful information then the best your going to get are everyone taking a guess and making you run around in circles following everyones guesses.

1 Like