MQTT Broker: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
 
Line 45: Line 45:
*password: [ask Tanner]
*password: [ask Tanner]


=== Usage ===
===Usage===
Please send messages to a topic starting with <code>test/</code> or <code>firstname/</code> while developing. This makes sure you don't screw up logged sensor data. For example:
Please send messages to a topic starting with <code>test/</code> or <code>firstname/</code> while developing. This makes sure you don't screw up logged sensor data. For example:


* test/air/2/temp
*test/air/2/temp
* tanner/air/2/temp
*tanner/air/2/temp


After testing your device, show Tanner and we can make sure it's ready and add the data to the Protospace IoT API so others can use it.
After testing your device, show Tanner and we can make sure it's ready and add the data to the Protospace IoT API so others can use it.
Line 57: Line 57:
Please don't send values more than once per minute to prevent filling up the database.
Please don't send values more than once per minute to prevent filling up the database.


==== CLI Example ====
====CLI Example====
These examples use the <code>mosquitto</code> client program.
These examples use the <code>mosquitto</code> client program.


Reading:
Reading:
  $ mosquitto_sub -d --capath /etc/ssl/certs/ -h webhost.protospace.ca -p 8883 -u reader -P cf503b99ba8cb0103da8884f09694fcd60ba1f2d -t sensors/air/0/temp
  $ mosquitto_sub --capath /etc/ssl/certs/ -h webhost.protospace.ca -p 8883 -u reader -P cf503b99ba8cb0103da8884f09694fcd60ba1f2d -t sensors/air/0/temp
... wait 60 seconds.
... wait 60 seconds and a number should appear.


Writing:
Writing:
  $ mosquitto_pub -d --capath /etc/ssl/certs/ -h webhost.protospace.ca -p 8883 -u writer -P [ask Tanner] -t test -m 'hello world'
  $ mosquitto_pub --capath /etc/ssl/certs/ -h webhost.protospace.ca -p 8883 -u writer -P [ask Tanner] -t test -m 'hello world'
On MacOS, you might need to copy <code>/etc/ssl/certs/</code> from a Linux computer to somewhere on your machine.
On MacOS, you might need to copy <code>/etc/ssl/certs/</code> from a Linux computer to somewhere on your machine.


==== Arduino Example ====
====Arduino Example====
Please see https://github.com/Protospace/telemetry/blob/master/air_quality/air_quality.ino for example MQTT sensor code.
Please see https://github.com/Protospace/telemetry/blob/master/air_quality/air_quality.ino for example MQTT sensor code.


Navigation menu