Can not display T and H on OLED

Looked in other posts, but no solution.
No ‘temperature’ and ‘humidity’ displayed; only ‘txt’ and ‘time’.
My code ‘ESPHome’ .yaml is - as below.
In hass.io both parameters are displayed…

esphome:
  name: display_station_01
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "HOME-WI-FI"
  password: "xxxxxx"
  
# Manual IP
  manual_ip:
    static_ip: 192.168.1.141
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 8.8.8.8
    dns2: 8.8.4.4
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Display Station 01"
    password: "T34cen9lZ7jZ"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "xxxxxx"

ota:
  password: "xxxxxx"
  
  
  
# i2c bus of SSD1306
i2c:
   sda: GPIO0
   scl: GPIO2
   scan: true
 
# OLED SSD1306 configuration
# display:
#    platform: ssd1306_i2c
#    model: "SSD1306 128x64"
#    address: 0x3C
#    lambda: |-
#      it.print(0, 0, id(font1), "Hello World!");
 
# Some fonts & images to display
font:
    file: "Roboto-Light.ttf"
    id: font1
    size: 12  
    
    
# Time to be displayed on OLED SSD1306
time:
    platform: homeassistant
    id: esptime
   
# Parameters to be displayed on OLED SSD1306   
sensor:
  - platform: homeassistant
    id: outside_temperature
    entity_id: sensor.switch_sonoff_01_bme280_temperature
    internal: true

  - platform: homeassistant
    id: outside_humidity
    entity_id: sensor.switch_sonoff_01_bme280_humidity
    internal: true  
    
  - platform: homeassistant
    id: outside_pressure
    entity_id: sensor.switch_sonoff_01_bme280_pressure
    internal: true
    
# OLED SSD1306 configuration
display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      // Print "My Home" in top center.
      it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "My Home");

      // Print time in HH:MM format
      it.strftime(0, 60, id(font1), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());

      // Print outside temperature (from homeassistant sensor)
        it.printf(127, 23, id(font1), TextAlign::TOP_RIGHT , "%.1f °C", id(outside_temperature).state);

      // Print outside humidity (from homeassistant sensor)
        it.printf(127, 60, id(font1), TextAlign::BASELINE_RIGHT , "%.0f %%", id(outside_humidity).state);
 

oled

What does your log say?

Not so much for me… Has anyone was doing similar installation/integration?

