airgradient_esphome icon indicating copy to clipboard operation
airgradient_esphome copied to clipboard

Add sleep mode/extended lifespan toggle for PM2.5 sensor

Open domoritz opened this issue 1 year ago • 5 comments

First off, awesome configuration. It makes my air gradient so much more useful since it now seamlessly integrates into my home assistant setup.

I read that the Plantower sensors have a limited lifetime and can be set to update less often. It would be great if you could add a toggle to change the update frequency for the sensor.

domoritz avatar Jan 29 '24 20:01 domoritz

I'm not likely to add something to do that on a schedule in ESPHome itself, but since the brightness for LED and Contrast for Display are both controllable sliders (As well as a blank page switch), you could create an Automation in HomeAssistant that lowers both (or disables all pages except the blank one) on your own automation schedule and then enables them as you see fit.

The Update Intervals aren't currently set with any type of variable to be controllable by HomeAssistant and not currently any type of substitution in ESPHome.

I'm not aware of a concern about lifespan of the Sensair S8 CO2 sensor, but have here different reports of expected life for the Plantower PMS5003 sensor, so I do offer an alternate package that extends the life by only taking measurements every 2 minutes instead of every second, but there are possible concerns about the impact to accuracy with that.

Change the line

  pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003.yaml

to

  pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003_extended_life.yaml

MallocArray avatar Jan 29 '24 21:01 MallocArray

You're right, I misspoke. I meant have a sleep mode for the Plantower PMS5003 sensor. I like your idea not to have a general sleep mode as it can be handled in home assistant instead. So I rewrote the issue to ask for a sleep mode/extended life for the Plantower sensor that can be toggled without recompiling. For example, I would flip that toggle at night or when I am not home.

domoritz avatar Jan 29 '24 22:01 domoritz

It will be taken into consideration.

Making it a substitution variable that you could define in your ESPHome yaml at install time is one option Another option is to add a slider bar or a field you could type into that could fully control it, but adds new complexity, and currently we are nearly out of memory if adding the ESP32_Improv feature to allow for bluetooth discovery, so being a bit cautious about adding all of the features

I also just started this conversation on the AirGradient forums to see if we can get some testing about impacts to adjusting the interval and if it will affect accuracy overall https://forum.airgradient.com/t/accuracy-comparison-of-pms5003-with-large-interval-values/1615

MallocArray avatar Jan 29 '24 22:01 MallocArray

Can you also do a pm_2.5_2 extended life yaml? I could copy and paste it myself but it would be nice to have yours referenced for folks who want to be native.

pyrodex avatar Feb 06 '24 17:02 pyrodex

Can you also do a pm_2.5_2 extended life yaml? I could copy and paste it myself but it would be nice to have yours referenced for folks who want to be native.

I just added a package for an extended life version of the second PMS5003T sensor. It is also set to 2 minutes. sensor_pms5003t_2_extended_life.yaml

In recent forum discussions, the highest risk of using this with the outdoor model is that the fan will spin down after 30 seconds and could provide an opportunity for bugs to crawl inside. Just be aware.

MallocArray avatar Apr 03 '24 17:04 MallocArray

Can you set the pm update interval at runtime now? I looked at the code and only saw how it can be changed at compile time.

domoritz avatar May 19 '24 06:05 domoritz

I'm pretty sure this is not possible, as the sensor needs to know the value at compile time.

If you find anything from ESPHome that indicates different, we can look at modifications to enable that, but I would need links to examples or documentation.

MallocArray avatar May 19 '24 11:05 MallocArray