Skip to content

Send your first reading

From a device token to a value on a dashboard in five minutes, with HTTP or MQTT.

This page takes you from a new device to a value on its dashboard. Pick HTTP or MQTT. Both accept the same reading.

What you need#

You need a device in Logable, with its id and its token. Create the device, then copy both from its Connection tab. See Connect a device.

Over HTTP#

Send one POST request with the reading in the body.

# Raw Meal Silo - Quick Test (curl)
# Device Type: silo | Device ID: <DEVICE_ID>
#
# The "data" fields shown are this device type's registered metrics.
# Optionally add your OWN custom fields to "data" (e.g. "totalizer": 1284300.0).
# Custom keys: start with a letter; letters/digits/underscores; max 64 chars.
# Up to 20 custom fields; values: number, string (max 256 chars) or boolean.
# Custom values appear on dashboards via a widget's "Show Custom Data" option.

curl -X POST "https://ingest.logable.app/ingest/<DEVICE_ID>" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <DEVICE_TOKEN>" \
  -d '{"timestamp":"2026-07-01T10:00:00.000Z","status":"online","data":{"weight":18750.5,"status":"filling"}}'

A successful call returns this body:

Response
{
  "acknowledged": true,
  "timestamp": "2026-07-01T10:00:00.123Z",
  "deviceId": "<DEVICE_ID>"
}

Open the device's Overview tab. The value appears without a refresh.

Over MQTT#

Connect to the broker and publish on the device's own topic.

Broker connection
SettingValueRequiredDescription
Hostmqtt.logable.appYesThe public broker, over TLS on port 8883.
WebSocketwss://mqtt.logable.app/mqttNoUse this where port 8883 is blocked, or from a browser tool.
Username<DEVICE_ID>YesThe device's id.
Password<DEVICE_TOKEN>YesThe device's token.
Topicdevices/<DEVICE_ID>/dataYesPublish at QoS 1.
"""
Raw Meal Silo - Logable MQTT Integration (Python)
Device Type: silo
Device ID: <DEVICE_ID>

Broker: MQTT over TLS on port 8883 (Let's Encrypt certificate; standard system CAs validate it). WebSocket: wss://mqtt.logable.app/mqtt
Client ID must be unique per connection - a duplicate ID disconnects the other client.
Access: this device may publish/subscribe only under devices/<DEVICE_ID>/* - everything else is denied.

Installation: pip install paho-mqtt
"""

import paho.mqtt.client as mqtt
import json
from datetime import datetime, timezone
import time

MQTT_HOST = "mqtt.logable.app"
MQTT_PORT = 8883
MQTT_USERNAME = "<DEVICE_ID>"
MQTT_PASSWORD = "<DEVICE_TOKEN>"
MQTT_CLIENT_ID = "logable-<DEVICE_ID>"
MQTT_TOPIC = "devices/<DEVICE_ID>/data"

def on_connect(client, userdata, flags, reason_code, properties):
    if reason_code.is_failure:
        print(f"Connection failed: {reason_code}")
    else:
        print(f"Connected to MQTT broker at {MQTT_HOST}:{MQTT_PORT}")

def send_data(client):
    # The "data" fields shown are this device type's registered metrics.
    # Optionally add your OWN custom fields to "data" (e.g. "totalizer": 1284300.0).
    # Custom keys: start with a letter; letters/digits/underscores; max 64 chars.
    # Up to 20 custom fields; values: number, string (max 256 chars) or boolean.
    # Custom values appear on dashboards via a widget's "Show Custom Data" option.
    payload = {
        "timestamp": datetime.now(timezone.utc).isoformat(),
        "status": "online",
        "data": {
            "weight": 18750.5,
            "status": "filling"
        }
    }
    result = client.publish(MQTT_TOPIC, json.dumps(payload), qos=1)
    if result.rc == mqtt.MQTT_ERR_SUCCESS:
        print(f"Data sent to {MQTT_TOPIC}")

def main():
    client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id=MQTT_CLIENT_ID)
    client.on_connect = on_connect
    client.username_pw_set(MQTT_USERNAME, MQTT_PASSWORD)
    # TLS with the default system CA store - validates the broker's
    # Let's Encrypt certificate out of the box.
    client.tls_set()

    try:
        client.connect(MQTT_HOST, MQTT_PORT, keepalive=60)
        client.loop_start()
        time.sleep(1)
        send_data(client)
        time.sleep(1)
        client.loop_stop()
        client.disconnect()
    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    main()

MQTT gives no response body. Open the device's Overview tab to confirm the value arrived.

If nothing appears#

A 401 means the token is wrong or revoked. A 400 means something in the body failed validation. See Error codes for the full list.

Over MQTT, a rejected message is dropped with no reply to the device. Open the device's Connection tab and check the Device log instead. It shows the rejection with the reason.

Next#

Search the docs

Find a guide, an integration page, or a device type.