ESP avec Nextion

Mon problème

J’ai toujours le même message d’erreur dans mes log : Nextion is not connected !
J’ai essayé avec un autre ecran Nextion - un autre ESP8266 … désinstatallé l’Addons ESP Home …
Rien ne change !

Une idée ?

Ma configuration


System Information

version core-2022.9.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.5
os_name Linux
os_version 5.15.32-v8
arch aarch64
timezone Europe/Brussels
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4351
Installed Version 1.27.2
Stage running
Available Repositories 1115
Downloaded Repositories 106
Home Assistant Cloud
logged_in true
subscription_expiration 6 septembre 2023 à 02:00
relayer_connected true
remote_enabled true
remote_connected true
alexa_enabled false
google_enabled true
remote_server eu-central-1-2.ui.nabu.casa
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 8.5
update_channel stable
supervisor_version supervisor-2022.08.6
agent_version 1.2.1
docker_version 20.10.14
disk_total 232.2 GB
disk_used 62.2 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons MariaDB (2.5.1), File editor (5.4.1), AirSonos (3.4.1), Node-RED (13.4.0), Studio Code Server (5.4.0), DahuaVTO2MQTT (1.0.2), Samba share (10.0.0), Mosquitto broker (6.1.3), Terminal & SSH (9.6.1), Home Assistant Google Drive Backup (0.108.4), Zigbee2MQTT (1.27.2-1), ESPHome (2022.8.3)
Dashboards
dashboards 3
resources 80
views 34
mode storage
Recorder
oldest_recorder_run 9 septembre 2022 à 13:28
current_recorder_run 19 septembre 2022 à 12:44
estimated_db_size 1455.25 MiB
database_engine mysql
database_version 10.6.8
Spotify
api_endpoint_reachable ok
___

### Mon FICHIER YAML ###

esphome:
  name: esp-ecran-lit
  platform: ESP8266
  board: d1_mini
  on_boot:
    priority: 250
    then:
      - lambda: |-
          id(nextionD).goto_page("Starting");
          id(page_id) = 0;
  on_loop:
    - if:
        condition:
          wifi.connected:
        then:
          - lambda: |-
              if(id(page_id) == 0){
                id(nextionD).set_component_text("wifi", "Connexion au WiFi Reussi !");
              }
    - if:
        condition:
          api.connected:
        then:
          - lambda: |-
              if(id(page_id) == 0){
                id(nextionD).set_component_text("hassio", "Connexion à Home Assistant Réussi !");
                delay(500);
                id(nextionD).goto_page("Accueil");
                id(page_id) = 2;
                
              }

# Enable Home Assistant API

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails

    
 
captive_portal:
logger:
  level: DEBUG
api:
  services:
      - service: toggle
        variables: 
          state: bool
        then:
          - lambda: |-
              if(state){
                id(page_id) = 2;   
                id(nextionD).goto_page("Accueil");
                id(nextionD).update();
              }else{
                id(page_id) = 1;
                id(nextionD).goto_page("OFF");
                id(nextionD).update();
              }
      - service: brightness
        variables: 
          brightness: float
        then:
          - lambda: |-
              id(nextionD).set_backlight_brightness(brightness);

ota:

switch:
  - platform: restart
    id: reboot_esp

globals:
  - id: page_id
    type: int
    initial_value: "99"

sensor:
  - platform: homeassistant
    id: today_icon
    entity_id: sensor.today_icon

  - platform: homeassistant
    id: alarm_h
    entity_id: sensor.alarm_h

  - platform: homeassistant
    id: alarm_m
    entity_id: sensor.alarm_m

  - platform: wifi_signal
    id: wifi_info
    update_interval: 60s

  - platform: uptime
    id: uptime_esp
    filters:
      #set to H
      - lambda: return x/3600;
    unit_of_measurement: "h"


binary_sensor:
  - platform: homeassistant
    id: timerState
    entity_id: automation.reveil

  - platform: homeassistant
    id: timerAutoState
    entity_id: automation.18_reveil_automatique

    

#**************************************************NEXTION Buttons************************************************

#___________________________________Page 0___________________________________

#___________________________________Page 1___________________________________
#-----------------------------Turn ON ------------------------------
  - platform: nextion
    page_id: 1
    component_id: 0
    id: turn_on
    on_state:
      then:
        - homeassistant.service:
            service: script.chambre_on
        - delay: 1s
        - lambda: |-
            id(page_id) = 2;

