Skip to content

Instantly share code, notes, and snippets.

@weienwong
Created November 14, 2019 22:06
Show Gist options
  • Save weienwong/4f90e3d60110847014ec9aad46ce7e56 to your computer and use it in GitHub Desktop.
Save weienwong/4f90e3d60110847014ec9aad46ce7e56 to your computer and use it in GitHub Desktop.
setInterval(() => {
const payload = {
data: {
moisture: `${Math.random() * 100}`
}
}
sdk.instance.createItem(MODEL_ZUID, payload).then(res => {
if (res.statusCode === 201) {
const itemZUID = res.data.ZUID
publishItem(INSTANCE_ZUID, MODEL_ZUID, itemZUID, 1)
} else {
console.error('failed to create item')
console.error(res)
}
})
}, 5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment