What's wrong with my Yaml?

Hello
I’m new to the forum and I’m having a problem with an OLED 1306 display.
I want it to read the data from a BMP85 temperature sensor. This is the code I compiled.
The clock works perfectly, but it doesn’t give the temperature reading and only says “nam.”
I apologize in advance, in case I’m not handling this help request correctly, as I’m about to throw in the towel.
Thanks.
esphome:
name: teoled
friendly_name: teoled

esp32:
board: esp32dev
framework:
type: arduino

Enable logging

logger:

Enable Home Assistant API

api:
encryption:
key: “LahY+Kzlak48G8Y6K6TuwWZeD2x2zosaYsZ9Fkdfyek=”

ota:

  • platform: esphome
    password: “9859c9d97f487320dd728ffb6384502b”

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

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: “Teoled Fallback Hotspot”
password: “bCfFAF89pjxb”

captive_portal:
i2c:
sda: GPIO21
scl: GPIO22
scan: True

font:

  • file: “gfonts://Roboto”
    id: font14
    size: 14
  • file: “gfonts://Roboto”
    id: font25
    size: 25
    time:
  • platform: homeassistant
    id: hora

sensor:

  • platform: homeassistant
    id: temperatura
    entity_id: sensor.temperatura
    internal: true

display:

  • platform: ssd1306_i2c
    id: pantalla
    model: “SSD1306 128x64”
    address: 0x3C
    pages:
    • id: page1
      lambda: |-

      it.strftime(0, 25, id(font25), “%H:%M”, id(hora).now());

    • id: page2
      lambda: |-
      it.print(0, 0, id(font14), “temperatura”);
      it.printf(0, 25, id(font25), “%.1f C”, id(temperatura).state);

interval:

  • interval: 10s
    then:
    • display.page.show_next: pantalla
    • component.update: pantalla
      web_server:

Hi - before we start - you need to read this:

Especially section 11 re formatting.

Enclose your yaml in preformatted text tags so that we can see your formatted code properly .

1 Like

Hi

Format your post correctly as difficult for us to read, however your sensor component is wrong, you have platform as home assistant which is for a sensor connected to Home assistant rather than directly. See below for correct use of the sensor bit

1 Like

Q: What’s wrong with your yaml?

A: It’s not yaml :slight_smile:

3 Likes

I hope you’ll forgive me. I understand that the forum isn’t a Home Assistant help center.
I don’t know how to upload the Yaml file. I download it, and the text editor is Windows Notepad, and that’s what I paste and copy.
I’m sorry, no clumsiness.


use the little symbol and paste your code form notepad betwen the lines.

1 Like

Do you know why I don’t have code tags on my icons?
I need to get it from “gear” icon

1 Like

hey, not sure about the yaml, but know that you can send the file to GPT/gemini (or copy paste it’s content, it doesn’t care about formatting) and ask what’s wrong with it, it personally solved a ton of issues for me
also - note that you uploaded some passwords/api keys in your post, would suggest you change those

1 Like

I suspect it’s just screen layout from whatever device you are using. They don’t appear in the bar if I open a reply from my phone.

Ok, thanks.
For me it appears on phone but not on laptop.

I can assure you that I’ve tried it in Gemini and Deepseek and in Chatgpt, but when I try to validate, it always gives me an error.
Thanks for the advice

Then try to post your yaml here like suggested above…

Use three backticks either side of the code:

```
CODE GOES HERE
```

Then it gets properly formatted.

1 Like

I edited it with Notepad++ in yaml format.
I hope you can help me.


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

captive_portal:
i2c:
sda: GPIO21
scl: GPIO22
scan: True

font:
- file: "gfonts://Roboto"
id: font14
size: 14
- file: "gfonts://Roboto"
id: font25
size: 25
time:
- platform: homeassistant
id: hora





sensor:
- platform: homeassistant
id: temperatura
entity_id: sensor.temperatura
internal: true


display:
- platform: ssd1306_i2c
id: pantalla
model: "SSD1306 128x64"
address: 0x3C
pages:
- id: page1
lambda: |-

it.strftime(0, 25, id(font25), "%H:%M", id(hora).now());




- id: page2
lambda: |-
it.print(0, 0, id(font14), "temperatura");
it.printf(0, 25, id(font25), "%.1f C", id(temperatura).state);



interval:
- interval: 10s
then:
- display.page.show_next: pantalla
- component.update: pantalla
web_server:``
type or paste code here

That’s still not indented correctly. Indentation is critical in YAML. Try again, and don’t post until it looks the same as the code in your ESPHome editor.

1 Like

I’m pretty sure that if you read all the replies here, you can post your yaml properly…

esp32:
board: esp32dev
framework:
type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
encryption:
key: "LahY+Kzlak48G8Y6K6TuwWZeD2x2zosaYsZ9Fkdfyek="

ota:
- platform: esphome
password: "9859c9d97f487320dd728ffb6384502b"

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

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

captive_portal:
i2c:
sda: GPIO21
scl: GPIO22
scan: True

font:
- file: "gfonts://Roboto"
id: font14
size: 14
- file: "gfonts://Roboto"
id: font25
size: 25
time:
- platform: homeassistant
id: hora





sensor:
- platform: homeassistant
id: temperatura
entity_id: sensor.temperatura
internal: true


display:
- platform: ssd1306_i2c
id: pantalla
model: "SSD1306 128x64"
address: 0x3C
pages:
- id: page1
lambda: |-

it.strftime(0, 25, id(font25), "%H:%M", id(hora).now());




- id: page2
lambda: |-
it.print(0, 0, id(font14), "temperatura");
it.printf(0, 25, id(font25), "%.1f C", id(temperatura).state);



interval:
- interval: 10s
then:
- display.page.show_next: pantalla
- component.update: pantalla
web_server:

That’s not yaml, no way it could compile.
Just copy the yaml from your file and post it here using code tags like instructed several times above.

First two lines, for example, should read:

esp32:
  board: esp32dev

…with two spaces before the board declaration. As I said above, copy the code from your ESPHome addon, type three backticks:

```

…paste the code, then finish with three more backticks.

It may seem like we’re being pedantic, but there could be gross errors in your file that we simply cannot see until you paste it correctly.

Also, please show a screenshot from HA of your temperature sensor sensor.temperatura like this:

…and the correctly-formatted boot logs from the ESP device, like this, showing it receiving the sensor readings from HA:

INFO ESPHome 2025.4.2
INFO Reading configuration /config/hall-temperature.yaml...
INFO Detected timezone 'Europe/London'
INFO Starting log output from 192.168.1.34 using esphome API
INFO Successfully connected to hall-temperature @ 192.168.1.34 in 0.003s
INFO Successful handshake with hall-temperature @ 192.168.1.34 in 2.575s
[20:23:26][I][app:100]: ESPHome version 2025.4.2 compiled on May 21 2025, 10:47:00
[20:23:27][C][wifi:600]: WiFi:
[20:23:27][C][wifi:428]:   Local MAC: DC:4F:22:1D:87:26
[20:23:27][C][wifi:433]:   SSID: [redacted]
[20:23:27][C][wifi:436]:   IP Address: 192.168.1.34
[20:23:27][C][wifi:439]:   BSSID: [redacted]
[20:23:27][C][wifi:441]:   Hostname: 'hall-temperature'
[20:23:27][C][wifi:443]:   Signal strength: -68 dB ▂▄▆█
[20:23:27][C][wifi:447]:   Channel: 11
[20:23:27][C][wifi:448]:   Subnet: 255.255.255.0
[20:23:27][C][wifi:449]:   Gateway: 192.168.1.1
[20:23:27][C][wifi:450]:   DNS1: 0.0.0.0
[20:23:27][C][wifi:451]:   DNS2: 0.0.0.0
[20:23:27][C][logger:177]: Logger:
[20:23:27][C][logger:178]:   Max Level: DEBUG
[20:23:27][C][logger:179]:   Initial Level: DEBUG
[20:23:27][C][logger:181]:   Log Baud Rate: 115200
[20:23:27][C][logger:182]:   Hardware UART: UART0
[20:23:27][C][logger:186]:   Level for 'component': ERROR
[20:23:27][C][i2c.arduino:071]: I2C Bus:
[20:23:27][C][i2c.arduino:072]:   SDA Pin: GPIO4
[20:23:27][C][i2c.arduino:073]:   SCL Pin: GPIO5
[20:23:27][C][i2c.arduino:074]:   Frequency: 50000 Hz
[20:23:27][C][i2c.arduino:086]:   Recovery: bus successfully recovered
[20:23:27][C][gpio.one_wire:020]: GPIO 1-wire bus:
[20:23:27][C][gpio.one_wire:021]:   Pin: GPIO14
[20:23:27][C][gpio.one_wire:080]:   Found devices:
[20:23:27][C][gpio.one_wire:082]:     0xf40316813883ff28 (DS18B20)
[20:23:27][C][switch.gpio:068]: GPIO Switch 'Hall sensor onboard LED'
[20:23:27][C][switch.gpio:090]:   Restore Mode: always OFF
[20:23:27][C][switch.gpio:031]:   Pin: GPIO2
[20:23:27][C][restart.button:017]: Restart Button 'Hall sensor restart'
[20:23:27][C][restart.button:017]:   Icon: 'mdi:restart'
[20:23:27][C][status:034]: Status Binary Sensor 'Hall sensor status'
[20:23:27][C][status:034]:   Device Class: 'connectivity'
[20:23:27][C][homeassistant.time:010]: Home Assistant Time:
[20:23:27][C][homeassistant.time:011]:   Timezone: 'GMT0BST,M3.5.0/1,M10.5.0'
[20:23:27][C][dallas.temp.sensor:029]: Dallas Temperature Sensor:
[20:23:27][C][dallas.temp.sensor:034]:   Address: 0xf40316813883ff28 (DS18B20)
[20:23:27][C][dallas.temp.sensor:035]:   Resolution: 12 bits
[20:23:27][C][dallas.temp.sensor:036]:   Update Interval: 30.0s
[20:23:27][C][ssd1306_i2c:023]: I2C SSD1306
[20:23:27][C][ssd1306_i2c:023]:   Rotations: 0 °
[20:23:27][C][ssd1306_i2c:023]:   Dimensions: 128px x 64px
[20:23:27][C][ssd1306_i2c:024]:   Address: 0x3C
[20:23:27][C][ssd1306_i2c:025]:   Model: SH1106 128x64
[20:23:27][C][ssd1306_i2c:027]:   External VCC: NO
[20:23:27][C][ssd1306_i2c:028]:   Flip X: YES
[20:23:27][C][ssd1306_i2c:029]:   Flip Y: YES
[20:23:27][C][ssd1306_i2c:030]:   Offset X: 0
[20:23:27][C][ssd1306_i2c:031]:   Offset Y: 0
[20:23:27][C][ssd1306_i2c:032]:   Inverted Color: NO
[20:23:27][C][ssd1306_i2c:033]:   Update Interval: 3.0s
[20:23:27][C][captive_portal:089]: Captive Portal:
[20:23:27][C][mdns:116]: mDNS:
[20:23:27][C][mdns:117]:   Hostname: hall-temperature
[20:23:27][C][esphome.ota:073]: Over-The-Air updates:
[20:23:27][C][esphome.ota:074]:   Address: 192.168.1.34:8266
[20:23:27][C][esphome.ota:075]:   Version: 2
[20:23:27][C][esphome.ota:078]:   Password configured
[20:23:27][C][safe_mode:018]: Safe Mode:
[20:23:27][C][safe_mode:019]:   Boot considered successful after 60 seconds
[20:23:27][C][safe_mode:021]:   Invoke after 10 boot attempts
[20:23:27][C][safe_mode:022]:   Remain in safe mode for 300 seconds
[20:23:27][C][api:140]: API Server:
[20:23:27][C][api:141]:   Address: 192.168.1.34:6053
[20:23:27][C][api:143]:   Using noise encryption: YES
[20:23:27][C][wifi_signal.sensor:010]: WiFi Signal 'Hall sensor wifi signal'
[20:23:27][C][wifi_signal.sensor:010]:   Device Class: 'signal_strength'
[20:23:27][C][wifi_signal.sensor:010]:   State Class: 'measurement'
[20:23:27][C][wifi_signal.sensor:010]:   Unit of Measurement: 'dBm'
[20:23:27][C][wifi_signal.sensor:010]:   Accuracy Decimals: 0
[20:23:27][C][homeassistant.binary_sensor:039]: Homeassistant Binary Sensor 'Day Night CH setting from HA'
[20:23:27][C][homeassistant.binary_sensor:040]:   Entity ID: 'schedule.heating_day'
[20:23:27][C][homeassistant.binary_sensor:039]: Homeassistant Binary Sensor 'CH Run from HA'
[20:23:27][C][homeassistant.binary_sensor:040]:   Entity ID: 'switch.chc_central_heating_relay'
[20:23:27][C][homeassistant.binary_sensor:039]: Homeassistant Binary Sensor 'HW Run from HA'
[20:23:27][C][homeassistant.binary_sensor:040]:   Entity ID: 'switch.chc_gas_water_heating_relay'
[20:23:27][C][homeassistant.sensor:030]: Homeassistant Sensor 'Outside temperature'
[20:23:27][C][homeassistant.sensor:030]:   State Class: ''
[20:23:27][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[20:23:27][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[20:23:27][C][homeassistant.sensor:031]:   Entity ID: 'sensor.outside_temperature'
[20:23:27][C][homeassistant.sensor:030]: Homeassistant Sensor 'Wind speed'
[20:23:27][C][homeassistant.sensor:030]:   State Class: ''
[20:23:27][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[20:23:27][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[20:23:27][C][homeassistant.sensor:031]:   Entity ID: 'sensor.lichfield_wind_speed'
[20:23:27][C][homeassistant.text_sensor:023]: Homeassistant Text Sensor 'CH mode'
[20:23:27][C][homeassistant.text_sensor:024]:   Entity ID: 'climate.central_heating'
[20:23:27][C][homeassistant.text_sensor:023]: Homeassistant Text Sensor 'Wind bearing'
[20:23:27][C][homeassistant.text_sensor:024]:   Entity ID: 'sensor.lichfield_wind_bearing'
[20:23:27][C][homeassistant.sensor:030]: Homeassistant Sensor 'Target CH temperature'
[20:23:27][C][homeassistant.sensor:030]:   State Class: ''
[20:23:27][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[20:23:27][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[20:23:27][C][homeassistant.sensor:031]:   Entity ID: 'sensor.central_heating_target_temperature'
[20:23:27][C][homeassistant.sensor:030]: Homeassistant Sensor 'Screen brightness'
[20:23:27][C][homeassistant.sensor:030]:   State Class: ''
[20:23:27][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[20:23:27][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[20:23:27][C][homeassistant.sensor:031]:   Entity ID: 'sensor.hall_screen_brightness'
1 Like

It seems you dont understand at all.
People are telling you to post in yaml format but it seems you dont understand.

See how a .yaml looks like:

a yaml need to be formatted especially.

for example in your case you have:

esp32:
board: esp32dev
framework:
type: arduino

which is totally wrong

It should be like this:

esp32:
  board: esp32dev
  framework:
    type: arduino

as long as you dont post it like this, the machine (your server (Home assistant) ) wont read it right.

Fix that and you are good to go.

1 Like