#___________________________________Page 2___________________________________
#-----------------------------Turn OFF -----------------------------
  - platform: nextion
    page_id: 2
    component_id: 2
    id: powerOFF
    on_state:
      then:
        - homeassistant.service:
            service: script.chambre_off
        - lambda: |-
            id(page_id) = 1;
            id(nextionD).update();

#-----------------------------Timer Page ---------------------------
  - platform: nextion
    page_id: 2
    component_id: 6
    id: timerB
    on_state:
      lambda: |-
        id(nextionD).goto_page("Reveil");
        id(page_id) = 3;
        id(nextionD).update();
        id(nextionD).set_component_value("alarmH", id(alarm_h).state);
        id(nextionD).set_component_value("alarmM", id(alarm_m).state);
#-----------------------------Settings Page ------------------------
  - platform: nextion
    page_id: 2
    component_id: 17
    id: settingsB
    on_state:
      lambda: |-
        id(nextionD).goto_page("Settings");
        id(page_id) = 7;
        id(nextionD).update();
#-----------------------------Remote Page ------------------------
  - platform: nextion
    page_id: 2
    component_id: 18
    id: remoteB
    on_state:
      lambda: |-
        id(nextionD).goto_page("Control");
        id(page_id) = 6;
        id(nextionD).update();
#-----------------------------Weather Page ----------------------
  - platform: nextion
    page_id: 2
    component_id: 1
    id: weatherB
    on_state:
      lambda: |-
        id(nextionD).goto_page("Weather");
        id(page_id) = 5;
        id(nextionD).update();

#-----------------------------Play Music ---------------------------
  - platform: nextion
    page_id: 2
    component_id: 4
    id: toggleMusic
    on_press:
      then:
        - if:
            condition:
              lambda: return (id(media_player).state == "idle");
            then:
              - homeassistant.service:
                  service: script.playlist_matin
            else:
              - homeassistant.service:
                  service: media_player.media_play_pause
                  data:
                    entity_id: media_player.spotify_xmow
              - delay: 200ms
              - lambda: id(nextionD).update();

#-----------------------------Next Music ---------------------------
  - platform: nextion
    page_id: 2
    component_id: 3
    id: nextMusic
    on_press:
      then:
        - homeassistant.service:
            service: media_player.media_next_track
            data:
              entity_id: media_player.spotify_xmow
#-----------------------------Previous Music -----------------------
  - platform: nextion
    page_id: 2
    component_id: 5
    id: previousMusic
    on_press:
      then:
        - homeassistant.service:
            service: media_player.media_previous_track
            data:
              entity_id: media_player.spotify_xmow
#-----------------------------Vol + Chaine -------------------------
  - platform: nextion
    page_id: 2
    component_id: 12
    id: chaine_plus
    on_press:
      then:
        - homeassistant.service:
            service: switch.turn_on
            data:
              entity_id: switch.volume_plus
#-----------------------------Vol - Chaine -------------------------
  - platform: nextion
    page_id: 2
    component_id: 10
    id: chaine_minus
    on_press:
      then:
        - homeassistant.service:
            service: switch.turn_on
            data:
              entity_id: switch.volume_minus
#-----------------------------Toggle Chaine ------------------------
  - platform: nextion
    page_id: 2
    component_id: 11
    id: toggle_chaine
    on_press:
      then:
        - homeassistant.service:
            service: switch.turn_on
            data:
              entity_id: switch.chaine_hi_fi
#___________________________________Page 3___________________________________
#-----------------------------Heure + ------------------------------
  - platform: nextion
    page_id: 3
    component_id: 4
    id: hp
    on_press:
      then:
        - homeassistant.service:
            service: input_datetime.set_datetime
            data:
              entity_id: input_datetime.heure_du_reveil
            data_template:
              time: "{{state_attr('input_datetime.heure_du_reveil', 'hour') + 1}}{{':'}}{{state_attr('input_datetime.heure_du_reveil', 'minute')}}"
        - lambda: id(nextionD).update();
#-----------------------------Heure - ------------------------------
  - platform: nextion
    page_id: 3
    component_id: 5
    id: hm
    on_press:
      then:
        - homeassistant.service:
            service: input_datetime.set_datetime
            data:
              entity_id: input_datetime.heure_du_reveil
            data_template:
              time: "{{state_attr('input_datetime.heure_du_reveil', 'hour') - 1}}{{':'}}{{state_attr('input_datetime.heure_du_reveil', 'minute')}}"
        - lambda: id(nextionD).update();
