Skip to main content

Myriota Setup Guide: FlexSense & AssetHawk to Cloud via HTTP

Send Myriota FlexSense and AssetHawk data to Ubidots through an HTTP destination. No decoder or device setup: devices appear with units and location.

Written by Sergio M

Ubidots receives Myriota FlexSense and AssetHawk messages through an HTTP destination in Myriota Device Manager. Assign the destination to your devices, and each device appears in Ubidots on its first message, already decoded: named variables, units, its position on the map, and the time the device took each reading.


​

Ubidots device page for a Myriota device, with its variables and map position, over a photo of a FlexSense installed in the field


​

You do, in Myriota Device Manager

Ubidots does, on the first message

Create an HTTP destination with the Ubidots URL

Creates one device per Myriota Terminal ID

Assign the destination to your devices

Decodes the payload: FlexSense firmware presets or your own struct, AssetHawk location and Bluetooth messages


​

Names the known variables, sets their units and icons, and sets the device location


​

Stores each value at the device's reading time, so late messages land in the right place

There is nothing to create in Ubidots: no devices, no decoder, no Terminal ID mapping.


​

Requirements

  • Myriota FlexSense or AssetHawk devices registered in Myriota Device Manager.

  • A Device Manager user that can create destinations and edit devices.

  • An Ubidots account on industrial.ubidots.com, with room on your plan for one Ubidots device per Myriota device, and your Ubidots token. No account yet? Start a free trial.


​

How the data gets to Ubidots

AssetHawk and FlexSense reach Myriota Cloud by satellite or cellular. Myriota Cloud decodes AssetHawk messages to JSON and sends FlexSense messages as raw bytes, by HTTPS POST, to myriota.ubidots.com: /assethawk reads the JSON and /flexsense decodes the bytes using the firmware in the URL. Each then reaches your Ubidots account with your token, as an AssetHawk device with 9 variables including its position, or a FlexSense device with the variables of its firmware. myriota.ubidots.com doesn't store your token.


​

Device

Route

Payload Ubidots receives

AssetHawk

/assethawk

JSON, already decoded by Myriota

FlexSense

/flexsense

Raw bytes; the URL sets the layout

myriota.ubidots.com keeps no copy of your token: each delivery carries it, and the data goes only to the account that owns it. Prefer a token used only for Myriota, so revoking it affects nothing else.

Try it in one minute, without a device

This posts a sample AssetHawk location message straight to Ubidots, the way Myriota would. Replace YOUR_UBIDOTS_TOKEN and run it in a terminal:

NOW=$(date +%s)
cat > assethawk-test.json <<EOF
{"Data": "{\"Packets\":[{\"TerminalId\":\"test-assethawk\",\"SerialNumber\":\"TEST\",\"Timestamp\":${NOW}000,\"Value\":[{\"type\":1,\"sequence_number\":1,\"reason\":0,\"flags\":0,\"time\":${NOW},\"latitude\":-34.9285,\"longitude\":138.6007,\"elevation\":48,\"temperature\":23.5,\"battery_voltage\":3.6}]}]}"}
EOF
curl -s -X POST 'https://myriota.ubidots.com/assethawk?token=YOUR_UBIDOTS_TOKEN' --data @assethawk-test.json

The response shows "forwarded":1, and AssetHawk TEST appears in Devices → Devices with nine variables, including its position. Delete it when you're done.


​

1. Build the destination URL

AssetHawk

Myriota AssetHawk asset tracker

https://myriota.ubidots.com/assethawk?token=YOUR_UBIDOTS_TOKEN

Nothing else to set. Myriota decodes AssetHawk messages before it delivers them.

FlexSense

Myriota FlexSense with its sensor cable

A FlexSense message is a packed struct whose layout depends on the device firmware, so the URL names the firmware. The presets match Myriota's reference apps v1.6.0.

Firmware on the device

Myriota reference app

Add to the URL

Tracker (factory default)

001_tracker

nothing

4-20mA sensor

