seanrees / prometheus-dyson

Prometheus client for DysonLink fans (Pure Hot+Cool)
MIT License
13 stars 9 forks source link

Feature Request: If possible add the Air Quality Index (AQI) metric #6

Closed Scaredycrow closed 3 years ago

Scaredycrow commented 3 years ago

Not sure if this is a request for here, or maybe the libpurecool maintainers as well. The native dyson app displays the Air Quality Index alongside the other metrics (Not sure if this existed on V1 devices as well). Would be great to be able to bring that in as well, ideally as a metric, or at least as the qualitative value (Good, Fair, Poor, Very Poor, Extremely Poor, Severe). Screengrabs below:

2021-01-09 17-51-15-1

2021-01-09 17-54-18-1

seanrees commented 3 years ago

Thanks for filing this, my inclination here is that this should be addressed as a Prometheus rule rather than in prometheus-dyson or libpurecool.

My best guess is that the Dyson app determines the Air Quality metric based on the Dust+VOC (V1) or PM2.5+PM10+VOC+NOx (V2) values. In other words, it's a synthetic metric that's evaluated by the app itself; the fan doesn't report "air quality" itself.

I think the nearest analogue here would be a recording rule in Prometheus. On V1 devices, the Dust and VOC values are normalised to a range of [0,10]. If I wanted to implement a synthetic AQ reading, I'd start with something like max(dyson_dust_units, dyson_volatile_organic_compounds_units). I suspect this computation is actually pretty similar to what the Dyson app does.

I don't have a use for such a rule myself, but if you're interested in working on it, I'm happy to include what you produce in a contrib/ directory in this codebase if you like :)

Scaredycrow commented 3 years ago

That's an interesting observation. There is guidance on the internet on how to calculate AQI standards which differ by region around the world. I'll see if I can work up something that makes sense, potentially can see the effective AQI across all regions.

seanrees commented 3 years ago

OK, I'm going to close this out for now. If you come up with something shareable, do send me a pull request and we can continue the discussion then :-)