Please Help try to print sensor and bianry state on nextion with more than one page

Please Help try to print sensor and bianry state on nextion with more than one page
I have already made a nextion display with one page and now i try to make more with 4 pages. The button to change the page work but i can send information to nextion

Here my code

# This is ESPHome configuration file. This goes to the esphome folder
# You need to provide your WiFi ssis/password and passwords for API and OTA (or put them in your esphome/secrets.yaml)
esphome:
  name: affichage7
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: xxxxxxxxxxx
  password: xxxxxxxxxxxxxx
  fast_connect: true

logger:
  baud_rate: 0     # Disable UART logging (pins GPIO1/3 are used for Nextion communication)

uart:
  rx_pin: D1
  tx_pin: D6
  baud_rate: 9600


api:

ota:

sensor:
  - platform: homeassistant   # Inside salon
    id: tesal
    entity_id: sensor.netatmo_interieur_temperature
  - platform: homeassistant   # Inside sdb
    id: tesdb
    entity_id: sensor.salle_de_bain_temperature
  - platform: homeassistant   # Inside parents
    id: tepar
    entity_id: sensor.sation_temperature_ambiante   
  - platform: homeassistant   # jardin
    id: tejar
    entity_id: sensor.netatmo_jardin_temperature 
  - platform: homeassistant
    id: cocon
    entity_id: sensor.daily_energy
  - platform: homeassistant
    id: copro
    entity_id: sensor.daily_energy_2_kwh
  - platform: homeassistant
    id: cores
    entity_id: sensor.daily_power

globals:
  - id: nextion_page_id
    type: int
    restore_value: no
    initial_value: '0'

binary_sensor:
  - platform: nextion
    page_id: 0
    component_id: 1
    name: "plan01"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=1;
            id(display_nextion).goto_page("floor");
        - component.update: display_nextion
  - platform: nextion
    page_id: 0
    component_id: 4
    name: "page03"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=2;
            id(display_nextion).goto_page("page3");
        - component.update: display_nextion
  - platform: nextion
    page_id: 0
    component_id: 5
    name: "page04"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=3;
            id(display_nextion).goto_page("page4");
        - component.update: display_nextion
  - platform: nextion
    page_id: 1
    component_id: 4
    name: "home11"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=0;
            id(display_nextion).goto_page("home");
        - component.update: display_nextion
  - platform: nextion
    page_id: 1
    component_id: 6
    name: "page13"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=2;
            id(display_nextion).goto_page("page3");
        - component.update: display_nextion
  - platform: nextion
    page_id: 1
    component_id: 7
    name: "page14"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=3;
            id(display_nextion).goto_page("page4");
        - component.update: display_nextion
  - platform: nextion
    page_id: 2
    component_id: 1
    name: "home21"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=0;
            id(display_nextion).goto_page("home");
        - component.update: display_nextion
  - platform: nextion
    page_id: 2
    component_id: 2
    name: "plan22"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=1;
            id(display_nextion).goto_page("floor");
        - component.update: display_nextion
  - platform: nextion
    page_id: 2
    component_id: 4
    name: "page24"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=3;
            id(display_nextion).goto_page("page4");
        - component.update: display_nextion
  - platform: nextion
    page_id: 3
    component_id: 1
    name: "home31"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=0;
            id(display_nextion).goto_page("home");
        - component.update: display_nextion
  - platform: nextion
    page_id: 3
    component_id: 2
    name: "plan32"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=1;
            id(display_nextion).goto_page("floor");
        - component.update: display_nextion
  - platform: nextion
    page_id: 3
    component_id: 3
    name: "page33"
    internal: true
    on_press:
      then:
        - lambda: |-
            id(nextion_page_id)=2;
            id(display_nextion).goto_page("page3");
        - component.update: display_nextion

text_sensor:
  - platform: homeassistant
    id: etpor
    entity_id: group.fenetre
    internal: true
  - platform: homeassistant
    id: etlum
    entity_id: group.all_lights
    internal: true   
    

display:
  - platform: nextion
    id: display_nextion
    update_interval: 3s
    lambda: |-
      id(nextion_page_id)=0;
      it.set_component_text_printf("cocon","%.1f",id(cocon).state); 
      it.set_component_text_printf("copro","%.1f",id(copro).state);
      it.set_component_text_printf("cores","%.1f",id(cores).state);
      it.set_component_text_printf("etlum","%s",id(etlum).state.c_str());
      it.set_component_text_printf("etpor","%s",id(etpor).state.c_str());
      id(nextion_page_id)=1;
      it.set_component_text_printf("tepar","%.1f",id(tepar).state);
      it.set_component_text_printf("tesdb","%.1f",id(tesdb).state);
      it.set_component_text_printf("tesal","%.1f",id(tesal).state);
      it.set_component_text_printf("tejar","%.1f",id(tejar).state);        

page o object name home
page 1 object name floor

now in place of sensor i have “nan”

Can you help me ?

Thanks

Does this help? [Solved]Please help me how to define multiple pages in nextion display

Hello Thanks nickrout, I have check this topic and test the message page 0 and page1 that work but when in my case i want to sent information from Home assisatant to a specific page of the nextion and I can’t do this for the moment.

Anyone have this kind of config ?

Thanks

bad quality i retry

I had the same issue, it worked when i added the esphome to ha with the integration page

Hello I juste try to chnage the config with a simple text with inside the sensor temperature.
It doesn’t Work, it’s possible that the Nextion Intelligent series have a different solution to print information on screen ?

I try to change the wemos D1 mini with a NodeMCU V2 same problem

Did you find the solution?

you don’t need esp code to change pages in the Nextion.
You can do it with the build in commands
In this example i switch to the page wit the Name “level”

2021-04-08_09h26_58