002_sensor_4-20ma

&firmware=4-20ma

Pulse counter

003_pulse_counter

&firmware=pulse-counter

Your own firmware

—

&fields=… (see Custom FlexSense firmware)

https://myriota.ubidots.com/flexsense?token=YOUR_UBIDOTS_TOKEN&firmware=4-20ma

A wrong firmware choice decodes without an error. Myriota pads messages to 20 bytes, so any layout reads them. A Tracker message read as Pulse Counter, for example, turns 23.45 °C into a pulse count of 2345.


​

Each destination has one URL, so devices that run different firmware need separate destinations, for example Ubidots Tracker and Ubidots 4-20mA.


​

2. Create the HTTP destination

  1. In Myriota Device Manager, select Destinations in the left menu and click + Create.

  2. In New Destination, set Label to a name such as Ubidots, Type to HTTP, and URL to the URL from step 1.

  3. Click Create.

New Destination dialog in Myriota Device Manager with Label Ubidots, Type HTTP and the Ubidots AssetHawk URL


​

3. Assign the destination to every device

A destination receives nothing until it's assigned to a device. Creating it isn't enough. This is the most common reason no data reaches Ubidots.


​

  1. Select Devices and open the device.

  2. Click the + next to Destination/s, then + Add Destination.

  3. Select the destination you created in step 2.

Repeat for each device. A device can have several destinations and each one gets every message, so your current platform keeps receiving data while you try Ubidots.

Assign a fleet with the Myriota Cloud API

The bind endpoint takes one device per call, so loop over the IDs: Module IDs for FlexSense, ICCIDs for AssetHawk. The destination ID is in the Id column of Destinations. For the API token, select Tokens in Device Manager and click Create; see Myriota's Cloud APIs guide.

DEST=YOUR_DESTINATION_ID
MYRIOTA_TOKEN=YOUR_MYRIOTA_API_TOKEN
for id in 89883380001234567890 89883380001234567891; do
curl -s -X POST "https://api.myriota.com/v1/destinations/$DEST/modules" \
-H "Authorization: $MYRIOTA_TOKEN" -H "Content-Type: application/json" \
-d "{\"Items\":[{\"Id\":\"$id\"}]}"
done

Each response lists the device Id, with an ErrorMessage if that binding failed.


​

4. Check the data in Ubidots

Go to Devices → Devices. The device appears with its first message, which comes at its next scheduled report plus satellite delivery time. The FlexSense factory firmware reports four times a day.

Ubidots Devices list with the AssetHawk created automatically and its SIM ICCID as the API label


​


​

FlexSense

AssetHawk

Myriota identifier (Terminal ID)

Module ID

SIM ICCID, not the serial number on the label

Ubidots device API label

Module ID, lowercase

ICCID

Ubidots device name

FlexSense <Module ID>

AssetHawk <Serial Number>

If a device with that API label already exists in Ubidots, the data goes into it.


​

Open the device to see its variables, their units and its position.

AssetHawk device created in Ubidots by its first message, with its position on the map and nine named variables


​

Test a FlexSense destination from Device Manager

  1. In Device Manager, select Devices and click the Test Destinations icon on a FlexSense assigned to the destination.

  2. Enter the test message for its firmware and click OK.

Firmware

Test message

Expected in Ubidots

Tracker

010000000000000000000000002909100e

Temperature 23.45 °C, Battery Voltage 3.6 V

4-20mA

010000000000000000000000002909e02e100e

Temperature 23.45 °C, Sensor Current 12 mA, Battery Voltage 3.6 V

Pulse Counter

010000000000000000000000002a00100e

Pulse Count 42, Battery Voltage 3.6 V

Each also sets Sequence Number to 1 and is stored at the time Myriota captured it. None carries a position, so the device doesn't move on the map. If the device has other destinations, they receive the test too. To send a test again, change the first two characters, for example to 02.

AssetHawk

