const aliyunIot = require('../../'); const device = aliyunIot.device({ productKey: '', deviceName: '', deviceSecret: '' }); device.on('connect', () => { console.log('connect succesfully!'); let count = 3; const interval = setInterval(() => { const t = Math.floor(Math.random() * 32); console.log(`Post current temperature: ${Math.floor(Math.random() * 32)}`); device.postProps({ CurrentTemperature: t }); if (--count <= 0) { console.log('Report filterChange event'); device.postEvent('changeFitler', { PM25Value: 20 }); } }, 1000); }); device.on('error', (err) => { console.log(err); });