To run these examples, you'll need the Ruby MQTT library:
$ gem install mqtt
And you'll need to set the various environment variables the scripts expect to find. To do that, create a file named profile
in the same directory you plan to run the scripts from. Fill in the AIO_USER
and AIO_KEY
values with your own.
$ cat <<EOF > profile
export AIO_USER=test_username
export AIO_KEY=123456789abcandsuch
export AIO_URL=io.adafruit.com
export AIO_PROTOCOL=mqtts
export AIO_PORT=8883
EOF
Then you just have to source profile
before running scripts:
$ source profile
$ ruby adafruit-errors-sub.rb
Any environment variables you'd like to override for a single run of a script can be given as the first argument in the command line. For example, if I'd like to set the AIO_FEED_NAME
value on the fly, I could write my command like this:
$ AIO_FEED_NAME="Test Mode Evaluator" ruby adafruit-sub.rb