#-----------------------------Minute + -----------------------------
  - platform: nextion
    page_id: 3
    component_id: 3
    id: mp
    on_press:
      then:
        - homeassistant.service:
            service: input_datetime.set_datetime
            data:
              entity_id: input_datetime.heure_du_reveil
            data_template:
              time: "{{state_attr('input_datetime.heure_du_reveil', 'hour')}}{{':'}}{{state_attr('input_datetime.heure_du_reveil', 'minute') + 1}}"
        - lambda: id(nextionD).update();
#-----------------------------Minute - -----------------------------
  - platform: nextion
    page_id: 3
    component_id: 6
    id: mm
    on_press:
      then:
        - homeassistant.service:
            service: input_datetime.set_datetime
            data:
              entity_id: input_datetime.heure_du_reveil
            data_template:
              time: "{{state_attr('input_datetime.heure_du_reveil', 'hour')}}{{':'}}{{state_attr('input_datetime.heure_du_reveil', 'minute') - 1}}"
        - lambda: id(nextionD).update();
#-----------------------------Toggle Timer -------------------------
  - platform: nextion
    page_id: 3
    component_id: 8
    id: toggleTimer
    on_press:
      then:
        - homeassistant.service:
            service: automation.toggle
            data:
              entity_id: automation.reveil
        - delay: 200ms
        - lambda: id(nextionD).update();
#-----------------------------Toggle Auto --------------------------
  - platform: nextion
    page_id: 3
    component_id: 9
    id: toggleAuto
    on_press:
      then:
        - homeassistant.service:
            service: automation.toggle
            data:
              entity_id: automation.18_reveil_automatique
        - delay: 200ms
        - lambda: id(nextionD).update();
#-----------------------------Back Timer Page ----------------------
  - platform: nextion
    page_id: 3
    component_id: 7
    id: backTimer
    on_state:
      lambda: |-
        id(page_id) = 2; 
        id(nextionD).update();

#-----------------------------6h30----------------------------------
  - platform: nextion
    page_id: 3
    component_id: 13
    id: alarm6h30
    on_press:
      then:
        - homeassistant.service:
            service: input_datetime.set_datetime
            data:
              entity_id: input_datetime.heure_du_reveil
              time: '06:30:00'
        - lambda: id(nextionD).update();
#-----------------------------7h00----------------------------------
  - platform: nextion
    page_id: 3
    component_id: 22
    id: alarm7h00
    on_press:
      then:
        - homeassistant.service:
            service: input_datetime.set_datetime
            data:
              entity_id: input_datetime.heure_du_reveil
              time: '07:00:00'
        - lambda: id(nextionD).update();
#-----------------------------8h00----------------------------------
  - platform: nextion
    page_id: 3
    component_id: 23
    id: alarm8h00
    on_press:
      then:
        - homeassistant.service:
            service: input_datetime.set_datetime
            data:
              entity_id: input_datetime.heure_du_reveil
              time: '08:00:00'
        - lambda: id(nextionD).update();

#___________________________________Page 4___________________________________
#-----------------------------go to sleep time----------------------
  - platform: nextion
    page_id: 4
    component_id: 13
    id: sleep_time
    on_state:
      lambda: |-
        id(page_id) = 4; 
        id(nextionD).update();
#-----------------------------return in main page-------------------
  - platform: nextion
    page_id: 4
    component_id: 0
    id: back_sleep
    on_state:
      lambda: |-
        id(page_id) = 2;
        delay(200);
        id(nextionD).goto_page("Acceuil");
        
        
#___________________________________Page 5___________________________________
#-----------------------------return in main page-------------------  
  - platform: nextion
    page_id: 5
    component_id: 17
    id: back_Weather
    on_state:
      lambda: |-
        id(nextionD).goto_page("Acceuil");
        id(page_id) = 2; 
        id(nextionD).update();

#___________________________________Page 6___________________________________
#-----------------------------Cover UP -----------------------------
  - platform: nextion
    page_id: 6
    component_id: 3
    id: coverUp
    on_press:
      then:
        - homeassistant.service:
            service: cover.open_cover
            data:
              entity_id: cover.volet_chambre_1
        - lambda: id(nextionD).update();
