Temperature sensor/ deep_sleep/ avoid first reading

Good afternoon. I’m using an esp32-c3 with a bme280 sensor. I’m using battery in deep_sleep.

I have “sleep_duration: 5min” and “run_duration: 3min” and the sensor has “update_interval: 175s”

The intention is that, when the esp32-c3 wakes up, it waits for the sensor temperature to remain stable, and only then sends the temperature reading. This is to avoid sending too low a temperature.
The problem is that as soon as the esp32-c3 wakes up the temperature value is updated, giving a lower value and 175 seconds later it gives a higher value.

Is there a way to avoid sending this first value when the board is still cold?

captive_portal:

i2c:
  sda: GPIO6
  scl: GPIO7

sensor:
  - platform: bme280_i2c
    temperature:
      name: "temperature-esp32-c3"
      filters:
        - offset: 0.0
    id: temp_sensor
    humidity:
      name: "humidade-esp32-c3"
      accuracy_decimals: 0
      filters:
        - offset: 0
    address: 0x76
    update_interval: 175s

  - platform: adc
    pin: GPIO2
    name: "voltage sensor"
    update_interval: 175s
    attenuation: 11db 
    accuracy_decimals: 1
    filters:
      - multiply: 2.0292
    id: original   

deep_sleep:
  run_duration: 
    default: 3min
    gpio_wakeup_reason: 3min
  sleep_duration: 5min
  wakeup_pin: 
    number: GPIO3
    inverted: True

button: 
  - platform: template
    name: "Sleep Mode"
    entity_category: diagnostic
    on_press:
      - deep_sleep.enter:
        
  - platform: template
    name: "Prevent Mode"
    entity_category: diagnostic
    on_press:
      - deep_sleep.prevent:

THS :+1:

There is a filter skip_initial

https://esphome.io/components/sensor/#skip-initialSensor Component — ESPHome

1 Like

Hello and thanks for your help… During the “skip_initial” period the sensor appears as unknown.

It’s a filter I haven’t used before, so I can’t say if that is the expected behavior or not. The sliding window filter can also skip the first couple of readings as well. However if you need exact values, that filter will average readings.

I think you are overthinking this. The BME280 sensor can’t be at a lower temperature than the area that you are looking to measure temperature if it’s temperature has equalized.

This sounds like you are waiting for the rate at which the BME absorbes energy to be the same rate at which it radiates energy but the temperature of the BME will not be at the same temperature of the area. I suggest just get the first reading the sensor reads and send the ESPhome device back to deep sleep. Heat creep is a problem with sensors like this. Temperature is all relative. 1 foot above your sensor will be different from the senor or 1 foot to the left or 3 feet in front of it.

1 Like

I changed sensors and now the first reading is the same as all the readings taken during the “wakeup” period