-
Notifications
You must be signed in to change notification settings - Fork 1
/
iotDeviceSimulator.js
43 lines (41 loc) · 997 Bytes
/
iotDeviceSimulator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const getFormattedDate = () => {
var date = new Date();
//var str = date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
return Math.round(date / 1000);
};
let simulatedData = {
deviceId: "000745",
numberOfTags: 6,
listOfTags: [
{
tagName: "Speed",
tagValue: Math.floor(Math.random() * 101),
},
{
tagName: "Frequency",
tagValue: Math.floor(Math.random() * 101),
},
{
tagName: "VOLTAGE",
tagValue: Math.floor(Math.random() * 101),
},
{
tagName: "Current",
tagValue: Math.floor(Math.random() * 101),
},
{
tagName: "Torque",
tagValue: Math.floor(Math.random() * 101),
},
{
tagName: "Running Hour",
tagValue: Math.floor(Math.random() * 1001),
},
],
time: getFormattedDate(),
location: {
latitude: 45,
longitude: 58,
},
};
module.exports = simulatedData;