#-----------------------------Volet Down ---------------------------
  - platform: nextion
    page_id: 6
    component_id: 1
    id: coverDown
    on_press:
      then:
        - homeassistant.service:
            service: cover.close_cover
            data:
              entity_id: cover.volet_chambre_1
        - lambda: id(nextionD).update();
#-----------------------------Volet Stop ---------------------------
  - platform: nextion
    page_id: 6
    component_id: 2
    id: coverStop
    on_press:
      then:
        - homeassistant.service:
            service: cover.stop_cover
            data:
              entity_id: cover.volet_chambre_1
        - lambda: id(nextionD).update();

#-----------------------------Volet Stop ---------------------------
  - platform: nextion
    page_id: 6
    component_id: 5
    id: music_playlist1
    on_press:
      then:
        - homeassistant.service:
            service: script.playlist_matin
  - platform: nextion
    page_id: 6
    component_id: 7
    id: music_playlist2
    on_press:
      then:
        - homeassistant.service:
            service: script.hits_du_moments
#-----------------------------Back Timer Page ----------------------
  - platform: nextion
    page_id: 6
    component_id: 4
    id: backControl
    on_state:
      lambda: |-
        id(nextionD).goto_page("Acceuil");
        id(page_id) = 2; 
        id(nextionD).update();

#___________________________________Page 7___________________________________
#-----------------------------Reboot---------------------------------
  - platform: nextion
    page_id: 7
    component_id: 4
    id: rebootsw
    on_press:
      - switch.toggle: reboot_esp
#-----------------------------Back Settings Page --------------------
  - platform: nextion
    page_id: 7
    component_id: 3
    id: backSettings
    on_state:
      lambda: |-
        id(page_id) = 2; 
        id(nextionD).update();

uart:
  rx_pin: D1
  tx_pin: D2
  baud_rate: 115200

text_sensor:
  - platform: homeassistant
    id: title_music
    entity_id: sensor.title_music

  - platform: homeassistant
    id: str_date
    entity_id: sensor.date_simple
  - platform: homeassistant
    id: str_time
    entity_id: sensor.time

  - platform: homeassistant
    id: actual_temp
    entity_id: sensor.actual_temp
  - platform: homeassistant
    id: max_temp
    entity_id: sensor.max_temp
  - platform: homeassistant
    id: min_temp
    entity_id: sensor.min_temp

  - platform: homeassistant
    id: media_player
    entity_id: media_player.spotify

  - platform: homeassistant
    id: temp_indoor
    entity_id: sensor.temperature_indoor
  - platform: homeassistant
    id: hum_indoor
    entity_id: sensor.humidite_chambre_1

  - platform: version
    id: esphome_v

display:
  - platform: nextion
    id: nextionD
    update_interval: 1s
    lambda: |-
      ESP_LOGD("main", "Page: %d", id(page_id));
      //it.set_wait_for_ack(false);
      if(id(page_id) == 2){ //Aceuil

                  it.send_command_printf("%s.pic=%.0f", "meteoIcon",id(today_icon).state); //Meteo Icon

                  it.set_component_text("tDate", id(str_date).state.c_str());//Date
                  it.set_component_text("tTime", id(str_time).state.c_str());//Time

                  it.set_component_value("timer", id(timerState).state);//Alarm State

                  //----------Play/Pause Button------------------
                  if(id(media_player).state == "playing")
                    it.set_component_value("musicState", 1);
                  else
                    it.set_component_value("musicState", 0);
                  it.set_component_text("musicText", id(title_music).state.c_str());
      }

      if(id(page_id) == 3){//Reveil
                  if(id(timerState).state == 1){
                    it.set_component_value("toggleR", 1);
                    if(id(timerAutoState).state == 1){//Auto
                      it.set_component_value("toggleAuto", 1);
                      it.set_component_text("strMsg", "Auto");
                  }
                  else{
                      it.set_component_value("toggleAuto", 0);
                    }
                  }
                  else{
                    it.set_component_value("toggleR", 0);
                    it.set_component_text("strMsg", "OFF");
                  }
                  
                  //it.set_component_text("strTimer", id(timer).state.c_str());

      }
      if(id(page_id) == 4){ //Sleep Time

                  it.send_command_printf("%s.pic=%.0f", "meteoIcon",id(today_icon).state); //Meteo Icon

                  it.set_component_text("tDate", id(str_date).state.c_str());//Date
                  it.set_component_text("tTime", id(str_time).state.c_str());//Time

                  it.set_component_text("tempVal", id(temp_indoor).state.c_str());
                  it.set_component_text("humVal", id(hum_indoor).state.c_str());
                  it.set_component_text("nowTempOutside", id(actual_temp).state.c_str());

      }
      if(id(page_id) == 5){//Meteo
                
            it.send_command_printf("%s.pic=%.0f", "meteoIcon",id(today_icon).state); //Meteo Icon
                it.set_component_text("nowTempOutside", id(actual_temp).state.c_str());
                it.set_component_text("maxTempOutside", id(max_temp).state.c_str());
                it.set_component_text("minTempOutside", id(min_temp).state.c_str());

                it.set_component_text("tempVal", id(temp_indoor).state.c_str());
                it.set_component_text("humVal", id(hum_indoor).state.c_str());

      }
      if(id(page_id) == 6){//Control

      }
      if(id(page_id) == 7){//Settings
                if(id(wifi_info).state < -87){
                  it.send_command_printf("wifiIcon.pic=60");
                }
                else if(id(wifi_info).state < -80){
                  it.send_command_printf("wifiIcon.pic=61");
                }
                else if(id(wifi_info).state < -70){
                  it.send_command_printf("wifiIcon.pic=62");
                }
                else if(id(wifi_info).state > -70){
                  it.send_command_printf("wifiIcon.pic=63");
                }else{
                  it.send_command_printf("wifiIcon.pic=59");
                }

                it.set_component_text("version", id(esphome_v).state.c_str());
                it.set_component_text_printf("uptime", "%.1f h", id(uptime_esp).state);
      }

