Change display after 10s

Hello,

I have an ESP8266 D1 mini with ESPHome and Homeassistant.
A connected display should show something different after 10s.
Only after a reset should the first one be displayed again for 10s.

I’m trying a lot of things right now, but I’m not getting anywhere. Does anyone have any help for me?

I’m sure it’s simple, but I think I’m just getting lost.

I was able to do this with the use of “pages” on an ESP32 which were timed to change pages (and content) every 10 seconds (or whatever is setup)… but not sure if the D1 mini can do this perhaps due to memory.

1 Like

this won’t help but I had a similar issue. I have a display that shows the state of 4 relays (on or off) and I wanted the backlight to remain off but turn on for 10 seconds when the state changed and then turn off again after 10 seconds.

I knew how to add a button to manually turn the backlight on/off just didn’t know how to do it automatically in esphome.

my work around for my lack of knowledge was to just have an automation for each relay.

alias: Relay 1 backlight
description: relay 1 with backlight
trigger:
  - platform: device
    type: changed_states
    device_id: 
    entity_id: 
    domain: switch
condition: []
action:
  - service: input_boolean.toggle
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.esphome_backlight
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: input_boolean.toggle
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.esphome_backlight
mode: single

I think when I get more time I will learn abit more about esphome and change it.

sometimes it’s the simple things that can be the most challenging. well for me anyway.

EDIT: it might help to mention what display you are using. more information the better.

1 Like

What kind of things have you tried? … Before we go and list out the common approaches you’ll find on this forum…:wink:

Also, what config have you currently got?

1 Like

Hello,

I have an ESP8266 D1 Mini that I operate with 4 load cells, an HX711 and a 0.91" OLED display.

The weight of an 11KG gas bottle should be displayed at the push of a button.

To save battery, the ESP should go into DeepSleep.

Since the display is not switched off but remains on during DeepSleep, “nothing” should be displayed.

By switching sides I worked out a solution. However, there are certainly more elegant ones. Because now the display is flashing.

DeepSleep and everything else works.

Here my code

### Deep Sleep ###
deep_sleep:
  run_duration: 40s

### intervall ###
interval:
  - interval: 2s
    then:
      - display.page.show_next: mydisplay
      - component.update: mydisplay


dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp8266.yaml@main
  import_full_config: true

# To have a "next url" for improv serial
web_server:

sensor:
  - platform: hx711
    name: "Waage Grill"
    id: grill
    dout_pin: 13  #D7
    clk_pin: 12   #D6
    gain: 128
    device_class: weight
    unit_of_measurement: "kg"
    accuracy_decimals: 2
    update_interval: 1s
    filters:
      - sliding_window_moving_average:
          window_size: 5
      - calibrate_linear:
         datapoints:
          - -463500 -> 0
          - 657500 -> 8.7
          - 707300 -> 11.1
          - 791500 -> 14.7
          - 1119700 -> 29.2
          - 2184500 -> 75.9
          - 2588000 -> 94.4


### Display ###
i2c:
  sda: 5 #D1
  scl: 4 #D2

font:
  - file: "gfonts://Roboto"
    id: form
    size: 27

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x32"
    id: mydisplay
    reset_pin: 0
    address: 0x3C
    pages:
      - id: seite1
        lambda: |-
          it.printf(0, 0, id(form), " %.1fkg", id(grill).state);
      - id: seite2
        lambda: |-
          it.print(0, 0, id(form), "");
1 Like

Solved.

I connected the display’s power supply to a pin.
I set the pin as “output” and “inverted: true” so that the pin is always provided with voltage.
If the ESP now goes into “DeepSleep”, the pin becomes de-energized and the display is dark/off.

If I press a button that sets the “RST pin” to ground, the ESP is taken out of DeepSleep and the display shows the data from the scale. Until DeepSleep arrives after the specified time.

Here my code.

captive_portal:

### Deep Sleep ###
deep_sleep:
  run_duration: 60s

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp8266.yaml@main
  import_full_config: true

# To have a "next url" for improv serial
web_server:

sensor:
  - platform: hx711
    name: "Waage Grill"
    id: grill
    dout_pin: 13  #D7
    clk_pin: 12   #D6
    gain: 128
    device_class: weight
    unit_of_measurement: "kg"
    accuracy_decimals: 2
    update_interval: 1s
    filters:
      - sliding_window_moving_average:
          window_size: 5
      - calibrate_linear:
         datapoints:
          - -463500 -> 0
          - 657500 -> 8.7
          - 707300 -> 11.1
          - 791500 -> 14.7
          - 1119700 -> 29.2
          - 2184500 -> 75.9
          - 2588000 -> 94.4


### Display ###
i2c:
  sda: 5 #D1
  scl: 4 #D2

font:
  - file: "gfonts://Roboto"
    id: form
    size: 27

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x32"
    id: mydisplay
    reset_pin: 0
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(form), " %.2fkg", id(grill).state);

output:
  - platform: gpio
    pin: 15
    id: displayschalter
    inverted: true
1 Like