esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

offset filter not working with aht platform #5669

Closed cuthulino closed 6 months ago

cuthulino commented 7 months ago

The problem

I am using the following config for reading an aht sensor. It needs a little offset but it is not working with this platform.

sensor:
  - platform: aht10
    id: aht_in
    i2c_id: bus_in
    variant: AHT20
    temperature:
      id: ga1_t_in
      name: temp in
      filters:
        - offset: 0.7
      on_value:
        then:
          - lambda: |-
              id(knxd).group_write_2byte_float("2/4/230", x);
    humidity:
      id: ga1_h_in
      name: hum in
      on_value:
        then:
          - lambda: |-
              id(knxd).group_write_2byte_float("2/5/230", x);
    update_interval: 120s

Testing it with a template sensor works without problems:

  - platform: template
    name: test
    lambda: "return id(ga1_t_in).state;"
    filters:
      - offset: 10

I already read that sometimes, after flashing via the cable, the offset works. I tried it but it doesnt work.

Which version of ESPHome has the issue?

2024.3.1

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32

Board

Espressif ESP-32 / ESP-WROOM-32

Component causing the issue

sensor/aht10

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

ssieb commented 7 months ago

How can you tell it isn't working?

cuthulino commented 7 months ago

Adding or removing the filter does not alter the sensor value. I tried with a high, good recognizable offset value and the output value in esphome logs and homeassistant do not change.

ssieb commented 6 months ago

Add an on_raw_value: trigger to print the raw value and show the logs.

cuthulino commented 6 months ago

After adding the logger lines i got this output:

[E][main:101]: The temperature sensor reports raw_value 22.8 
[E][main:095]: The temperature sensor reports value 23.5 

So the offset is set. Strange is the reported Temp in Homeassistant, it stepped up after I added the on_raw_value line: grafik