Device Manager's test can't produce an AssetHawk message: Myriota turns arbitrary data into an "unable to decode" error, which adds nothing in Ubidots. Use the one-minute test above, or wait for the device's next report.


​

Variables

FlexSense

API label

Name

Unit

Tracker

4-20mA

Pulse Counter

position

Position: sets the device location. Its value is always 1; lat and lng are in its context

—

✓

✓

✓

temperature

Temperature, inside the device

°C

✓

✓


​

battery_voltage

Battery Voltage

V

✓

✓

✓

sensor_current

Sensor Current

mA


​

✓


​

pulse_count

Pulse Count

—


​


​

✓

sequence_number

Sequence Number: message counter, 0–255, then restarts

—

✓

✓

✓

AssetHawk location messages

API label

Name

Unit

Notes

position

Position

—

Sets the device location. Not written when the fix is stale or 0, 0

temperature

Temperature

°C


​

battery_voltage

Battery Voltage

V


​

elevation

Elevation

m


​

message_reason

Message Reason

—

AssetHawk's reason code, 0–7

tampered

Tampered

—

0 or 1, from flags bit 2

gps_stale

GPS Fix Stale

—

0 or 1, from flags bit 1: the position repeats the last known fix

bad_orientation

Bad Orientation

—

0 or 1, from flags bit 0

sequence_number

Sequence Number

—

Counter for location messages

Numeric fields that newer AssetHawk firmware adds to location messages are passed through under their own names.

AssetHawk Bluetooth messages

API label

Name

Unit

Notes

ble_<mac>_rssi, for example ble_aabbccddeeff_rssi

Beacon AA:BB:CC:DD:EE:FF RSSI

dBm

One variable per beacon. The value's context holds address, protocol, data (raw beacon payload) and sequence_number

Bluetooth and location reports are separate messages, each with its own timestamp.


​

How Ubidots handles the data

Situation

What happens

Reading time

Ubidots uses the device's own time. It uses Myriota's capture time instead when the device clock reads before 2020 or more than 24 hours ahead, when custom firmware has no timestamp field, and for Bluetooth messages, whose time counts from boot

Several variables in one message

They share one timestamp, so they line up in charts and exports

Late or out-of-order delivery

Each value is stored at its reading time

Duplicate satellite receptions

Myriota removes duplicate UltraLite receptions before delivery

Several messages in one delivery

Each is processed on its own, for one or several devices

No GPS fix (0, 0)

Position isn't written; the other variables are

Padding after the FlexSense struct

Ignored

A message that can't be decoded

Skipped; the rest of the delivery is processed

Control Messages (downlink)

Not supported: the integration is uplink only


​

Custom FlexSense firmware: fields=

FlexSense firmware sends its message as a packed C struct. Add &fields= to the URL and list the struct's members in order as name:type, separated by commas.

Type

C type

Bytes

u8 / i8

uint8_t / int8_t

1

u16 / i16

uint16_t / int16_t

2

u32 / i32

uint32_t / int32_t

4

u64 / i64

uint64_t / int64_t

8

f32 / f64

float / double

4 / 8

  • Little-endian, like the FlexSense. Append be for big-endian, for example u16be.

  • /N divides and *N multiplies, for example level:u16/10. Write 1e7, not 1e+7: a URL turns + into a space.

  • Reserved names: timestamp (Unix seconds, used as the reading time), lat and lng (degrees; together they set the device position), and _ (read the member and discard it).

  • Any other name becomes a variable: lowercase letters, numbers, _ and -, each name used once. The names in the variables tables, such as temperature or battery_voltage, get their unit and icon automatically; set the others in Ubidots.

Firmware that sends this struct:

struct {
uint8_t seq;
uint32_t time; // Unix seconds
int32_t lat; // degrees × 1e7
int32_t lng; // degrees × 1e7
uint16_t level_dm; // decimetres
} __attribute__((packed));

uses this URL, which creates the variables seq and level (in metres) and sets the device position:

