esphome / issues

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

mlx90614 reports invalid temperature and nan humidity #5199

Open khenderick opened 9 months ago

khenderick commented 9 months ago

The problem

The build-in component mlx90614 sometimes reports an invalid temperature and nan humidity. Re-installing the device might resolve the issue sometimes. Once my device has invalid readings, I need to keep reinstalling the same code again until it is solved.

Which version of ESPHome has the issue?

2023.11.6

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.11.3

What platform are you using?

ESP32

Board

m5stack-atom

Component causing the issue

mlx90614

Example YAML snippet

...
i2c:
  sda: 22
  scl: 19
  frequency: 100kHz

sensor:
  - platform: mlx90614
    ambient:
      name: "IR ambient temperature"
      unit_of_measurement: °C
      accuracy_decimals: 2
      filters:
        - sliding_window_moving_average:
            window_size: 4
            send_every: 2
    object:
      name: "IR object temperature"
      unit_of_measurement: °C
      accuracy_decimals: 2
      filters:
        - sliding_window_moving_average:
            window_size: 4
            send_every: 2
...

Anything in the logs that might be useful for us?

[10:08:21][D][mlx90614:112]: Got Temperature=-124.2°C Ambient=nan°C
[10:08:21][D][sensor:094]: 'IR object temperature': Sending state -124.18999 °C with 2 decimals of accuracy
[17:44:44][C][mlx90614:079]: MLX90614:
[17:44:44][C][mlx90614:080]:   Address: 0x5A
[17:44:44][C][mlx90614:084]:   Update Interval: 60.0s
[17:44:44][C][mlx90614:085]:   Ambient 'IR ambient temperature'
[17:44:44][C][mlx90614:085]:     Device Class: 'temperature'
[17:44:44][C][mlx90614:085]:     State Class: 'measurement'
[17:44:44][C][mlx90614:085]:     Unit of Measurement: '°C'
[17:44:44][C][mlx90614:085]:     Accuracy Decimals: 2
[17:44:44][C][mlx90614:086]:   Object 'IR object temperature'
[17:44:44][C][mlx90614:086]:     Device Class: 'temperature'
[17:44:44][C][mlx90614:086]:     State Class: 'measurement'
[17:44:44][C][mlx90614:086]:     Unit of Measurement: '°C'
[17:44:44][C][mlx90614:086]:     Accuracy Decimals: 2

Additional information

I'm using an M5Stack Atom and their mlx90614 module.

tommy4st commented 9 months ago

I had got the same problem with version 2023.10.6 after running the sensor for some time. I upgraded to 2023.11.6 and the problem persisted, so I pulled the plug and plugged it in again, now it's working properly once more.

It's actually a "nan" ambient temperature and not humidity.

Details regarding my hardware/software:

HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.40405.230623 (4.4.5) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

khenderick commented 5 months ago

Unfortunately I still have this issue, so I'd like to keep it open and eventually fixed if possible.

jandechent commented 1 month ago

Remove the filters, for me that works. Although this is of course a core function.

jandechent commented 1 month ago

The MLX90393 integration has a much richer sensor.py. In particular it has a property CONF_FILTER. Maybe adding is not ultra complicated, but I dont have the experience to do that.

jandechent commented 1 month ago

Actually, I had previously reported I have the same issue. Then suddenly it worked and then suddenly not. So I went to the hardware and one of the I2C wire connectors was slightly loose. I replaced my wiring all works since then. Or it was because I disconnected everything from power. Not sure, point is, the software seems to work perfectly.