Hi all,
I’m currently implementing a combined temp/hum and co2 sensor with ePaper display, based on LilyGo T5-4.7 Plus (ESP32-S3), BME280 and a SCD40 CO2 sensor.
Now i want a button that I can press in HA to force recalibration of the CO2 sensor.
Here’s my current code:
esphome:
name: multisensdispl1
friendly_name: Multi-Sensor-Display SchlafZi
platformio_options:
board: lilygo-t5-47-plus
board_dir: boards
esp32:
variant: esp32s3
board: lilygo-t5-47-plus
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret home_assistant_encryption_key
ota:
password: !secret ota_password
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
reboot_timeout: 15min
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: Multi-Sensor-Display-SchlafZi
password: !secret fallback_ssid_password
mqtt:
broker: <removed>
username: <removed>
password: !secret mqtt_password
client_id: multi-sensor-display-schlafzi
external_components:
# https://github.com/nickolay/esphome-lilygo-t547plus
- source: github://nickolay/esphome-lilygo-t547plus
components: ["t547"]
#deep_sleep:
# run_duration: 30s
# sleep_duration: 1min
i2c:
- id: bus_a
sda: GPIO17
scl: GPIO18
#frequency: 10khz
# There is some problems with i2c scan so turn scan off if problem appear on your board
scan: False
sensor:
# BME 280 temp/hum sensor
- platform: bme280
temperature:
name: "Temperature"
#oversampling: 16x
id: temperature
device_class: temperature
unit_of_measurement: "°C"
accuracy_decimals: 1
#pressure:
# name: "BME280 Pressure"
humidity:
name: "Humidity"
id: humidity
device_class: humidity
unit_of_measurement: "%"
accuracy_decimals: 1
address: 0x76
i2c_id: bus_a
update_interval: 60s
# SCD40 CO2 sensor
- platform: scd4x
co2:
name: "CO2"
id: co2
device_class: carbon_dioxide
unit_of_measurement: "ppm"
accuracy_decimals: 0
altitude_compensation: 500m
address: 0x62
i2c_id: bus_a
update_interval: 60s
button:
- platform: template
name: "CO2 manual calibration (only in fresh air for at least 20min)"
entity_category: "config"
on_press:
then:
- scd4x.perform_forced_calibration:
value: 419
id: co2
time:
- platform: homeassistant
timezone: Europe/Berlin
id: ha_time
In the button section “co2” is unerlined red and says:
ID ‘co2’ of type sensor::Sensor doesn’t inherit from scd4x::SCD4XComponent. Please double check your ID is pointing to the correct value.
ID “co2” is assigned to the co2 component of platform scdx4, so I don’t understand why gives an error on the button…
Can anyone help? Do I have an error in my brain or is this a bug?
Thanks, Matthias