Advertisement
tlse72

Untitled

Jun 16th, 2024 (edited)
795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.81 KB | None | 0 0
  1. api:
  2.   encryption:
  3.     key: "xxxxxxxxxxxxxxxxxxx"
  4.   services:
  5.     - service: display_text
  6.       variables:
  7.         message: string
  8.       then:
  9.         - text_sensor.template.publish:
  10.             id: display_message
  11.             state: !lambda 'return message;'
  12. i2c:
  13.   sda: GPIO22
  14.   scl: GPIO23
  15.   scan: True
  16.  
  17. font:
  18.   - id: my_font
  19.     file: "gfonts://Poppins"
  20.     size: 30
  21.  
  22. display:
  23.   - platform: ssd1306_i2c
  24.     id: my_display
  25.     model: "SSD1306 128x64"
  26.     address: 0x3C
  27.     rotation: 0
  28.     lambda: |-
  29.       if (id(display_message).state != "") {
  30.         it.printf(0, 0, id(my_font), "%s", id(display_message).state.c_str());
  31.       } else {
  32.         it.print(0, 0, id(my_font), "No message");
  33.       }
  34. text_sensor:
  35.   - platform: template
  36.     id: display_message
  37.     name: "Display Message"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement