Here is my updated config:
# 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: station_meteo_lcd
platform: ESP8266
board: d1_mini_pro
wifi:
ssid: YOURS
password: !secret wifi_password
fast_connect: true
api:
ota:
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
time:
- platform: sntp
id: sntp_time
sensor:
- platform: homeassistant # Inside temperature
id: temperature_inside
entity_id: sensor.netatmo_indoor_temperature
- platform: homeassistant # Outside temperature
id: temperature_outside
entity_id: sensor.saint_tropez_temperature
- platform: homeassistant # Swimming pool
id: temperature_pool
entity_id: sensor.cpu_temp
- platform: homeassistant # Forecast minimal temperature
id: today_min
entity_id: sensor.saint_tropez_temperature_minimale_pour_demain
- platform: homeassistant # Forecast maximal temperature
id: today_max
entity_id: sensor.saint_tropez_temperature_maximale_pour_demain
- platform: homeassistant # Forecast precipitation
id: today_rain
entity_id: sensor.saint_tropez_rain_chance
- platform: homeassistant # Forecast icon
id: today_icon
entity_id: sensor.today_icon
binary_sensor:
- platform: homeassistant
id: somebody_home
entity_id: binary_sensor.somebody_home
globals:
- id: first_page # First page of the display?
type: bool
restore_value: no
- id: display_on # Is display on?
type: bool
restore_value: no
display:
- platform: nextion
id: teplomer
update_interval: 5s
lambda: |-
// Turn display on when somebody is home. Only update when display on.
if (id(somebody_home).state) {
if (!id(display_on)) {
it.set_backlight_brightness(50);
id(display_on)=true;
}
// Swich first/second page on each update (every 5 seconds)
if (id(first_page)) {
it.goto_page("forecast");
it.send_command_printf("%s.pic=%.0f", "weather",id(today_icon).state);
it.set_component_text_printf("minmax","%.0f/%.0f",id(today_min).state,id(today_max).state);
if (isnan(id(today_rain).state)) {
it.set_component_text("rain","-");
} else {
it.set_component_text_printf("rain","%.0f",id(today_rain).state);
}
auto time = id(sntp_time).now();
it.set_component_text_printf("hour","%02d",time.hour);
it.set_component_text_printf("minute","%02d",time.minute);
} else {
it.goto_page("temperature");
it.set_component_text_printf("inside","%2.1f",id(temperature_inside).state);
it.set_component_text_printf("outside","%2.1f",id(temperature_outside).state);
it.set_component_text_printf("pool","%2.1f",id(temperature_pool).state);
}
id(first_page) = !id(first_page); // Switch page
} else {
// Turn off the display if nobody is home.
if (id(display_on)) {
it.set_backlight_brightness(0);
id(display_on)=false;
}
}
It’s working perfectly for me. Follow the process shown in the video and you should be good.