INFO Reading configuration /config/esphome/display_station_01.yaml...
INFO Detected timezone 'CET' with UTC offset 1 and daylight savings time from 29 March 02:00:00 to 25 October 03:00:00
INFO Starting log output from 192.168.1.141 using esphome API
INFO Connecting to 192.168.1.141:6053 (192.168.1.141)
INFO Successfully connected to 192.168.1.141
[10:21:51][I][app:100]: ESPHome version 1.14.3 compiled on Dec  7 2019, 02:12:26
[10:21:51][C][wifi:415]: WiFi:
[10:21:51][C][wifi:283]:   SSID: [redacted]
[10:21:51][C][wifi:284]:   IP Address: 192.168.1.141
[10:21:51][C][wifi:286]:   BSSID: [redacted]
[10:21:51][C][wifi:287]:   Hostname: 'display_station_01'
[10:21:51][C][wifi:291]:   Signal strength: -80 dB ▂▄▆█
[10:21:51][C][wifi:295]:   Channel: 5
[10:21:51][C][wifi:296]:   Subnet: 255.255.255.0
[10:21:51][C][wifi:297]:   Gateway: 192.168.1.1
[10:21:51][C][wifi:298]:   DNS1: 8.8.8.8
[10:21:51][C][wifi:299]:   DNS2: 8.8.4.4
[10:21:51][C][i2c:028]: I2C Bus:
[10:21:51][C][i2c:029]:   SDA Pin: GPIO0
[10:21:51][C][i2c:030]:   SCL Pin: GPIO2
[10:21:51][C][i2c:031]:   Frequency: 50000 Hz
[10:21:51][I][i2c:033]: Scanning i2c bus for active devices...
[10:21:51][I][i2c:040]: Found i2c device at address 0x3C
[10:21:51][C][logger:175]: Logger:
[10:21:51][C][logger:176]:   Level: DEBUG
[10:21:51][C][logger:177]:   Log Baud Rate: 115200
[10:21:51][C][logger:178]:   Hardware UART: UART0
[10:21:51][C][homeassistant.time:010]: Home Assistant Time:
[10:21:51][C][homeassistant.time:011]:   Timezone: 'CET-1CEST-2,M3.5.0/2,M10.4.0/3'
[10:21:51][C][ssd1306_i2c:023]: I2C SSD1306
[10:21:51][C][ssd1306_i2c:023]:   Rotations: 0 °
[10:21:51][C][ssd1306_i2c:023]:   Dimensions: 128px x 64px
[10:21:51][C][ssd1306_i2c:024]:   Address: 0x3C
[10:21:51][C][ssd1306_i2c:025]:   Model: SSD1306 128x64
[10:21:51][C][ssd1306_i2c:027]:   External VCC: NO
[10:21:51][C][ssd1306_i2c:028]:   Update Interval: 1.0s
[10:21:51][C][captive_portal:169]: Captive Portal:
[10:21:51][C][ota:029]: Over-The-Air Updates:
[10:21:51][C][ota:030]:   Address: 192.168.1.141:8266
[10:21:51][C][ota:032]:   Using Password.
[10:21:51][C][api:095]: API Server:
[10:21:51][C][api:096]:   Address: 192.168.1.141:6053
[10:21:51][C][homeassistant.sensor:024]: Homeassistant Sensor 'outside_temperature'
[10:21:51][C][homeassistant.sensor:024]:   Unit of Measurement: ''
[10:21:51][C][homeassistant.sensor:024]:   Accuracy Decimals: 1
[10:21:51][C][homeassistant.sensor:025]:   Entity ID: 'sensor.switch_sonoff_01_bme280_temperature'
[10:21:51][C][homeassistant.sensor:024]: Homeassistant Sensor 'outside_humidity'
[10:21:51][C][homeassistant.sensor:024]:   Unit of Measurement: ''
[10:21:51][C][homeassistant.sensor:024]:   Accuracy Decimals: 1
[10:21:51][C][homeassistant.sensor:025]:   Entity ID: 'sensor.switch_sonoff_01_bme280_humidity'
[10:21:51][C][homeassistant.sensor:024]: Homeassistant Sensor 'outside_pressure'
[10:21:51][C][homeassistant.sensor:024]:   Unit of Measurement: ''
[10:21:51][C][homeassistant.sensor:024]:   Accuracy Decimals: 1
[10:21:51][C][homeassistant.sensor:025]:   Entity ID: 'sensor.switch_sonoff_01_bme280_pressure'
[10:23:30][I][ota:046]: Boot seems successful, resetting boot loop counter.

Not enough log, I don’t even see an api connection to home assistant yet! I get a couple of lines like this

[09:38:45][D][api.connection:583]: Client 'Home Assistant 0.102.3 (192.168.20.253)' connected successfully!
[09:38:45][D][time:029]: Synchronized time: Sat Dec  7 22:38:45 2019

Did you add the node to the integrations in HA? If you don’t add it in the integrations, esphome don’t have access to the HA entities.

Yes, this is what I have in ‘Integrations’.
In fact no any icon is shown below. It is ‘ESPHome: display_station_01’.
Should be done something with that?
The circuit I assembled is simple ‘ESP8266’ + ‘OLED 128x64’.

O.K. - working…
By unknown reason the ‘integration’ was faulty. I created manually 2nd.
And this one is good and ‘communicating’.
Now I must remove the 1st one.
It is strange - some bug in ‘hass.io’ ?
Why it is allowing to create 2nd ‘integration’ to the same ‘device’?

Just in case someone will look for ‘code’ example - attached.

esphome:
  name: display_station_01
  platform: esp8266
  board: esp01_1m

wifi:
  ssid: "HOME-WI-FI"
  password: "xxxxxx"
  
# Manual IP
  manual_ip:
    static_ip: 192.168.1.141
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 8.8.8.8
    dns2: 8.8.4.4
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Display Station 01"
    password: "T36cen9lZ7jX"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "xxxxxx"

ota:
  password: "xxxxxx"
  
  
  
# i2c bus of SSD1306
i2c:
   sda: GPIO0
   scl: GPIO2
   scan: true
 
# OLED SSD1306 configuration
# display:
#    platform: ssd1306_i2c
#    model: "SSD1306 128x64"
#    address: 0x3C
#    lambda: |-
#      it.print(0, 0, id(font1), "Hello World!");
 
# Some fonts & images to display
font:
  - file: "Roboto-Light.ttf"
    id: font8
    size: 8 
    
  - file: "arial_narrow_7.ttf"  
    id: font14
    size: 14
    
  - file: "BebasNeue-Regular.ttf"  
    id: font48_bebas
    size: 48
    
  - file: "HighSansSerif7-xZeR.ttf"  
    id: font60_serif
    size: 60
      
    
    
# Time to be displayed on OLED SSD1306
time:
    platform: homeassistant
    id: esptime
   
# Parameters to be displayed on OLED SSD1306   
sensor:
  - platform: homeassistant
    id: outside_temperature
    entity_id: sensor.switch_sonoff_01_bme280_temperature
    internal: true

  - platform: homeassistant
    id: outside_humidity
    entity_id: sensor.switch_sonoff_01_bme280_humidity
    internal: true 
    
  - platform: homeassistant
    id: outside_pressure
    entity_id: sensor.switch_sonoff_01_bme280_pressure
    internal: true
    
  - platform: wifi_signal
    name: "Display station 01 WiFi signal"
    update_interval: 60s
    
    
# OLED SSD1306 configuration
display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      // Print "Home Assistant" in top center.
      it.printf(64, 0, id(font8), TextAlign::TOP_CENTER, "Home Assistant");

      // Print time in HH:MM format
      it.strftime(0, 60, id(font60_serif), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());
      
      // Print outside temperature (from homeassistant sensor)
      if (id(outside_temperature).state == id(outside_temperature).state) {
        it.printf(127, 23, id(font14), TextAlign::TOP_RIGHT , "%.1f °C", id(outside_temperature).state);
      } else {
        it.print(127, 23, id(font8), TextAlign::TOP_RIGHT , "...waiting...");
      }
      
      // Print outside humidity (from homeassistant sensor)
      if (id(outside_humidity).state == id(outside_humidity).state) {
        it.printf(127, 37, id(font14), TextAlign::TOP_RIGHT , "%.0f %%", id(outside_humidity).state);
      } else {
        it.print(127, 37, id(font8), TextAlign::TOP_RIGHT , "...waiting...");
      }
      
      // Print outside pressure (from homeassistant sensor)
      if (id(outside_pressure).state == id(outside_pressure).state) {
        it.printf(127, 50, id(font14), TextAlign::TOP_RIGHT , "%.0f hPa", id(outside_pressure).state);
      } else {
        it.print(127, 50, id(font8), TextAlign::TOP_RIGHT , "...waiting...");
      }

3 Likes

Hello, on which page we will paste these codes. I couldn’t find the esphome.yaml file.

You need to study how esphome works.

2 Likes

Hello, I’ve been doing some research since yesterday. I’ve made progress. But it appears offline.

You found the file then :slight_smile:

1 Like

Yes :slight_smile: I installed the ESPHome plugin. I created the file. I added the codes. I edited the codes myself. But I couldn’t get the system to work. Status appears offline.

I don’t know what to do after this step. :frowning:

Does this system need to have esp8266 module to work?

image

Of course it does. Esphome is a programming system to program the firmware on an esp8266 (or esp32 or rp2040)

1 Like

Hi, I bought the modules. I integrated the page codes and got an error while trying to install.

ERROR Error resolving IP address of display-state-01.local. Is it connected to WiFi?
ERROR (If this error persists, please set a static IP address: WiFi Component — ESPHome)
ERROR Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname

Looks like your Wi-Fi /esp8266/ module is not connecting to your Wi-Fi network…
Can be many reasons…

Or one reason - I believe that they just copy pasted the above code which has a static IP and probably doesn’t match their router.

Have you installed esphome on that device over a serial connection prior to starting. The first flash has to be over serial (usually usb)

Hi guys, I’ve come a long way on the subject. I had to do a lot of research. I bought a usb stick for the ESP8266 module. Afterwards, it didn’t happen again. While I was researching on the internet, I saw that I had to make a chassis for the ESP8266 to be programmable. I did the same and it worked. I wrote the program in ESP. But the display still didn’t work. In the log records it says that it does not see SSD1306.

The modules I bought.
image

where I made the chassis.
information source: ESP8266 ESP-01 USB Serial Programmer with CH340 (Fix Programming Issue) - Maker Advisor

The error I encountered.