Strange problem with SDS011 - Sensor stops working after some time

I am having a strange issue, the sensor seems to work fine with the configuration below

  • platform: serial_pm
    serial_device: /dev/ttyUSB0
    scan_interval: 30
    name: Nova
    brand: novafitness,sds011

The problem is that it works fine for some time but then it stops updating the sensor values, even if I remove the sensor from my device. It still keeps showing the older values no matter what happens.

If I restart my device pi only then the values are updated correctly.

is there any solution to this problem. I am using raspberry pi 3

thanks,

Unfortunately SDS011 support in serial_pm platform is broken:

  • Home Assistant consumes data from sensor too slowly, so internal serial buffer grows and old measurements are read
  • there is no support for turning off laser between measurements resulting in short sensor life

I’ve created custom component for SDS011 addressing above issues: https://github.com/mrk-its/homeassistant-sds011

1 Like

I’ve changed my “configuration.yalm” file with the values it proposes. But still the readings, although they have decreased a lot, are still abnormally high.
Any suggestions for changes?
Thank you

hi mrk, do you know if the official support for this sensor has been improved or your custom component still is better than official? thanks.

Hi mrk, your custom component stopped working in 0.93. Any plans to update it?
Thanks.

@bezkod just fixed (directory layout of custom components changed in the meantime). Sorry it took so long.

hi mrk, thanks for updating the files.
However, I now face an issue:

Error while setting up platform sds011
Traceback (most recent call last):
  File "/home/pi/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/mnt/hass/custom_components/sds011/sensor.py", line 42, in setup_platform
    config.get(CONF_NUMBER_OF_MEASUREMENTS, 5),
  File "/mnt/hass/custom_components/sds011/sensor.py", line 74, in __init__
    self._sensor = sds011.SDS011(device, use_query_mode=True)
AttributeError: module 'sds011' has no attribute 'SDS011'

Does it work for you now?

Yes, it works for me. Could you provide output of following command:

python3 -c "import sds011; print(sds011)"

Please use the same python interpreter you are using for hass. It seems it tries to import something different than sds011 module from requirements.