Display weather.home info on esphome ssd1306 oled

I would like to display my weather information such as Temp, Humidity and wind velocity on the display of my TTGO T-Camera ESP32 WROVER.

Basically take the info from weather.home and have it displayed on the OLED.

weather-OLED

This is my current config for the TTGO T-Camera

Any suggestions are much appreciated.

substitutions:
  devicename: ttgocam1
  friendly_name: Steve-Cam
  ip_address: 192.168.1.100

esphome:
  name: $devicename
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: MyLinkSys
  password: "1234567890"
  manual_ip:
    static_ip: 192.168.1.101
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  fast_connect: on

  # Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#    ssid: "Ttgocam1 Fallback Hotspot"
#    password: "1234123412"
#    ap_timeout:
#      seconds: 30      


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin: GPIO33
    name: $friendly_name PIR
    device_class: motion

  - platform: gpio
    pin:
      number: GPIO34
      mode: INPUT_PULLUP
      inverted: True
    name: $friendly_name Button

  - platform: status
    name: $friendly_name Status
    

    

sensor:
  - platform: wifi_signal
    name: $friendly_name WiFi Signal
    update_interval: 10s
  - platform: uptime
    name: $friendly_name Uptime

esp32_camera:
  name: $friendly_name Camera
  external_clock:
    pin: GPIO32
    frequency: 20MHz
  i2c_pins:
    sda: GPIO13
    scl: GPIO12
  data_pins: [GPIO5, GPIO14, GPIO4, GPIO15, GPIO18, GPIO23, GPIO36, GPIO39]
  vsync_pin: GPIO27
  href_pin: GPIO25
  pixel_clock_pin: GPIO19
  power_down_pin: GPIO26
  resolution: 640x480
  jpeg_quality: 10
  vertical_flip: true
  horizontal_mirror: true

i2c:
  sda: GPIO21
  scl: GPIO22

font:
  - file: "fonts/times-new-roman.ttf"
    id: tnr1
    size: 20
  - file: "fonts/times-new-roman.ttf"
    id: tnr2
    size: 35

time:
  - platform: homeassistant
    id: homeassistant_time

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER,"%d-%m-%Y", id(homeassistant_time).now());
      it.strftime(64, 64, id(tnr1), TextAlign::BASELINE_CENTER, "%d-%m-%Y", id(homeassistant_time).now());
      it.strftime(64, 128, id(tnr1), TextAlign::BASELINE_CENTER, "%A", id(homeassistant_time).now());

See the example here:

for displaying external sensors.

OK, this is what I got. What do you think? I really don’t understand how to use lamda’s such as the %s, I don’t understand what varible the “s” represents. Just so you know, I am by no means a programmers but try to get by.

substitutions:
  devicename: ttgocam1
  friendly_name: Steve-Cam
  ip_address: 192.168.1.100

esphome:
  name: $devicename
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: linksys
  password: "password"
  manual_ip:
    static_ip: 192.168.1.101
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  fast_connect: on

  # Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#    ssid: "Ttgocam1 Fallback Hotspot"
#    password: "password"
#    ap_timeout:
#      seconds: 30      


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin: GPIO33
    name: $friendly_name PIR
    device_class: motion

  - platform: gpio
    pin:
      number: GPIO34
      mode: INPUT_PULLUP
      inverted: True
    name: $friendly_name Button

  - platform: status
    name: $friendly_name Status
    

    

sensor:
  - platform: wifi_signal
    name: $friendly_name WiFi Signal
    update_interval: 10s
  - platform: uptime
    name: $friendly_name Uptime
#  - platform: homeassistant
#    entity_id: sensor.weathermet_temperature
#    id: out_temp
    

mqtt:
  broker: 192.168.1.207
  username: MQTT
  password: password
text_sensor:
  - platform: mqtt_subscribe
    name: "Weather data"
    id: weather_home  
    topic: weather/temp

#display:
#  - platform: ...
    # ...
#    lambda: |-
#      it.printf(0, 0, id(font), "The Temp is: %s", weather.home.state.c_str());

esp32_camera:
  name: $friendly_name Camera
  external_clock:
    pin: GPIO32
    frequency: 20MHz
  i2c_pins:
    sda: GPIO13
    scl: GPIO12
  data_pins: [GPIO5, GPIO14, GPIO4, GPIO15, GPIO18, GPIO23, GPIO36, GPIO39]
  vsync_pin: GPIO27
  href_pin: GPIO25
  pixel_clock_pin: GPIO19
  power_down_pin: GPIO26
  resolution: 640x480
  jpeg_quality: 10
  vertical_flip: true
  horizontal_mirror: true

i2c:
  sda: GPIO21
  scl: GPIO22

font:
  - file: "fonts/times-new-roman.ttf"
    id: tnr1
    size: 20
  - file: "fonts/times-new-roman.ttf"
    id: tnr2
    size: 35

time:
  - platform: homeassistant
    id: homeassistant_time

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER,"%s",  id(weather.home.now());
#      it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER,"%d-%m-%Y", id(homeassistant_time).now());
#      it.strftime(64, 64, id(tnr1), TextAlign::BASELINE_CENTER, "%d-%m-%Y", id(homeassistant_time).now());
#      it.strftime(64, 128, id(tnr1), TextAlign::BASELINE_CENTER, "%A", id(homeassistant_time).now());
1 Like

Did you get this working?

I did not, got the date to display but not the current weather

Check this example.

The section with sensors is what you need to change with the correct entity ids.

image