Created
November 14, 2019 22:06
-
-
Save weienwong/4f90e3d60110847014ec9aad46ce7e56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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