https://myriota.ubidots.com/flexsense?token=YOUR_UBIDOTS_TOKEN&fields=seq:u8,timestamp:u32,lat:i32/1e7,lng:i32/1e7,level:u16/10

Check a fields= string before you assign it

Post an empty delivery to the URL. It writes nothing to your account.

curl -s -X POST 'https://myriota.ubidots.com/flexsense?token=YOUR_UBIDOTS_TOKEN&fields=seq:u8,timestamp:u32,lat:i32/1e7,lng:i32/1e7,level:u16/10' \
-d '{"Data":"{\"Packets\":[]}"}'

A valid layout returns 200 with {"firmware":"custom","received":0,…}. An invalid one returns 400 with the reason, for example Unknown type "u17" in "level:u17". This check doesn't validate the token.


​

Token in a header instead of the URL

Device Manager's form only takes a URL, so by default the token is part of the destination URL that every Device Manager user sees. To move it to a header, set it with Myriota's Cloud API, then remove ?token= from the destination URL.

PUT https://api.myriota.com/v1/destinations/YOUR_DESTINATION_ID/headers
Authorization: YOUR_MYRIOTA_API_TOKEN
Content-Type: application/json

{"X-Auth-Token": "YOUR_UBIDOTS_TOKEN"}
  • An X-Auth-Token header wins over ?token=, so data keeps flowing while you switch.

  • The header keeps the token out of the URL, not out of the Myriota account: API users of the account can still read it.

  • To change tokens, update the header or the URL. The next delivery uses the new token.


​

Troubleshooting: why is no data reaching Ubidots?

Symptom

Cause

Fix

No device in Ubidots

Destination not assigned, no report yet, or a wrong token

Assign it (step 3); wait for the next scheduled report; check the token in the URL, with no spaces

No device, and the destination is assigned

Wrong route (a FlexSense on /assethawk or an AssetHawk on /flexsense), or fields= describes more bytes than the device sends

Use the route for the device (step 1); fix fields= so it matches the struct

Some devices never appear

Your Ubidots plan's device limit is reached

Raise the limit or delete unused devices

FlexSense values look wrong

The URL's firmware doesn't match the device, or fields= misses a member

Fix firmware= (step 1), or list every struct member in order with its type

A second device for the same AssetHawk

Its SIM ICCID changed, for example after a SIM swap; the serial number didn't

Keep the old device for its history, or delete it

Device not on the map

No GPS fix (0, 0), or an AssetHawk stale fix

The other values still arrive. Give the device a clear view of the sky

Gaps in Sequence Number

A message was lost or is still in transit

Late messages fill in at their reading time

Responses from myriota.ubidots.com

Code

Meaning

200

Delivery processed. The body counts received, forwarded, duplicates, invalid and failed messages

400

Invalid firmware= or fields=, or not a Myriota delivery. The body gives the reason

401

Token missing, or rejected by Ubidots

502

Ubidots couldn't store a value

Myriota retries any response other than 2xx, with growing delays between attempts.


​

FAQ

Do I have to create devices or variables in Ubidots first?

No. Each device is created on its first message, with its variables. A device you created beforehand with the same API label, the Terminal ID in lowercase, receives the data instead.

Can I keep sending data to my current platform?

Yes. A Myriota device can have several destinations, and each one gets every message. Add the Ubidots destination next to the existing one.

Can Ubidots send Control Messages to the device?

No. The integration is uplink only. Send Control Messages from Myriota Device Manager or Myriota's Cloud API.

Which Myriota devices does this cover?

FlexSense with Myriota's Tracker, 4-20mA or Pulse Counter reference firmware, FlexSense with custom firmware described in fields=, and AssetHawk location and Bluetooth messages. For another Myriota device, write to us through the chat.


​

Next steps

  • Alerts: Events on Battery Voltage, Tampered or GPS Fix Stale, an inactivity event for a device that stops reporting, or a geofence on its position.

  • Maps: a Map widget for the location of the whole fleet.

  • No account yet? Start a free trial and run the one-minute test above.

Did this answer your question?