Guest User

ESPHome_Oled

a guest
Feb 6th, 2020
235
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. esphome:
  2.   name: oled2
  3.   platform: ESP32
  4.   board: heltec_wifi_kit_32
  5. wifi:
  6.   ssid: "xxx"
  7.   password: "xxx"
  8.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  9.   ap:
  10.     ssid: "Oled2 Fallback Hotspot"
  11.     password: "Zf9oas35HAIZ"
  12. captive_portal:
  13. # Enable logging
  14. logger:
  15. # Enable Home Assistant API
  16. api:
  17. ota:
  18. sensor:
  19.   - platform: homeassistant
  20.     id: solare_temperature
  21.     entity_id: sensor.solare_termico
  22.     internal: true
  23.  
  24.   - platform: homeassistant
  25.     id: puffer_temperature
  26.     entity_id: sensor.puffer_medio_alto
  27.     internal: true
  28.    
  29.   - platform: homeassistant
  30.     id: pdc_power
  31.     entity_id: sensor.consumo_attuale_pdc
  32.     internal: true
  33.  
  34. time:
  35.   - platform: homeassistant
  36.     id: time1
  37.  
  38. i2c:
  39.   sda: GPIO4
  40.   scl: GPIO15
  41.   scan: false
  42.   frequency: 700khz
  43.  
  44. font:
  45. - file: 'arialblk.ttf'
  46.   id: font1
  47.   size: 48
  48. - file: 'arial.ttf'
  49.   id: font2
  50.   size: 15
  51. - file: 'arial.ttf'
  52.   id: font3
  53.   size: 8
  54.  
  55. image:
  56.   - file: "solar-power.png"
  57.     id: solar_icon
  58.  
  59. interval:
  60.   - interval: 3s
  61.     then:
  62.       - display.page.show_next: my_display
  63.       - component.update: my_display
  64.  
  65. display:
  66.   - platform: ssd1306_i2c
  67.     model: "SSD1306 128x64"
  68.     reset_pin: GPIO16
  69.     address: 0x3C
  70.     id: my_display
  71.     pages:
  72.       - id: page1
  73.         lambda: |-
  74.           it.printf(40, 1, id(font3), TextAlign::TOP_CENTER, "Solare Termico");
  75.           it.image(1, 30, id(solar_icon));
  76.           it.printf(50, 30, id(font2), TextAlign::BASELINE_LEFT , "%.1f°", id(solare_temperature).state);
  77.       - id: page2
  78.         lambda: |-
  79.           it.printf(1, 30, id(font2), TextAlign::BASELINE_LEFT , "Puffer PDC %.1f°", id(puffer_temperature).state);
  80.       - id: page3
  81.         lambda: |-
  82.           it.printf(1, 45, id(font2), TextAlign::BASELINE_LEFT , "Pot PDC %.1fW", id(pdc_power).state);
  83.       - id: page4
  84.         lambda: |-
  85.           it.strftime(0, 60, id(font1), TextAlign::BASELINE_LEFT, "%l:%M", id(time1).now());
RAW Paste Data