Change display page on volume up/down

Hi all, I just got a new esp32-s3 display and got it to show some HA sensors and multiple pages. I am having an issue with displaying a certain page on HA sensor value change. Example: I want to display page 1 (local time, temp sensors) by default, but would like it to switch to page 2 momentarily when the volume of my denon receiver is changed (raise or lowered) I have all the sensors and some if statements configured, but am struggling on how to flip between pages on state change. Any help would be appreciated.

Something like this

  1. Import the volume using a homeassistant sensor Home Assistant Sensor — ESPHome
  2. In an esphome automation use component_update to update the display, or one of these options Display Component — ESPHome
1 Like

so right now I have two sensors and two pages as below. I can rotate pages in esp yaml with interval, but would like to display page 1 all the time except for when I turn up/down the volume and display it for 3 seconds (then go back to page1). Can I add something to lambda to display a page 2 but only when the volume state updates?

# Sensors and Buttons
time:
  - platform: homeassistant
    id: ha_time

sensor:
  - platform: homeassistant
    id: denon_vol1
    entity_id: sensor.denon_volume_zone1
    internal: True

text_sensor:
  - platform: homeassistant
    id: denon_zone1_power
    entity_id: media_player.denon_receiver
    internal: True

display:
  - platform: tdisplays3
    id: disp
    update_interval: 1s
    rotation: 90
    pages:
      - id: page1
        lambda: |-
          it.printf(0, 0, id(local_time), RED, TextAlign::LEFT, id(ha_time).now().strftime("%m/%d/%y %I:%M%p").c_str());
          it.print(0, 40, id(temp), WHITE, TextAlign::LEFT, "Outside:");
          if (id(outside_temp).has_state()) {
            it.printf(320, 40, id(temp), BLUE, TextAlign::RIGHT, "%.0f°", id(outside_temp).state);
          }
          else {
            it.print(320, 55, id(aux), RED, TextAlign::RIGHT, "wait");
          }
     - id: page2
        lambda: |-
          if ((id(denon_zone1_power).state != "off") && (id(denon_zone1_power).has_state())) {
          it.print(0, 60, id(vol), GREEN, TextAlign::LEFT, "ZONE 1");
          it.printf(320, 60, id(vol), WHITE, TextAlign::RIGHT, "%.0f", id(denon_vol1).state);
          } 

wow, this was as simple as adding below to the volume sensor. I am not sure this is the best way to do it as the pages don’t always update (maybe due to time/wifi delay) but it seems to work.

- platform: homeassistant
    id: denon_vol1
    entity_id: sensor.denon_volume_zone1
    internal: True
    on_raw_value:
      then:
        - display.page.show: page2
        - delay: 2s
        - display.page.show: page1

marked previous post as a solution to display 2 pages, but as @zoogara pointed out in this post, one can use a script to cycle through multiple pages.

1 Like