README.md 1,15 ko
Newer Older
ka153421's avatar
ka153421 a validé
# 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
			```