Poll vs. schedule: issue with HubAction


#1

We developed Service Manager and Device Type for LAN device.
After all it works well: we can control device via REST calls by HubAction API
But there is a problem with periodic status update.
“Polling” capability gives the call of poll() once per 5 minutes - too rare!
So we used schedule(“0 * * * * ?”, my_func) which calls my_func once per minute perfectly.
But the problem is that HubAction does not work in my_func - the command is not issued!
Meanwhile the same code operates well in poll().
It looks like scheduled function is executed in different context or something…
Is there any way to overcome?


(Geko) #2

Yes, just call your device poll() function from my_func. That’s how Pollster does it.


#3

Thank you, geko. Indeed this method works.
Meanwhile, we switched to “subscription” approach to reduce traffic.
Thanks again!