Skip to content

Latest commit

 

History

History
108 lines (87 loc) · 2.3 KB

File metadata and controls

108 lines (87 loc) · 2.3 KB

About the "PythonRandomValue" sample

The "PythonRandomValue" sample extension provides random numbers between zero and a configurable maximum.

The initial maximum is 1000. New random numbers are returned by the PythonRandomValue.RandomValue symbol and are always less than or equal to PythonRandomValue.Config::maxRandom.

The extension configuration includes a single integer value (PythonRandomValue.Config::maxRandom) that can be read directly from the extension configuration.

First steps:

Example requests

  1. Generate a new random number

    Request:

    {
        "requestType": "ReadWrite",
        "commands": [
            {
                "symbol": "PythonRandomValue.RandomValue",
                "commandOptions": [ "SendErrorMessage" ]
            }
        ]
    }

    Response:

    {
        "commands": [
            {
                "symbol": "PythonRandomValue.RandomValue",
                "readValue": 32
            }
        ]
    }
  2. Read the value that is currently stored in the extension configuration directly

    Request:

    {
        "requestType": "ReadWrite",
        "commands": [
            {
                "symbol": "PythonRandomValue.Config::maxRandom",
                "commandOptions": [ "SendErrorMessage" ]
            }
        ]
    }

    Response:

    {
        "commands": [
            {
                "symbol": "PythonRandomValue.Config::maxRandom",
                "readValue": 10
            }
        ]
    }
  3. Change the value that is stored in the extension configuration

    Request:

    {
        "requestType": "ReadWrite",
        "commands": [
            {
                "symbol": "PythonRandomValue.Config::maxRandom",
                "writeValue": 2048,
                "commandOptions": [ "SendErrorMessage" ]
            }
        ]
    }

    Response:

    {
        "commands": [
            {
                "symbol": "PythonRandomValue.Config::maxRandom",
                "readValue": 2048
            }
        ]
    }