OK, we've covered how to use the RockBLOCK to send messages from anywhere on Earth. But how do you get those messages to your final destination? That is, how do you forward them from the Rock Sever server to your specific end application, like so:

Rock Seven only provides a very basic functionality here. Once a message is received on their server, it can be forwarded to a location you specify. There are only two options:

  • Email - You'll receive an email at the supplied address(es).
  • HTTP - An HTTP POST request will be made to the supplied URL(s)

Rock Seven has documentation on this here:

The HTTP API is documented here:

Delivery Groups

You configure message forwarding using the web based Management System. Once logged in, click Delivery Groups in the left hand navigation.

It's a fairly simple idea. Each Delivery Group is associated with one or more RockBLOCK devices. Then, for each group, you can specify one or more delivery destinations in the Delivery Addresses. It's a simple forwarding scheme. Any messages received from the RockBLOCK devices in the Delivery Group will be forwarded to the destinations in the Delivery Addresses.

Adafruit IO

There is a way to get your RockBLOCK message to Adafruit IO, however it has some limitations. Rock Seven doesn't allow for any special formatting of the out going HTTP POST message. So we can't interface it directly with the AIO API. However, we can use the webhook feature of AIO to provide an endpoint destination for the HTTP POST data.

Start by following this guide for how to create a webhook for your AIO feed:

You will end up with a URL for the feed's webhook.

Now log in to your Rock Seven account and go to Delivery Groups. Add a new Delivery Address for your RockBLOCK.

  1. Add the URL for the AIO feed's webhook into the Address field.
  2. Select HTTP_JSON from the Format drop down.

Now when you transmit a message from your RockBLOCK it will be forwarded as JSON data to your feed. It will show up as something like this:

It's not super useful. All you get is a raw blob of JSON text. You will have to do further processing. But that actual data is there in the aptly named data field.

Here's an example of how you could grab that JSON data, process it to get actual values in CPython (desktop, Raspberry Pi, etc), and then send those values back to the AIO feeds of interest. The data used is based on the CircuitPython example from this guide.

import struct
from Adafruit_IO import Client
from secrets import secrets

aio = Client(secrets['aio_username'], secrets['aio_key'])

# get the raw data
raw_feed = aio.feeds('test-feed')
raw_data = aio.receive(raw_feed.key).value

# the JSON blob is truncated, so just parse manually
print("Getting raw data...")
data = bytes.fromhex(raw_data.split(',')[2].split(':')[1].strip('"'))
values = struct.unpack("<6fB5f", data)

# send parsed data back to specific feeds
print("Sending to AIO...")
aio.append(aio.feeds('rock-block.rb-humidity').key, values[7])
aio.append(aio.feeds('rock-block.rb-temperature1').key, values[8])
aio.append(aio.feeds('rock-block.rb-pressure').key, values[9])
aio.append(aio.feeds('rock-block.rb-temperature2').key, values[11])

This guide was first published on Apr 08, 2020. It was last updated on Apr 08, 2020.

This page (Forwarding Messages) was last updated on Jun 23, 2021.

Text editor powered by tinymce.