Newer
Older
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
44
45
46
47
48
49
50
51
52
53
54
55
# Random Sensors
Small library that generates random messages on an MQTT brocker.
## Messages topics and payload
Sensors publish on 2 topics :
- `"presence"` with payload `[id]` where "[id]" is the id of the sensor.
- `"value/[id]"` with "[id]" the id of the sensor and a payload with format :
```JSON
{
"value": "[value]",
"type": "[type]"
}
```
where "[value]" is the string value of the sensor and "[type]" the string representation of the type of value within:
- 'POSITIVE_NUMBER',
- 'PERCENT',
- 'ON_OFF',
- 'OPEN_CLOSE'.
## run it
Run a default example with:
```
npm install
node test-random-sensors.js
```
### launch with Docker
To launch the generator, place yourself in the project directory and launch :
```
docker-compose up -d
```
And it's done. You can now connect your MQTT client to `127.0.0.1:1883` via the MQTT port, and to `127.0.0.1:8080`
via the WebSocket port.
# WebApp
A Web APP that use React and redux to get the message from the MQTT brocker.
## run it
```
npm install
npm start
```