Hello,
Syntax question regarding displaying temp. reading from bme280 sensor.
Om a esp8266 board the sensor is measuring temp, humidity and pressure.
On e seperate esp32 I would like to display this bme280 temperature.
I succeed to display my name ( huray) the time but no succes th display the temp.
|-- 1.0
Compiling /data/display/.pioenvs/display/src/main.cpp.o
/config/esphome/display.yaml: In lambda function:
/config/esphome/display.yaml:75:85: warning: too many arguments for format [-Wformat-extra-args]
it.printf(0, 0, id(font1), TextAlign::TOP_LEFT ,“°C”, id(bme280_temperature).state);
^
Linking /data/display/.pioenvs/display/firmware.elf
RAM: [= ] 12.8% (used 41828 bytes from 327680 bytes)
Flash: [===== ] 50.6% (used 928734 bytes from 1835008 bytes)
Building /data/display/.pioenvs/display/firmware.bin
========================= [SUCCESS] Took 34.32 seconds =========================
INFO Successfully compiled program.
snippet from seliar port log
[13:57:04][C][homeassistant.sensor:030]: Homeassistant Sensor ‘bme280_temperature’
[13:57:04][C][homeassistant.sensor:030]: State Class: ‘’
[13:57:04][C][homeassistant.sensor:030]: Unit of Measurement: ‘°C’
[13:57:04][C][homeassistant.sensor:030]: Accuracy Decimals: 1
[13:57:04][C][homeassistant.sensor:031]: Entity ID: ‘bme280.temperature’
[13:57:09][D][api:098]: Accepted 192.168.0.102
[13:57:09][D][api:098]: Accepted 192.168.0.102
[13:57:09][D][api.connection:771]: Home Assistant 2021.12.2 (192.168.0.102): Connected successfully
[13:57:09][D][api.connection:771]: Home Assistant 2021.12.2 (192.168.0.102): Connected successfully
[13:57:09][D][time:039]: Synchronized time: 2021-12-17 13:57:10
[13:57:09][D][time:039]: Synchronized time: 2021-12-17 13:57:10
[14:02:00][I][ota:102]: Boot seems successful, resetting boot loop counter.
[14:02:00][D][esp32.preferences:114]: Saving preferences to flash…
snippet from my script
sensor:
- platform: homeassistant
id: bme280_temperature
entity_id: bme280.temperature
unit_of_measurement: “°C”
time:
- platform: homeassistant
id: homeassistanttime
Example configuration entry
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
miso_pin: GPIO12
color:
- id: my_red
red: 5%
green: 50%
blue: 50%
font:
- file: ‘/config/esphome/.esphome/custom_components/arial.ttf’
id: font1
size: 30
Example configuration entry
display:
-
platform: st7735
model: “INITR_BLACKTAB”
reset_pin: 19
cs_pin: 22
dc_pin: 21
rotation: 0
device_width: 128
device_height: 160
col_start: 0
row_start: 0
eight_bit_color: true
update_interval: 5slambda: |-
it.fill(Color::BLACK);
it.strftime(0, 60, id(font1), TextAlign::BASELINE_LEFT, “%H:%M:%S”, id(homeassistanttime).now());
if (id(bme280_temperature).has_state()) {
it.printf(0, 0, id(font1), TextAlign::TOP_LEFT ,“°C”, id(bme280_temperature).state);
}
somewhere some howe I go wrong. But where? Many attempt I had made no succes so far.
It drives me mad?
Any push in the correcr direction is very much apreciated.
regrads.ilioss