Skip to content

Interactive display without homeassistant using TTGO buttons #2

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

Open
pacc opened this issue Feb 3, 2023 · 0 comments
Open

Interactive display without homeassistant using TTGO buttons #2

pacc opened this issue Feb 3, 2023 · 0 comments

Comments

@pacc
Copy link

pacc commented Feb 3, 2023

I'm just leaving my code here since I wanted to try out the TTGO display without any other dependencies.

Without homeassistant or attached sensors it would be nice to use the buttons on the TTGO to test out functionality,
Here is my attempt to update the display using predefined pages when clicking on a button:

esphome:
  name: ttgo

esp32:
  board: ttgo-lora32-v1
  framework:
    type: arduino

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO35
      inverted: true
    id: tdisplay_button_input_1
    on_click:
     - display.page.show: page2
     - component.update: my_display

  - platform: gpio
    pin:
      number: GPIO0
      inverted: true
    id: tdisplay_button_input_0
    on_click:
     - display.page.show: page1
     - component.update: my_display

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO19

display:
  - platform: st7789v
    model: TTGO TDisplay 135x240
    backlight_pin: GPIO4
    cs_pin: GPIO5
    dc_pin: GPIO16
    reset_pin: GPIO23
    id: my_display 
    pages:
      - id: page0        
        lambda: |-
          it.print(0, 10, id(roboto), "Hello!");
      - id: page1
        lambda: |-
          it.print(0, 10, id(roboto), "Button 1!");
      - id: page2
        lambda: |-
          it.print(0, 10, id(roboto), "Button 2!");

The pages can of course contain live data as define in this repository.
Define some passwords and fallback hotspot to use it in your wifi network with esphome functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant