michaelahern / homebridge-airthings

A Homebridge plugin for Airthings air quality monitors via the Airthings Consumer API.
ISC License
38 stars 6 forks source link

Homekit only updates sensor values when you open the app #14

Closed ninjas28 closed 2 years ago

ninjas28 commented 2 years ago

Right now the plugin only queries for updated API data when Homekit asks for an update (e.g. when you open the Home app, it tries to refresh the status of all your devices). This means that automations that you make that trigger when a sensor moves above or below a threshold will not fire until you open the Home app to check the status of your home.

Solution: The plugin should periodically request updated API data on its own and push that data to Homekit using the Characteristic.updateValue() function. Home hubs can then properly fire automations based on the sensor data.

I've made a fork that does this, it seems to work except for some weird warning I get: This plugin generated a warning from the characteristic 'Status Active': Characteristic not in required or optional characteristic section for service Service. Adding anyway.. I'll try and figure out why its saying that before I make a PR.

ninjas28 commented 2 years ago

I fixed my warning, made a PR.