This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tempodb' | |
require 'mqtt' | |
# CloudMQTT connection parameters | |
# Creates a hash with the connection parameters from the cloudmqtt URL in .env, else from the localhost URL | |
uri = URI.parse ENV['CLOUDMQTT_URL'] || 'mqtt://localhost:1883' | |
mqtt_conn_opts = { | |
remote_host: uri.host, | |
remote_port: uri.port, | |
username: uri.user, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
connection cloudmqtt | |
try_private false | |
address broker.cloudmqtt.com:<port> | |
start_type automatic | |
username <your_username_here> | |
password <your_password_here> | |
clientid <any_clientid_here> | |
notifications true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Temperature Reading | |
* | |
* Reads sensor value and publishes through MQTT. | |
* MQTT Arduino PubSubClient http://knolleary.net/arduino-client-for-mqtt/ | |
* | |
*/ | |
#include <SPI.h> | |
#include <PubSubClient.h> |