How to get temp and hum on an oled Home Assistant?

What more can I say…

You have a full tutorial here:

1 Like

I think i understand now, but i don’t find the folder: config/esphome

and also, if the file name is: “filename.ttf” should it be:

lambda: |-
it.print(0, 0, id(filename), “Hello World!”);
?

Now i got: /config/esphome/hemmis.yaml: In lambda function:
/config/esphome/hemmis.yaml:52:25: error: ‘Roboto’ was not declared in this scope
it.print(0, 0, id(Roboto-Regular.ttf), “Hello World!”);
^~~~~~
/config/esphome/hemmis.yaml:52:32: error: ‘Regular’ was not declared in this scope
it.print(0, 0, id(Roboto-Regular.ttf), “Hello World!”);
^~~~~~~
*** [.pioenvs/hemmis/src/main.o] Error 1

That’s wherever your esphome yaml files are saved.

No. It should be the id of the font: declaration

image

image

how do i find the declaration?

I think im on to something now… i declared it myself under in the code…

Now i get this: /data/cache/platformio/packages/toolchain-riscv32-esp/bin/…/lib/gcc/riscv32-esp-elf/8.4.0/…/…/…/…/riscv32-esp-elf/bin/ld: .pioenvs/hemmis/src/main.o: in function .LVL28': /config/esphome/hemmis.yaml:52: undefined reference to esphome::display::Display::print(int, int, esphome::display::BaseFont*, char const*)’
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/…/lib/gcc/riscv32-esp-elf/8.4.0/…/…/…/…/riscv32-esp-elf/bin/ld: .pioenvs/hemmis/src/main.o: in function esphome::api::APIServer* esphome::Application::register_component<esphome::api::APIServer>(esphome::api::APIServer*)': /data/build/hemmis/src/esphome/core/application.h:149: undefined reference to vtable for esphome::i2c::IDFI2CBus’
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/…/lib/gcc/riscv32-esp-elf/8.4.0/…/…/…/…/riscv32-esp-elf/bin/ld: /data/build/hemmis/src/esphome/core/application.h:149: undefined reference to vtable for esphome::i2c::IDFI2CBus' /data/cache/platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: .pioenvs/hemmis/src/main.o: in function setup()‘:
/data/build/hemmis/src/main.cpp:147: undefined reference to vtable for esphome::i2c::IDFI2CBus' /data/cache/platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: /data/build/hemmis/src/main.cpp:147: undefined reference to vtable for esphome::i2c::IDFI2CBus’
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/…/lib/gcc/riscv32-esp-elf/8.4.0/…/…/…/…/riscv32-esp-elf/bin/ld: /data/build/hemmis/src/main.cpp:254: undefined reference to vtable for esphome::ssd1306_i2c::I2CSSD1306' /data/cache/platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: /data/build/hemmis/src/main.cpp:254: undefined reference to vtable for esphome::ssd1306_i2c::I2CSSD1306’
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/…/lib/gcc/riscv32-esp-elf/8.4.0/…/…/…/…/riscv32-esp-elf/bin/ld: .pioenvs/hemmis/src/main.o: in function esphome::Application::register_sensor(esphome::sensor::Sensor*)': /data/build/hemmis/src/esphome/core/application.h:89: undefined reference to esphome::font::Font::Font(esphome::font::GlyphData const*, int, int, int)’
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/…/lib/gcc/riscv32-esp-elf/8.4.0/…/…/…/…/riscv32-esp-elf/bin/ld: .pioenvs/hemmis/src/main.o: in function setup()': /data/build/hemmis/src/main.cpp:268: undefined reference to esphome::display::Display::set_writer(std::function<void (esphome::display::Display&)>&&)’

This is what i have so far:

esphome:
  name: hemmis
  friendly_name: hemmis

esp32:
  board: esp32-c3-devkitm-1
  variant: esp32c3
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "6Q6KlUXNo/sFmWFl95FQ9w+xrD0wGvPkI9nhIRYOKbo="

ota:
  password: "3e0cf106f66397e5c25b617030953960"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Hemmis Fallback Hotspot"
    password: "BDjQBIjT7kdG"

captive_portal:
web_server:
sensor:
  - platform: dht
    model: AUTO_DETECT
    pin: 2
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    update_interval: 15s
i2c:
  sda: GPIO6
  scl: GPIO7
  scan: True

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
font:
  - file: 'Roboto-Regular.ttf'
    id: font1
    size: 8

Try to do a clean build

I did, now i don’t get any error, but i don’t get annything on the screen!

Please show the esphome runtime logging

I GOT IT!!! :smiley:

Thank you so much, but it dosent do annything good if i cant use the rest of the code, it seems like this part is the one messing it up: `
captive_portal:
web_server:
sensor:

  • platform: dht
    model: AUTO_DETECT
    pin: 2
    temperature:
    name: “Temperature”
    humidity:
    name: “Humidity”
    update_interval: 15s`

Now i got “Hello World!” on my display, i want to show the temperature and humidity from my dht22 sensor… on the display…

Come on, man, try to help yourself a bit.

See that part of the tutorial

      // Print inside temperature (from homeassistant sensor)
      if (id(inside_temperature).has_state()) {
        it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(inside_temperature).state);
      }
1 Like

yeah, but like we just found out, i need to find out why i cant combine the codes… i will try some different things and come back to you…

Try removing those first. The C3 might not be able to handle all those components together.
The ESPhome logging might give you hints.

Yes im having an out of memory error when compiling… I thought the c3 was a good one, and certanly thought it could run a couple of thing at the same time, Is there an esp you can recommend me to buy?

I have ordered an> Adafruit ESP32-S3 Feather 8MB flash…

cant remove cptive_portal, i get error…

Try to do a clean build?

Im trying now, but every time i try, it takes like 1hour and 30 min or something with compiling of files and then i get the error at the end with the write firmware file…