Homey Community Forum

Polling data

Hi All,

Yesterday i started to convert the HomeWizard app (originally developed by Jeroen_Tebbens).
The app uses pollers to get data from the homewizard api (as you can see at https://github.com/fwelvering/com.homewizard/blob/master/drivers/thermometer/device.js on line 32)

I would really like to know if this is the best way to do this?
And i would really like to know how i can call the ‘startPolling’ function from the driver.js after adding an new device to it.

Any help would be appriciated.

I start polling on the on init in the device.js.

How I do it for the SDK v3 you can see here.

The timeout delay is somewhat complex, to make sure it happens at 30 seconds past every whole 10 minutes, as that is (for as far as I know) the optimal time to fetch data from my source.