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:
-
Generate a new random number
Request:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "PythonRandomValue.RandomValue", "commandOptions": [ "SendErrorMessage" ] } ] }Response:
{ "commands": [ { "symbol": "PythonRandomValue.RandomValue", "readValue": 32 } ] } -
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 } ] } -
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 } ] }