How is live presence query aggregated in the API?

Portal API offers per-node live query for its presence. An occupancy event happens everytime sensor node samples motion through its PIR sensor. These motion events are reported with specific frequency to the Portal (for further information click here). The presence event in live query and corresponding value from a query is aggregated based upon a quadratic decay formulae explained below;

As soon as there is presence it reports 100%, however based upon the last presence detected vs. the time the query was made the value decays over time. As an example

  1. If a live query is made when the trigger event has just happened for a node it will report 100% occupancy

  2. If a query is made after 180 seconds of a trigger event it will result in a value 0%

  3. However, if a query is made earlier than that then it would take a value based upon the quadratic decay between 0% & 100% value

  4. As shown above any new trigger even will immediately reset the value to 100%