I have a question regarding these Rate limits and especially the execution count limit. What exactly is the definition of an execution?
Is it as simple as an execution of a method in the SmartApp?
Let me describe a potential scenario:
Let’s say we have 40 different devices connected to one hub. As I see it, we have two different ways of approach here:
We can either subscribe to every sensor and on each fired event we execute a method, for example firing an async post request every time a motion sensor changes its state. It takes approximately 10 seconds for a motion sensor before it changes its state from active to inactive. This means that it hypothetically can raise the event handler (40 sensors * 7 times/min) 280 times a minute, and that only includes raising the event handler. Then we have making a post request for each fired event. But is that included in the “execution count” or is it ONLY raising the event handler that will count as an “execution”?
This mean we risk exceeding the rate limit but in the return each post request will be very light.
We use scheduling and for example every 1 or 5 min we run this one single method that collects every event for each device that has occurred the in the past 5 minutes and builds this potential massive JSON object containing all the events for the past five minutes. This way we only execute once (?) every 1 or 5 minutes, but we loose the near realtime experience and we risk other limits such as execution time limits and there might be some data heavy requests. In that case we can always chop the JSON into smaller bits and make multiple async http post requests.
So, what is the definition of an execution and which approach do you think is the preferred way in the described scenario?
Thanks in advance!