Euh un schéma de ton câblage ?
As-tu essayé en désactivant tout le code lambda que tu as dans la section display de déclaration de l’écran Nextion ?

Bonjour,

+5V au fil rouge du Nextion
GND au fil noir du Nextion
Jaune (RX) sur D1 de l’ESP
Bleu (TX) sur D2 de l’ESP
Alimentation de l’ESP avec cable USB 5V

Merci

Salut

Je pense que ce n’est pas D1 et D2 mais 5 et 4. Il faut le numéro des pin (il y a 3 appellations par pin : le numéro de broche, le numéro de GPIO et la fonction).

Dans ma config j’ai aussi un ID pour l’uart après baud_rate mais je sais pas si c’est obligatoire de lui donner un ID : id: tf_uart

A+ Fred

Tu déclares l’écran sur D1/D2 mais tu l’as branché sur d4/d5???

effectivement en regardant la photo en gros plan on voit le raccordement sur la D4 et les D1 et D2 qui ne sont pas raccordées.
Bien vu @tikismoke !!!

Bonjour

Oui bien vu :face_with_open_eyes_and_hand_over_mouth: effectivement sur la photo c’est branché en D4/D5 mais comme j’ai fais tellement d’essai … mais j’ai aussi essayé en D1 et D2 mais cela n’a rien changé ! :joy:

as tu modifié ton yaml avec la déclaration des rx_pin et tx_pin ? Chez moi pour le nextion, c’est déclaré un numéro de GPIO et pas le nom de la pin.

et dans la doc esphome, c’est bien déclaré en GPIO aussi

uart:
  id: uart_2
  rx_pin: GPIO16
  tx_pin: GPIO17
  baud_rate: 115200

donc dans ton cas GPIO5 et GPIO4

Salut
Ok j’essaie cela :hand_with_index_finger_and_thumb_crossed:

Salut

Est-ce que quelqu’un pourrait me dire sur quelle pin raccorder le Nextion sur cet ESP ?

J’ai essayé D1 - D2 GPIO1 - GPIO2 TX - RX GPIO 4 - GPIO 5 et j’ai toujours ce foutu message Nextion is not connected

Peut-être que l’erreur se trouve dans la connexion des pins !

Merci


mais attention les chiffres sont inversés. C’est à dire que le D1 correspond au GPIO 5 et pas au GPIO 4
de même le D2 correspond au GPIO4 et non au GPIO 5

je pense que tu as donc inversé

ok merci pour ta rapidité de réponse
mais dans leESP yaml il faut mettre quoi finalement ? GPIO 4 ou D2 :innocent:

uart:

rx_pin: GPIO4 ?
tx_pin: GPIO5 ?
baud_rate: 115200

il faut lire ce que l’on te dit :joy: :joy: :joy: dans la doc c’est marqué comme sur cette exemple

