Hi All,
I know there are several tutorials and such on this but I’ve been through all I can find and can’t get it to work. I have a D1 mini running a 1w temp sensor and returning the data to HA, which has worked reliable for months. The sensor id, copied from the sensor data window is:-
sensor.esphome_web_cca271_downstairs_temp
I have another D1 with an SSD1306 display that I want to display the temperature on. I have the following code:-
esphome:
name: esphome-web-1444c2
friendly_name: Dev Board
min_version: 2024.11.0
name_add_mac_suffix: false
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
wifi:
# Set up a wifi access point
ap: {}
# fonts
font:
- file: "baby_mine_plump.ttf"
id: font1
size: 49
- file: "baby_mine_plump.ttf"
id: font2
size: 12
time:
- platform: homeassistant
id: esptime
i2c:
sda: GPIO05
scl: GPIO04
scan: false
sensor:
- platform: homeassistant
entity_id: sensor.esphome_web_cca271_downstairs_temp
id: temperature
display:
- platform: ssd1306_i2c
model: "SH1106 128x64"
address: 0x3C
lambda: |-
it.printf(0, 15, id(font1), "%.1f°", id(temperature).state);
it.strftime(0, 0, id(font2), "%H:%M", id(esptime).now());
The time display works but the temperature just states “nan”. I’ve tried with several sensors and nothing is working.
The device log shows this:-
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.68.127 using esphome API
INFO Successfully connected to esphome-web-1444c2 @ 192.168.68.127 in 19.684s
INFO Successful handshake with esphome-web-1444c2 @ 192.168.68.127 in 0.021s
[10:18:21][I][app:100]: ESPHome version 2024.12.4 compiled on Feb 1 2025, 10:17:50
[10:18:21][C][wifi:600]: WiFi:
[10:18:21][C][wifi:428]: Local MAC: C8:C9:A3:14:44:C2
[10:18:21][C][wifi:433]: SSID: [redacted]
[10:18:21][C][wifi:436]: IP Address: 192.168.68.127
[10:18:21][C][wifi:439]: BSSID: [redacted]
[10:18:21][C][wifi:441]: Hostname: 'esphome-web-1444c2'
[10:18:21][C][wifi:443]: Signal strength: -56 dB ▂▄▆█
[10:18:21][C][wifi:447]: Channel: 7
[10:18:21][C][wifi:448]: Subnet: 255.255.252.0
[10:18:21][C][wifi:449]: Gateway: 192.168.68.1
[10:18:21][C][wifi:450]: DNS1: 192.168.1.254
[10:18:21][C][wifi:451]: DNS2: 192.168.68.1
[10:18:21][C][logger:185]: Logger:
[10:18:21][C][logger:186]: Level: DEBUG
[10:18:21][C][logger:188]: Log Baud Rate: 115200
[10:18:21][C][logger:189]: Hardware UART: UART0
[10:18:21][C][i2c.arduino:071]: I2C Bus:
[10:18:21][C][i2c.arduino:072]: SDA Pin: GPIO5
[10:18:21][C][i2c.arduino:073]: SCL Pin: GPIO4
[10:18:21][C][i2c.arduino:074]: Frequency: 50000 Hz
[10:18:21][C][i2c.arduino:086]: Recovery: bus successfully recovered
[10:18:21][C][homeassistant.time:010]: Home Assistant Time:
[10:18:21][C][homeassistant.time:011]: Timezone: 'GMT0BST,M3.5.0/1,M10.5.0'
[10:18:21][C][ssd1306_i2c:023]: I2C SSD1306
[10:18:21][C][ssd1306_i2c:023]: Rotations: 0 °
[10:18:21][C][ssd1306_i2c:023]: Dimensions: 128px x 64px
[10:18:21][C][ssd1306_i2c:024]: Address: 0x3C
[10:18:21][C][ssd1306_i2c:025]: Model: SH1106 128x64
[10:18:21][C][ssd1306_i2c:027]: External VCC: NO
[10:18:21][C][ssd1306_i2c:028]: Flip X: YES
[10:18:21][C][ssd1306_i2c:029]: Flip Y: YES
[10:18:21][C][ssd1306_i2c:030]: Offset X: 0
[10:18:21][C][ssd1306_i2c:031]: Offset Y: 0
[10:18:21][C][ssd1306_i2c:032]: Inverted Color: NO
[10:18:21][C][ssd1306_i2c:033]: Update Interval: 1.0s
[10:18:21][C][mdns:116]: mDNS:
[10:18:21][C][mdns:117]: Hostname: esphome-web-1444c2
[10:18:21][C][esphome.ota:073]: Over-The-Air updates:
[10:18:21][C][esphome.ota:074]: Address: esphome-web-1444c2.local:8266
[10:18:21][C][esphome.ota:075]: Version: 2
[10:18:21][C][safe_mode:018]: Safe Mode:
[10:18:21][C][safe_mode:019]: Boot considered successful after 60 seconds
[10:18:21][C][safe_mode:021]: Invoke after 10 boot attempts
[10:18:21][C][safe_mode:022]: Remain in safe mode for 300 seconds
[10:18:21][C][api:140]: API Server:
[10:18:21][C][api:141]: Address: esphome-web-1444c2.local:6053
[10:18:21][C][api:145]: Using noise encryption: NO
[10:18:21][C][homeassistant.sensor:030]: Homeassistant Sensor 'temperature'
[10:18:21][C][homeassistant.sensor:030]: State Class: ''
[10:18:21][C][homeassistant.sensor:030]: Unit of Measurement: ''
[10:18:21][C][homeassistant.sensor:030]: Accuracy Decimals: 1
[10:18:21][C][homeassistant.sensor:031]: Entity ID: 'sensor.esphome_web_cca271_downstairs_temp'
[10:18:22][W][component:237]: Component display took a long time for an operation (319 ms).
[10:18:22][W][component:238]: Components should block for at most 30 ms.
[10:18:23][W][component:237]: Component display took a long time for an operation (319 ms).
[10:18:23][W][component:238]: Components should block for at most 30 ms.
I’m sure it’s something stupid I’ve done but can’t spot it. Can anybody help?
Phil