LCD PCF8574 stops working after power cycle

Hello everybody,
I have a 1602 LCD with PCF8574 connected to a nodemcu v3 (lolin).
When i run the yaml config everything works ok, i can see the information i want on the LCD but after a power cycle the LCD only shows black boxes on the first line.
I had to add a restart switch (switch: - platform: restart) and after i press it the LCD start showing the correct information.
Anybody know what is the cause and how to solve it?

I’m not going to be able to help because I’ve never used the LCD component, but neither is anyone else without seeing your config.

esphome:
  name: bloc
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "xxx"
  password: "xxxxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Bloc Fallback Hotspot"
    password: "b7iMi656DJFZ"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

#switch:
# - platform: gpio
#   name: "comutator"
#   pin: 5

# Example configuration entry
i2c:
  sda: D4
  scl: D3

display:
  - platform: lcd_pcf8574
    id: mydisplay
    dimensions: 16x2
    address: 0x27
    lambda: |-
      it.printf(0, 0, "Temp: %.1fc", id(temp).state);
      it.printf(0, 1, "Hum : %.1f  ", id(hum).state);
      it.printf(12, 0, "%.1f", id(temp_dorita));

# Example configuration entry
sensor:
  - platform: dht
    pin: D2
    model: DHT22
    temperature:
      id: temp
      name: "Temperatura baie"
      on_value:
        then:
          - if:
              condition:
                lambda: 'return id(temp).state < id(temp_dorita);'
              then:
                - output.turn_on: gpio_d7
              else:
                - output.turn_off: gpio_d7
    humidity:
      id: hum
      name: "Umiditate baie"
    update_interval: 60s

switch:
  - platform: restart
    name: "Restart ESP"
  - platform: template
    id: backlight
    name: "Lumina LCD"
    turn_on_action:
      - switch.template.publish:
          id: backlight
          state: ON
      - lambda: |-
          id(mydisplay).backlight();
    turn_off_action:
      - switch.template.publish:
          id: backlight
          state: OFF
      - lambda: |-
          id(mydisplay).no_backlight();

globals:
  - id: temp_dorita
    type: float
    initial_value: '19'

binary_sensor:
  - platform: gpio
    pin:
      number: D5
      mode: INPUT_PULLUP
    name: "creste temperatura"
    on_press:
      then:
        - lambda: 'id(temp_dorita) += 0.5;'

  - platform: gpio
    pin:
      number: D6
      mode: INPUT_PULLUP
    name: "scade temperatura"
    on_press:
      then:
        - lambda: 'id(temp_dorita) -= 0.5;'

output:
  - platform: gpio
    pin:
      number: D7
      inverted: True
    id: gpio_d7