Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display page change with physical key #229

Closed
Ausonius opened this issue Apr 15, 2019 · 1 comment
Closed

Display page change with physical key #229

Ausonius opened this issue Apr 15, 2019 · 1 comment

Comments

@Ausonius
Copy link

Hi, how can you set the display pages with a fig key by taking a gpio from wemos d1 the following code I tried does not work a help please the code here:

  - platform: gpio
    name: "Pin D7"
    pin: D7
    on_press:
    - display.page.show_next: my_display
    - display.page.show_prev: my_display

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    update_interval: 50ms
    id: my_display
    pages:
      - id: page1
        lambda: | -
          it.printf (0, 2, id (font), "Relay 1:% s", id (relay_1) .state? "ON": "OFF");
          it.printf (73, 2, id (font), "Relay 5:% s", id (relay_5) .state? "ON": "OFF");
          it.printf (0, 13, id (font), "Relay 2:% s", id (relay_2) .state? "ON": "OFF");
          it.printf (73, 13, id (font), "Relay 6:% s", id (relay_6) .state? "ON": "OFF");
          it.printf (0, 25, id (font), "Relay 3:% s", id (relay_3) .state? "ON": "OFF");
          it.printf (73, 25, id (font), "Relay 7:% s", id (relay_7) .state? "ON": "OFF");
          it.printf (0, 37, id (font), "Relay 4:% s", id (relay_4) .state? "ON": "OFF");
          it.printf (73, 37, id (font), "Relay 8:% s", id (relay_8) .state? "ON": "OFF");
          it.printf (0, 55, id (font), "Wifi:% s", id (status) .value? "Online": "Offline");
          it.printf (102, 55, id (font), "% .1f", id (signal) .value);
          
      - id: page2
        lambda: | -
          it.strftime (0, 35, id (font), "Time:% H:% M", id (time) .now ());
          it.strftime (0, 45, id (font), "Date:% d.% m.% Y", id (time) .now ());

with this code on_press gives me error, of course the code is wrong I just wanted to change page with a key
as reported in the guide https://esphome.io/components/display/index.html
I look forward to your help, thanks

@close-issue-app
Copy link

#162

@esphome esphome locked and limited conversation to collaborators Jun 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant