Hi guys,
Could someone more knowledgeable than me with ESPhome please see where I’m going wrong here.
The errors on compile in Python are:
src\main.cpp:242:7: error: stray '\302' in program
if (temperature->has_state()) { it.printf(10, 0, my_font, TextAlignTOP_LEFT , %.1f°, temperature->state); }
^
src\main.cpp:242:7: error: stray '\260' in program
Compiling .pioenvs\esp_poe_test\lib904\AsyncTCP-esphome\AsyncTCP.cpp.o
src\main.cpp: In lambda function:
src\main.cpp:242:24: error: 'class esphome::dht::DHT' has no member named 'has_state'
if (temperature->has_state()) { it.printf(10, 0, my_font, TextAlignTOP_LEFT , %.1f°, temperature->state); }
^
src\main.cpp:242:65: error: 'TextAlignTOP_LEFT' was not declared in this scope
if (temperature->has_state()) { it.printf(10, 0, my_font, TextAlignTOP_LEFT , %.1f°, temperature->state); }
^
src\main.cpp:242:85: error: expected primary-expression before '%' token
if (temperature->has_state()) { it.printf(10, 0, my_font, TextAlignTOP_LEFT , %.1f°, temperature->state); }
^
src\main.cpp:242:106: error: 'class esphome::dht::DHT' has no member named 'state'
if (temperature->has_state()) { it.printf(10, 0, my_font, TextAlignTOP_LEFT , %.1f°, temperature->state); }
And my mashup of code:
esphome:
name: esp_poe_test
platform: ESP32
board: esp32-poe-iso
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
power_pin: GPIO12
manual_ip:
static_ip: 10.0.0.20
gateway: 10.0.0.139
subnet: 255.0.0.0
i2c:
sda: 13
scl: 16
scan: True
id: bus_a
font:
file: BebasNeue-Regular.ttf
id: my_font
size: 68
display:
platform: ssd1306_i2c
model: SSD1306 128x64
#reset_pin D0
address: 0x3C
rotation: 0°
lambda:
if (id(temperature).has_state()) {
it.printf(10, 0, id(my_font), TextAlignTOP_LEFT, %.1f°, id(temperature).state);
}
sensor:
platform: dht
pin: 35
id: temperature
temperature:
name: temperature
humidity:
name: humidity
model: AM2302
update_interval: 60s
web_server:
port: 80
Thanks in advance for any tips!