Et non, tu inverses le rx et le TX. Tu veux vraiment pas lire non message :crazy_face: :crazy_face: :joy:
rx_pin: GPIO5
tx_pin: GPIO4

hello
oui tu as raison il faut lire :eyes: mais comme je galère depuis 15 jours sur ce truc et que j’ai essayé tellement de combinaisons …que je n’ai plus les yeux en face des trous

Voila ma config yaml et je ne trouve pas où cela coince

esphome:
  name: esp-ecran
  platform: ESP8266
  board: d1_mini


# Enable Home Assistant API

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails



captive_portal:
logger:
  level: DEBUG
api:
  services:
      - service: toggle
        variables: 
          state: bool
        then:
          - lambda: |-
              if(state){
                id(page_id) = 2;   
                id(nextionD).goto_page("Accueil");
                id(nextionD).update();
              }else{
                id(page_id) = 1;
                id(nextionD).goto_page("OFF");
                id(nextionD).update();
              }
      - service: brightness
        variables: 
          brightness: float
        then:
          - lambda: |-
              id(nextionD).set_backlight_brightness(brightness);

ota:

switch:
  - platform: restart
    id: reboot_esp

globals:
  - id: page_id
    type: int
    initial_value: "99"

sensor:
  - platform: homeassistant
    id: today_icon
    entity_id: sensor.today_icon


uart:
 
  rx_pin: GPIO5
  tx_pin: GPIO4
  baud_rate: 115200



