Skip to content

Connect your first device ​

This page gets one real device reporting to your instance. There are two routes: flash a supported board from the browser, or send HTTP requests from code you write.

You need a running instance. If you do not have one, follow the Quickstart first.

Choose a route ​

Flash a board over USBSend HTTP from your own code
Works withESP32, ESP32-S3 and ESP32-C3 boardsAnything that can send an HTTP POST with a JSON body
You write codeNoYes
You needChrome or Edge on a desktop computer, a USB data cable, firmware installed on the serverThe device id and secret, and the address of your instance
Detail pageFlash a board over USBSend data over HTTP

Both routes start on the same screen. In the dashboard, open Devices and select Connect device.

The Connect a device screen with the USB option, the HTTP option, the name and template fields and the first-reading example

Before you start: an address the device can reach ​

Your browser can open the dashboard at http://localhost:8090. A device cannot. On a device, localhost is the device itself.

Find the address of the computer that runs Sensora on your network, for example 192.168.1.20. The device then sends to http://192.168.1.20:8090. The device and the computer must be on the same network, or the instance must have a public address.

To make this the address that Sensora writes onto boards, set PUBLIC_URL in deploy/.env and run the up command again:

ini
PUBLIC_URL=http://192.168.1.20:8090

The bundled stack serves plain HTTP only. For HTTPS, put a reverse proxy in front of it. See Security.

Route 1: flash a supported board over USB ​

Sensora has a prebuilt firmware named Sensora Agent. The browser writes it to the board, gives the board your Wi-Fi details and links it to your project. The board then finds the sensors that are wired to it and starts to report.

  1. Make sure the server has the firmware. A new install has none, and the flasher then says No firmware is installed on this server. Flash a board over USB shows how to install it.
  2. Wire a supported sensor to the board. See Sensors the firmware detects. A board without a sensor also works. It reports its Wi-Fi signal, uptime and free memory.
  3. Open the dashboard in Chrome or Edge at http://localhost:8090 on the computer that the board is plugged into, or at an https:// address. Browsers allow USB access only on these pages.
  4. Open Devices, select Connect device, then Plug in a board by USB.
  5. Check the field How the board reaches this project. It must hold the address from the section above, not localhost.
  6. Select Connect board & install, pick the board's serial port, and follow the four steps on screen: Install firmware, Link to this project, Join Wi-Fi, Live.

When the first reading arrives, Sensora opens the Your board is live page.

The Connect a device screen names the Raspberry Pi Pico W in the USB option. There is no firmware for it. Connect a Pico W over HTTP.

Route 2: send HTTP from your own code ​

Use this route for a Raspberry Pi, a board that the firmware does not support, a script, or a gateway.

  1. Open Devices and select Connect device. HTTP is already selected.

  2. Enter a Device name, for example server-room-01.

  3. Leave Template at No template: store every number it sends. You can pick a template later to give the fields units or to read nested JSON.

  4. Optional: enter a Site. Devices with the same site form a group with its own page.

  5. Select Create device.

  6. Copy the device_uid and the secret from the yellow box. The secret is shown once. If you lose it, delete the device and create it again.

    The Connect a device screen after the device is created, with the device id, the secret and a curl example

  7. Send a reading from your device. The screen shows a curl and a Python example with your uid and secret filled in. The shortest form is:

    bash
    curl -X POST http://192.168.1.20:8090/ingest \
      -H 'Content-Type: application/json' \
      -d '{"uid":"dev_3833ce1e","secret":"sec_fd1c8e78b4da9670089a8de97f5731f49218dc35daab5557","temperature":21.7,"humidity":45}'

    The screen shows First reading from your device when the request arrives.

  8. Select Open device to see the readings.

Every top-level number and every true or false in the JSON body becomes a metric with the name of its field. Text fields are ignored.

Continue with one of these pages:

  • Send data over HTTP: the full contract, with Python and ESP32 examples.
  • Arduino library: for ESP32 firmware you write yourself. The library handles Wi-Fi, sending and retries.
  • MQTT and Webhooks: for devices or services that publish to a broker or post to one URL for many devices.

No hardware yet ​

You can create a simulated device to build dashboards and alerts first.

  1. Open Devices and select Connect device.
  2. In the card No hardware yet?, pick a template or keep None: temperature and humidity.
  3. Select Create a simulated device.

The device gets one reading at once. To send another, open the device, open the More actions menu (the three dots) and select Send a simulated reading. The device and its readings are marked Simulated.

Check that it works ​

  • The device shows Online in Devices.
  • The device page shows the values under Latest readings.
  • Logs, in the Developer group of the sidebar, shows a line each time a request is accepted.

If a request is refused, the response says why. Send data over HTTP lists the status codes.

Next steps ​

  • Offline devices: how Sensora decides that a device stopped reporting.
  • Alerts: be told when a reading crosses a line or a device goes offline.
  • Dashboards: put the readings on a board.

Sensora is open source under the Apache 2.0 license.