ToddGreenfield / homebridge-airnow

Homebridge plugin for AirNow Web-API Air Quality Sensor
36 stars 10 forks source link

Binary sensors for separate pollutants #10

Open nielsth opened 5 years ago

nielsth commented 5 years ago

Would it be possible to add binary sensors to this plug-in? In HomeKit, binary sensors for Air Quality show the current value of a single pollutant under its details and sensors change to a triggered state when a critical value is exceeded.

Binary sensors offer more options to set up notifications and can be used to trigger automations. Such notifications can be useful as a reminder to close the window.

For reference: The Netatmo plugin for weather stations offers something similar. The indoor module of this station adds an Air Quality sensor based on CO2 levels, as well as a binary CO2 sensor. (I can add a screenshot later if you'd like)

Since this Air Quality plug-in checks the API's for quite a few different pollutants, which can result in quite a few extra tiles for binary sensors, perhaps the best way to implement binary sensors would be by adding config options to enable or disable them per pollutant. For instance, a user would be able to set up the configuration in a way that binary sensors are only added for PM2.5 and PM10 pollutants, and then not get tiles for binary sensors for NO2, O3 and other measured pollutants.

ToddGreenfield commented 5 years ago

Feel free to do a PR. I don't have the time to actively maintain, so if you would like and are comfortable I can add you as a collaborator.

nielsth commented 5 years ago

Thanks. I'll look into that when I have more time in a couple weeks :)