Send data from Pico LTE to scriptr.io

Send data from the Pico LTE to a scriptr.io script over HTTP, on the cellular connection, with a script created by scriptr.io’s Creatr demo.

This example sends data from the Pico LTE to a scriptr.io script over HTTP, on the cellular connection. Scriptr.io runs server-side scripts: backend APIs for IoT projects, developed and run in a web-based environment. The script is created with scriptr.io’s Creatr demo. No extra hardware is needed.

Before you begin

Required

Hardware

  • Sixfab Pico LTE or Pico LTE 2Registered and active in Sixfab Connect, connected to the computer with the micro USB cable.

Software

Prepare scriptr.io

  1. Test workspace.

    In your workspace, open the default Hello Device script and click Run: it sends a first request.

  2. Start Creatr demo.

    Creatr connects a device to scriptr.io, creates a script for a use case and shows the device’s data. Open the Creatr page and click GET STARTED.

  3. Select Other Device.

  4. Create device.

    Enter the device name and choose My device will push the data to a script.

  5. Select HTTP.

    Creatr creates the script. Note the scriptName and the Authorization token, then click Next.

Run example

  1. Set script and token in config.json.

    query is the scriptName, with a slash in front (/scriptName); authorization is the token.

    {
        "scriptr": {
            "query": "QUERY_OF_SCRIPT",
            "authorization": "YOUR_TOKEN"
        }
    }
  2. Run send_data.py.

    Open examples/scriptr/send_data.py from the SDK repository in Thonny and click Run.

    INFO: Sending data to scriptr.io script...
    INFO: Result: {'status': 1, 'response': ['+QHTTPPOST: 0,400'], 'interval': 0}
  3. Check data.

    In Creatr, choose the language of your device for the generated code and click Next. The received data appears on the Creatr page.

    The rest of the demo is in the scriptr.io tutorial.

    In the workspace, the data and the JSON map generated for it are shown.