display:
  - platform: nextion
    id: nextionD
    update_interval: 1s```
esphome:
  name: esp-ecran

esp8266:
  board: d1_mini

Je sais pas si ta déclaration est bonne, sur la doc c’est plutôt comme cela

# Configure the screen itself
display:
  - platform: nextion
    id: disp1
    uart_id: tf_uart
    tft_url: 'https://domaineHA/local/nspanel/ecran.tft'
    # A little fun...
    on_setup:
      then:
        # Enable 1 light page (up to 4 available)
        - lambda: auto time = id(sntp_time).now();
        - number.set:
            id: brightness
            value: 30
        - wait_until:
            api.connected
        - switch.template.publish:
            id: nextion_init
            state: on

Et puis il n’y a pas de partie display dans ton code. Donc l’écran n’est pas initialisé

# Functionality for the Nextion display
external_components:
  - source: github://pr#2956
    components: [nextion]
    refresh: 1h

et ça mais je sais plus à quoi ça sert

Merci
Je revérifierai cela jeudi car demain pas le temps …

Cordialement

Hello

J’ai encore essayé mais pas mieux avec ESP yaml

esphome:
  name: esp-nextion

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API


ota:
  password: "494473fRTt88856799450714309d2e"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Nextion Fallback Hotspot"
    password: "iChjkiop89hstYVse"

captive_portal:

http_request:

api:
  services:
    - service: update_tft
      then:
        - lambda: 'id(esp_nextion)->upload_tft();'

display:
  - platform: nextion
    id: esp_nextion
    update_interval: 60s   # Pas de réel besoin de rafraichissement
    touch_sleep_timeout: 180
    wake_up_page: 0
    tft_url: 'http://IP-HA/local/nextion/ha_dashboard_lcd.tft' 
    brightness: 70%

uart:
  
  rx_pin: GPIO5
  tx_pin: GPIO4
  baud_rate: 115200

sensor:
  - platform: homeassistant
    id: today_icon
    entity_id: sensor.today_icon


  - platform: homeassistant
    id: tempcuis
    entity_id: sensor.temperature_coin_repas
    on_value:
      then:
        lambda: |-
          id(esp_nextion).set_component_text_printf("acceuil.tempcuis","%.1f",id(tempcuis).state);

# Temps de fonctionnement
  - platform: uptime
    name: "Allumé depuis (s)"
    id: uptime_sec
       
switch:
# Bouton de redémarrage
  - platform: restart
    name: "Redémarrage"

    # Transformation des secondes en jours

text_sensor:
  - platform: template
    name: "Allumé depuis (j)"
    lambda: |-
      int seconds = (id(uptime_sec).state);
      int days = seconds / (24 * 3600);
      seconds = seconds % (24 * 3600); 
      int hours = seconds / 3600;
      seconds = seconds % 3600;
      int minutes = seconds /  60;
      seconds = seconds % 60;
      return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
    icon: mdi:clock-start
    update_interval: 60s
    

LOGS

INFO Reading configuration /config/esphome/esp-nextion.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esp-nextion (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- ESPAsyncTCP-esphome @ 1.2.3
|   |-- Hash @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- ArduinoJson @ 6.18.5
|-- ESP8266HTTPClient @ 1.2
Compiling /data/esp-nextion/.pioenvs/esp-nextion/src/main.cpp.o
Linking /data/esp-nextion/.pioenvs/esp-nextion/firmware.elf
RAM:   [====      ]  42.1% (used 34468 bytes from 81920 bytes)
Flash: [=====     ]  54.2% (used 554977 bytes from 1023984 bytes)
Building /data/esp-nextion/.pioenvs/esp-nextion/firmware.bin
esp8266_copy_factory_bin(["/data/esp-nextion/.pioenvs/esp-nextion/firmware.bin"], ["/data/esp-nextion/.pioenvs/esp-nextion/firmware.elf"])
========================= [SUCCESS] Took 33.11 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of esp-nextion.local
INFO  -> 192.168.123.152
INFO Uploading /data/esp-nextion/.pioenvs/esp-nextion/firmware.bin (559136 bytes)
INFO Compressed to 392079 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from esp-nextion.local using esphome API
INFO Successfully connected to esp-nextion.local
[15:11:57][I][app:102]: ESPHome version 2022.9.1 compiled on Sep 22 2022, 15:11:02
[15:11:57][C][wifi:502]: WiFi:
[15:11:57][C][wifi:360]:   Local MAC: 44:98:57:50:EA:48
[15:11:57][C][wifi:361]:   SSID: 'Maison'[redacted]
[15:11:57][C][wifi:362]:   IP Address: IP-ESP
[15:11:57][C][wifi:363]:   BSSID: B0:B7:75:7C:99:F5[redacted]
[15:11:57][C][wifi:365]:   Hostname: 'esp-nextion'
[15:11:57][C][wifi:367]:   Signal strength: -89 dB ▂▄▆█
[15:11:57][C][wifi:371]:   Channel: 6
[15:11:57][C][wifi:372]:   Subnet: xxx.xxx.xxx.0
[15:11:57][C][wifi:373]:   Gateway: 192.xxx.xxx.xxx
[15:11:57][C][wifi:374]:   DNS1: 8.8.8.8
[15:11:57][C][wifi:375]:   DNS2: 1.1.1.1
[15:11:57][C][logger:275]: Logger:
[15:11:57][C][logger:276]:   Level: DEBUG
[15:11:57][C][logger:277]:   Log Baud Rate: 115200
[15:11:57][C][logger:278]:   Hardware UART: UART0
[15:11:57][C][uart.arduino_esp8266:102]: UART Bus:
[15:11:57][C][uart.arduino_esp8266:103]:   TX Pin: GPIO4
[15:11:57][C][uart.arduino_esp8266:104]:   RX Pin: GPIO5
[15:11:57][C][uart.arduino_esp8266:106]:   RX Buffer Size: 256
[15:11:57][C][uart.arduino_esp8266:108]:   Baud Rate: 115200 baud
[15:11:57][C][uart.arduino_esp8266:109]:   Data Bits: 8
[15:11:57][C][uart.arduino_esp8266:110]:   Parity: NONE
[15:11:57][C][uart.arduino_esp8266:111]:   Stop bits: 1
[15:11:57][C][uart.arduino_esp8266:115]:   Using software serial
[15:11:57][C][uptime.sensor:031]: Uptime Sensor 'Allumé depuis (s)'
[15:11:57][C][uptime.sensor:031]:   State Class: 'total_increasing'
[15:11:57][C][uptime.sensor:031]:   Unit of Measurement: 's'
[15:11:57][C][uptime.sensor:031]:   Accuracy Decimals: 0
[15:11:57][C][uptime.sensor:031]:   Icon: 'mdi:timer-outline'
[15:11:57][C][template.text_sensor:021]: Template Sensor 'Allumé depuis (j)'
[15:11:57][C][template.text_sensor:021]:   Icon: 'mdi:clock-start'
[15:11:57][C][nextion:117]: Nextion:
[15:11:57][C][nextion:118]:   Device Model:     
[15:11:57][C][nextion:119]:   Firmware Version: 
[15:11:57][C][nextion:120]:   Serial Number:    
[15:11:57][C][nextion:121]:   Flash Size:       
[15:11:57][C][nextion:122]:   Wake On Touch:    True
[15:11:57][C][nextion:125]:   Touch Timeout:       180
[15:11:57][C][nextion:129]:   Wake Up Page :       0
[15:11:57][C][restart:022]: Restart Switch 'Redémarrage'
[15:11:57][C][restart:022]:   Icon: 'mdi:restart'
[15:11:57][C][captive_portal:088]: Captive Portal:
[15:11:57][C][mdns:094]: mDNS:
[15:11:57][C][mdns:095]:   Hostname: esp-nextion
[15:11:57][C][ota:089]: Over-The-Air Updates:
[15:11:57][C][ota:090]:   Address: esp-nextion.local:8266
[15:11:57][C][ota:093]:   Using Password.
[15:11:57][C][api:138]: API Server:
[15:11:57][C][api:139]:   Address: esp-nextion.local:6053
[15:11:57][C][api:143]:   Using noise encryption: NO
[15:11:57][C][http_request:014]: HTTP Request:
[15:11:57][C][http_request:015]:   Timeout: 5000ms
[15:11:57][C][http_request:016]:   User-Agent: ESPHome
[15:11:57][C][http_request:017]:   Follow Redirects: 1
[15:11:57][C][http_request:018]:   Redirect limit: 3
[15:11:57][C][homeassistant.sensor:030]: Homeassistant Sensor 'today_icon'
[15:11:57][C][homeassistant.sensor:030]:   State Class: ''
[15:11:57][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[15:11:57][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[15:11:57][C][homeassistant.sensor:031]:   Entity ID: 'sensor.today_icon'
[15:11:57][C][homeassistant.sensor:030]: Homeassistant Sensor 'tempcuis'
[15:11:57][C][homeassistant.sensor:030]:   State Class: ''
[15:11:57][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[15:11:57][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[15:11:57][C][homeassistant.sensor:031]:   Entity ID: 'sensor.temperature_coin_repas'
[15:11:57][E][uart:015]: Reading from UART timed out at byte 0!
[15:11:57][W][nextion:072]: Nextion is not connected! 
[15:12:07][D][api.connection:861]: Home Assistant 2022.9.1 (IP-HA): Connected successfully
[15:12:07][D][homeassistant.sensor:024]: 'sensor.today_icon': Got state 29.00
[15:12:07][D][sensor:126]: 'today_icon': Sending state 29.00000  with 1 decimals of accuracy
[15:12:07][D][homeassistant.sensor:024]: 'sensor.temperature_coin_repas': Got state 22.60
[15:12:07][D][sensor:126]: 'tempcuis': Sending state 22.60000  with 1 decimals of accuracy
[15:12:07][E][uart:015]: Reading from UART timed out at byte 0!
[15:12:07][W][nextion:072]: Nextion is not connected! 


tu utilises plus un wemos d1 mini ???

en premier il n’y a pas d’espace après le ligne uart:, je sais pas si c’est important mais…

The Nextion uses a baud rate of 9600 by default. It may be configured to use a faster speed by adding (for example)
un truc auquel je pense comme ça, c’est le BAUDRATE. Sur mon écran ça fonctionne parfaitement en 115200 mais sur la doc, c’est conseillé 9600 pour commencer.
C’est quel modèle ton écran ???

Salut

J’ai supprimé l’espace par acquit de conscience :wink:
J’ai essayé avec 9600

Pas de changement :hot_face:

Quand je le flash j’ai les infos suivantes :
Chip Info:

  • Chip Family: ESP8266
  • Chip Model: ESP8266EX
  • Chip ID: 0051EF46

Quand je crée un nouveau device dans ESPHome je selectionne ESP236 et d’office il me crée un device avec Board esp01_1m !

Ecran Nextion NX3224F028-11

Je pense que je n’y arriverai pas … alors que cela a fonctionné cela a planté lorsque j’ai changé de réseau wifi puis… la galère à commencé

Merci

Bon je viens de trouver un truc !!! :joy: :joy: :joy: et c’est sous notre nez depuis le début.

Tu alimentes ton esp via un port USB, et ton écran par une carte alim 5v, mais tu ne partages pas de masse. Ce qui veux dire que ta communication ne peux pas passer entre les deux.

Pour connecter les deux, il te faut au moins 3 fils. Le RX, le TX et le 0V

1 « J'aime »