torifat / xiaomi-mi-air-purifier

Homebridge plugin for Xiaomi Mi Air Purifier
Apache License 2.0
99 stars 14 forks source link

Ability to configure air quality ranges #373

Open zhukovheorhii opened 2 years ago

zhukovheorhii commented 2 years ago

Would be good to have a custom configuration for air quality ranges

function pm2_5ToAqi(aqi: number) {
  if (!aqi) {
    return 0; // Error or unknown response
  } else if (aqi <= 25) {
    return 1; // Return EXCELLENT
  } else if (aqi > 25 && aqi <= 50) {
    return 2; // Return GOOD
  } else if (aqi > 50 && aqi <= 75) {
    return 3; // Return FAIR
  } else if (aqi > 75 && aqi <= 100) {
    return 4; // Return INFERIOR
  } else if (aqi > 100) {
    return 5; // Return POOR (Homekit only goes to cat 5, so the last two AQI cats of Very Unhealty and Hazardous.
  } else {
    return 0; // Error or unknown response.
  }
}

As a user I want to be able to set another ranges to have more flexible automation at the Apple Home

naughtydogx commented 1 year ago

Any progress with this? This can't be a problem because another plugins has got it - it is called "pm25_breakpoints".