### Install MicroK8s Source: https://rightech.io/en/developers/trial/helm Installs MicroK8s using snap. Ensure Kubernetes version 1.30+ is met. ```bash snap install microk8s --classic ``` -------------------------------- ### Rightech Platform Configuration Example Source: https://rightech.io/en/developers/trial/helm Example `values.yaml` file for configuring the Rightech platform. Key parameters include admin password, ingress host, and MQTT port exposure. ```yaml initWith: adminPassword: PleaseChange2026 ingress: host: localhost tls: enabled: false inlets: mqtt: expose: type: nodePort nodePort: 31883 ``` -------------------------------- ### WebSocket Connection URL Example Source: https://rightech.io/en/developers/examples/websocket Example of a full WebSocket URL for connecting a device to the platform, including the object identifier. ```text ws://ws.dev.rightech.io/api/v1/objects/ws_lamp/connect ``` -------------------------------- ### Install Rightech IoT Core Platform Source: https://rightech.io/en/developers/trial/helm Installs or updates the Rightech IoT Core trial using Helm. Customize admin password and ingress host as needed. Ensure to change the default password for production. ```bash microk8s helm upgrade --install rightech oci://ghcr.io/rightech/charts/trial \ --namespace rightech --create-namespace \ --set initWith.adminPassword=PleaseChange2026 \ --set ingress.host=localhost ``` -------------------------------- ### API Link Example Source: https://rightech.io/en/developers/intro This example shows how to construct an API link to display an entity's state in JSON format. Use this to access entity data via the RESTful API. ```text GET dev.rightech.io/api/v1/:store/:id ``` -------------------------------- ### GET /api/v1/objects Source: https://rightech.io/en/developers/http/objects Retrieves a list of all project objects. ```APIDOC ## GET /api/v1/objects ### Description Retrieves a list of all project objects. ### Method GET ### Endpoint /api/v1/objects ### Response #### Success Response (200) - **objects** (array) - Array of all project objects ``` -------------------------------- ### Get a list of entities Source: https://rightech.io/en/developers/http/base Use GET /api/v1/:store to retrieve a list of entities. Supports parameters like offset, limit, only, and date range filtering. ```http GET /api/v1/:store ``` ```http /api/v1/:store?offset=20000 ``` ```http /api/v1/:store?offset=3&limit=2 ``` ```http /api/v1/:store?limit=2\&only=name,description ``` ```http /api/v1/:store?from=1640131200000&to=1640563200000 ``` ```http /api/v1/:store?from=2021-12-22T00:00&to=2021-12-27T00:00 ``` -------------------------------- ### POST /api/v1/objects/:id/automatons/:automaton/start Source: https://rightech.io/en/developers/http/logic Starts the execution of an automation script on a specific object. ```APIDOC ## POST /api/v1/objects/:id/automatons/:automaton/start ### Description Starts an automation script on a specific object. ### Method POST ### Endpoint /api/v1/objects/:id/automatons/:automaton/start ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the object - **automaton** (string) - Required - The identifier of the automaton ``` -------------------------------- ### POST /api/v1/objects/:id/handlers/:handler/start Source: https://rightech.io/en/developers/http/handlers Starts the execution of a handler on a specific object. ```APIDOC ## POST /api/v1/objects/:id/handlers/:handler/start ### Description Starts the execution of a handler on a specific object. ### Method POST ### Endpoint /api/v1/objects/:id/handlers/:handler/start ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the object. - **handler** (string) - Required - The identifier of the handler. ### Response #### Success Response (200) - **Object** - Information about the status of the request execution ``` -------------------------------- ### GET /api/v1/geofences Source: https://rightech.io/en/developers/http/geofences Retrieve a list of all geofences in the project. ```APIDOC ## GET /api/v1/geofences ### Description Retrieve a list of all geofences in the project. ### Method GET ### Endpoint /api/v1/geofences ### Response #### Success Response (200) - **Array** - List of all geofences in the project. ``` -------------------------------- ### GET /api/v1/handlers Source: https://rightech.io/en/developers/http/handlers Retrieves a list of all project handlers. ```APIDOC ## GET /api/v1/handlers ### Description Retrieves a list of all project handlers. ### Method GET ### Endpoint /api/v1/handlers ### Response #### Success Response (200) - **Array** - List of all project handlers ``` -------------------------------- ### LwM2M DISCOVER Action Source: https://rightech.io/en/developers/models/protocols Use this CoAP method to get a list of all supported objects, instances, and resources. The response is in CoRE Link Format. ```json { "method": "GET", "path": "/1", "data": "discover" } ``` -------------------------------- ### GET /api/v1/labels Source: https://rightech.io/en/developers/http/labels Retrieve a list of all project labels. ```APIDOC ## GET /api/v1/labels ### Description Retrieve a list of all project labels. ### Method GET ### Endpoint /api/v1/labels ### Response #### Success Response (200) - **Array** - List of all project labels ``` -------------------------------- ### Send Command with Parameters Source: https://rightech.io/en/developers/http/objects For commands that require parameters, include them in the JSON body of the POST request. The example shows sending a 'state_param'. ```json { "state_param": 42 } ``` -------------------------------- ### Wialon IPS Command Examples Source: https://rightech.io/en/developers/examples/wialon Commands for controlling vehicle units. Note that the platform automatically appends the required \r\n (0D0A) sequence when sending these commands. ```text #can_closealldoor#\r\n ``` ```text #can_openalldoor#\r\n ``` ```text #can_blinkerflasing#\r\n ``` ```text #can_horn#\r\n ``` ```text #can_hornblinker#\r\n ``` ```text #can_stopengine#\r\n ``` ```text #can_startengine#\r\n ``` -------------------------------- ### GET /api/v1/automatons Source: https://rightech.io/en/developers/http/logic Retrieves a list of all automation scenarios in the project. ```APIDOC ## GET /api/v1/automatons ### Description Retrieves an array of all automation scripts in the project. ### Method GET ### Endpoint /api/v1/automatons ### Response #### Success Response (200) - **identifier** (string) - Unique identifier - **name** (string) - Name of the automaton - **description** (string) - Description of the automaton - **selected models** (array) - List of associated models ``` -------------------------------- ### Webhook Request Body Format Source: https://rightech.io/en/developers/handlers/webhooks Example JSON structure for parameters passed to a webhook. ```json { "param1": 123, "param2": "text" } ``` -------------------------------- ### GET /api/v1/:store Source: https://rightech.io/en/developers/http/base Retrieves a list of entities for a specified store type with optional filtering and pagination. ```APIDOC ## GET /api/v1/:store ### Description Retrieves a list of entities from the specified store. Supports pagination and field filtering. ### Method GET ### Endpoint /api/v1/:store ### Parameters #### Path Parameters - **store** (string) - Required - The entity type (e.g., models, objects, automatons, handlers, labels, geofences, messages, users, groups, invites, roles, tokens). #### Query Parameters - **offset** (integer) - Optional - Number of entities to skip. - **limit** (integer) - Optional - Maximum number of entities to return (max 10000). - **only** (string) - Optional - Comma-separated list of fields to include in the response. - **from** (string/integer) - Optional - Start of time interval (Unix time or ISO 8601). - **to** (string/integer) - Optional - End of time interval (Unix time or ISO 8601). - **begin** (string/integer) - Optional - Alternative to from. - **end** (string/integer) - Optional - Alternative to to. ``` -------------------------------- ### Enable MicroK8s Add-ons Source: https://rightech.io/en/developers/trial/helm Enables the ingress and hostpath-storage add-ons for MicroK8s. Wait for their status to become enabled. ```bash microk8s enable ingress ``` ```bash microk8s enable hostpath-storage ``` -------------------------------- ### Launch Eclipse Wakaama Client for LwM2M Source: https://rightech.io/en/developers/examples/lwm2m Use this command to launch the Eclipse Wakaama client for testing LwM2M device connections. Ensure you replace 'test_device' with your actual device identifier. ```bash ./lwm2mclient -4 -h dev.rightech.io -n test_device -c ``` -------------------------------- ### Device Connection Configuration Source: https://rightech.io/en/developers/connect To connect equipment to the platform, you need to specify the server address (host) and port. This can be done using a configurator program or other methods described in the equipment's instruction manual. ```APIDOC ## Connecting a Device To connect your equipment to the Rightech platform, you need to configure the server address and port. ### Server Details * **Address**: `dev.rightech.io` (IP Address: `89.108.112.87`) * **Port**: Varies based on the equipment's protocol. ``` -------------------------------- ### GET /api/v1/objects/:id/packets Source: https://rightech.io/en/developers/http/objects Retrieves packet history for an object. ```APIDOC ## GET /api/v1/objects/:id/packets ### Description Retrieves a list of all packets for an object, optionally filtered by time range. ### Method GET ### Endpoint /api/v1/objects/:id/packets ### Parameters #### Path Parameters - **id** (string) - Required - The object identifier #### Query Parameters - **from** (string) - Optional - Start time (Unix time or ISO 8601) - **to** (string) - Optional - End time (Unix time or ISO 8601) ### Response #### Success Response (200) - **packets** (array) - Array of all packets of an object ``` -------------------------------- ### GET /api/v1/objects/:id Source: https://rightech.io/en/developers/http/objects Retrieves information about a specific object by its ID. ```APIDOC ## GET /api/v1/objects/:id ### Description Retrieves the representation of a specific object. ### Method GET ### Endpoint /api/v1/objects/:id ### Parameters #### Path Parameters - **id** (string) - Required - The object identifier ### Response #### Success Response (200) - **object** (object) - Representation of an object in JSON format ``` -------------------------------- ### Send Test Data via MQTT Source: https://rightech.io/en/developers/trial/helm Publishes a temperature reading to the 'base/state/temperature' topic using `mosquitto_pub`. Requires the platform to be accessible at `localhost` on port 31883. ```bash mosquitto_pub -d \ --host localhost \ --port 31883 \ -i mqtt-rightech-rooj8r \ -t base/state/temperature \ -m 36.6 ``` -------------------------------- ### GET /api/v1/handlers/:id Source: https://rightech.io/en/developers/http/handlers Retrieves information about a specific handler by its ID. ```APIDOC ## GET /api/v1/handlers/:id ### Description Retrieves information about a specific handler by its ID. ### Method GET ### Endpoint /api/v1/handlers/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the handler. ### Response #### Success Response (200) - **Object** - Handler representation in JSON format ``` -------------------------------- ### POST /api/v1/objects/:id/geofences/:geofence/start Source: https://rightech.io/en/developers/http/geofences Add a geofence to an object. ```APIDOC ## POST /api/v1/objects/:id/geofences/:geofence/start ### Description Add a geofence to an object. ### Method POST ### Endpoint /api/v1/objects/:id/geofences/:geofence/start ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the object. - **geofence** (string) - Required - The identifier of the geofence. ### Response #### Success Response (200) - **Object** - Information about the status of the request execution. ``` -------------------------------- ### GET /api/v1/geofences/:id Source: https://rightech.io/en/developers/http/geofences Retrieve detailed information about a specific geofence. ```APIDOC ## GET /api/v1/geofences/:id ### Description Get information about one geofence. ### Method GET ### Endpoint /api/v1/geofences/:id ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the geofence. ### Response #### Success Response (200) - **Object** - JSON representation of a geofence. ``` -------------------------------- ### GET /api/v1/labels/:id Source: https://rightech.io/en/developers/http/labels Retrieve information about a specific label by its ID. ```APIDOC ## GET /api/v1/labels/:id ### Description Retrieve information about a specific label by its ID. ### Method GET ### Endpoint /api/v1/labels/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the label. ### Response #### Success Response (200) - **Object** - JSON representation of the label ``` -------------------------------- ### Create a new model Source: https://rightech.io/en/developers/http/models Sends a POST request to create a new model with required base and name fields. ```json { "base": "mqtt", "name": "test-model-01", "description": "Model of microcontroller" } ``` -------------------------------- ### POST /api/v1/automatons Source: https://rightech.io/en/developers/http/logic Creates a new automation scenario. ```APIDOC ## POST /api/v1/automatons ### Description Creates a new automation scenario. ### Method POST ### Endpoint /api/v1/automatons ### Parameters #### Request Body - **model** (string) - Required - Model identifier - **name** (string) - Required - Name of the new automation scenario - **description** (string) - Optional - Description of the automaton ### Request Example { "model": "", "name": "test-automaton-01", "description": "Automaton for sensor" } ``` -------------------------------- ### GET /api/v1/automatons/:id Source: https://rightech.io/en/developers/http/logic Retrieves detailed information about a specific automation scenario. ```APIDOC ## GET /api/v1/automatons/:id ### Description Retrieves the JSON representation of a specific automation script. ### Method GET ### Endpoint /api/v1/automatons/:id ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the automation scenario ### Response #### Success Response (200) - **identifier** (string) - Unique identifier - **name** (string) - Name of the automaton - **description** (string) - Description of the automaton - **selected models** (array) - List of associated models - **states and transitions** (object) - Information about constructed states and transitions ``` -------------------------------- ### LwM2M OBSERVE Action Source: https://rightech.io/en/developers/models/protocols Use this CoAP method to set up observation for a resource. The response from the client must be in SenML JSON format. ```json { "method": "GET", "path": "/3/0/9", "data": "observe" } ``` -------------------------------- ### POST /api/v1/objects Source: https://rightech.io/en/developers/http/objects Creates a new object in the system. ```APIDOC ## POST /api/v1/objects ### Description Creates a new object by providing its representation in JSON format. ### Method POST ### Endpoint /api/v1/objects ### Parameters #### Request Body - **model** (string) - Required - Model identifier - **id** (string) - Required - Object identifier for device connection - **name** (string) - Required - Name of the new object ### Request Example { "model": "", "id": "test-object-01", "name": "test-object-01" } ### Response #### Success Response (200) - **object** (object) - Representation of the created object ``` -------------------------------- ### GET /api/v1/:store/:id Source: https://rightech.io/en/developers/http/base Retrieves detailed information about a single entity by its unique identifier. ```APIDOC ## GET /api/v1/:store/:id ### Description Retrieves information on a single entity. ### Method GET ### Endpoint /api/v1/:store/:id ### Parameters #### Path Parameters - **store** (string) - Required - The entity type. - **id** (string) - Required - The 12-byte unique identifier of the entity. ``` -------------------------------- ### POST /api/v1/:store Source: https://rightech.io/en/developers/http/base Creates a new entity within the specified store. ```APIDOC ## POST /api/v1/:store ### Description Adds a new entity to the platform. ### Method POST ### Endpoint /api/v1/:store ### Parameters #### Path Parameters - **store** (string) - Required - The entity type. ### Request Example { "some_field": "SOME_VALUE", "other_field": "OTHER_VALUE" } ``` -------------------------------- ### Store and Average Last 10 Parameters Source: https://rightech.io/en/developers/handlers/create Stores the last ten received parameters in local storage, calculating their count, sum, and average. Initializes local store with default values if empty. ```javascript /** * Calc average of last 10 a's * @param {number} a sample param */ function process(a = 0) { /* init local store with default values (if empty) and reduce it with fresh values */ const { counter, last10 } = ric.localStore.forObject .initWith({ counter: 0, last10: [a], }) .reduce((prev) => ({ counter: prev.counter + 1, last10: [...prev.last10, a].slice(-10), })); /* calc sum and avg of last 10 values */ const sum = last10.reduce((acc, val) => acc + val, 0); const avg = sum / last10.length; return { counter, sum, avg, }; } ``` -------------------------------- ### Create an entity Source: https://rightech.io/en/developers/http/base Use POST /api/v1/:store to create a new entity. Requires a JSON payload with entity-specific fields. ```http POST /api/v1/:store ``` ```json { "some_field": "SOME_VALUE", "other_field": "OTHER_VALUE" } ``` -------------------------------- ### Retrieve a single entity Source: https://rightech.io/en/developers/http/base Use GET /api/v1/:store/:id to retrieve information on a single entity. ```http GET /api/v1/:store/:id ``` -------------------------------- ### GET /api/v1/messages/history Source: https://rightech.io/en/developers/http/messages Retrieves a list of all messages received in the project. Message history is preserved even if the source object has been deleted. ```APIDOC ## GET /api/v1/messages/history ### Description Get a list of all messages received in the project. Even if an object has already been deleted, the messages received from it will be stored in the history. ### Method GET ### Endpoint /api/v1/messages/history ### Response #### Success Response (200) - An array of message objects. ``` -------------------------------- ### JSON Telemetry Data Packet Source: https://rightech.io/en/developers/models/protocols Example of a complex JSON payload structure for sending multiple parameters in a single CoAP packet. ```json { "stringKey": "value1", "booleanKey": true, "doubleKey": 3.1415, "longKey": 73, "jsonKey": { "someNumber": 42, "someArray": [1, 2, 3], "someNestedObject": { "key": "value" } } } ``` -------------------------------- ### LwM2M EXECUTE Action Source: https://rightech.io/en/developers/models/protocols Use this CoAP method to initiate the execution of actions on a resource. ```json { "method": "POST", "path": "/31024/10/2" } ``` -------------------------------- ### Create Automation Scenario Source: https://rightech.io/en/developers/http/logic Use this endpoint to create a new automation scenario. The request body requires the model identifier and the name of the scenario. An optional description can also be provided. ```json { "model": "", "name": "test-automaton-01", "description": "Automaton for sensor" } ``` -------------------------------- ### Edit Existing Handler Source: https://rightech.io/en/developers/http/handlers Modify an existing handler by sending a PATCH request with the fields to be updated in the request body. This example shows updating the name and description. ```json { "name": "test-handler-02", "description": "Handler for sensor" } ``` -------------------------------- ### Get Packet History with ISO 8601 Source: https://rightech.io/en/developers/http/objects Retrieve packet history for an object within a specified time range using ISO 8601 date-time format. ```http /api/v1/objects/:id/packets?from=2021-12-22T00:00&to=2021-12-27T00:00 ``` -------------------------------- ### POST /api/v1/handlers Source: https://rightech.io/en/developers/http/handlers Creates a new handler. ```APIDOC ## POST /api/v1/handlers ### Description Creates a new handler using the provided JSON representation. ### Method POST ### Endpoint /api/v1/handlers ### Parameters #### Request Body - **name** (string) - Required - Name of the new handler. - **userCode** (string) - Required - The handler code. ### Request Example { "name": "test-handler-01", "userCode": "function process(a, b) { return { sum: a + b } }" } ### Response #### Success Response (200) - **Object** - Handler representation in JSON format ``` -------------------------------- ### Get Packet History with Unix Time Source: https://rightech.io/en/developers/http/objects Retrieve packet history for an object within a specified time range using Unix timestamps (milliseconds since epoch). ```http /api/v1/objects/:id/packets?from=1640131200000&to=1640563200000 ``` -------------------------------- ### POST /api/v1/objects/:id/commands/:command Source: https://rightech.io/en/developers/http/objects Sends a command to a device. ```APIDOC ## POST /api/v1/objects/:id/commands/:command ### Description Sends a command to a specific object. Parameters can be included in the body if required. ### Method POST ### Endpoint /api/v1/objects/:id/commands/:command ### Parameters #### Path Parameters - **id** (string) - Required - The object identifier - **command** (string) - Required - The command identifier ### Request Example { "state_param": 42 } ### Response #### Success Response (200) - **response** (object) - Response from the device in JSON format ``` -------------------------------- ### Import and Use Sum Function Source: https://rightech.io/en/developers/handlers/create Imports a 'sum' function from a remote JavaScript module and uses it to calculate the sum of two input parameters. ```javascript import { sum } from "https://raw.githubusercontent.com/rightech/ric-examples/master/handlers/lib/example.js"; function process(a, b) { const res = sum(a, b); return { sum: res }; } ``` -------------------------------- ### Lamp Control Command JSON Format Source: https://rightech.io/en/developers/examples/websocket These JSON formats are used to send commands to control the lamp on the device. ```json { "device": "lamp", "data": 1 } ``` ```json { "device": "lamp", "data": 0 } ``` -------------------------------- ### Import and Use GPS Library Source: https://rightech.io/en/developers/handlers/create Imports the 'gps' library from Skypack to parse NMEA formatted strings and extract latitude and longitude coordinates. ```javascript import GPS from "https://cdn.skypack.dev/gps@0.6.1"; function process(nmea) { const gps = new GPS(); let lat = 0; let lon = 0; gps.on("data", (parsed) => { lat = parsed.lat; lon = parsed.lon; }); gps.update(nmea); return { lat, lon }; } ``` -------------------------------- ### LwM2M CREATE Action Source: https://rightech.io/en/developers/models/protocols Use this CoAP method to create an instance of an object. The data must be submitted in SenML JSON format. ```json { "method": "POST", "path": "/31024", "data": [ { "bn": "/31024/", "n": "11/1", "v": 8 } ] } ``` -------------------------------- ### Create a New Object Source: https://rightech.io/en/developers/http/objects Use this endpoint to create a new object. The request body must include the object's model, ID, and name. ```json { "model": "", "id": "test-object-01", "name": "test-object-01" } ``` -------------------------------- ### Create New Label - POST /api/v1/labels Source: https://rightech.io/en/developers/http/labels Use this endpoint to create a new label. The request body must include the 'name' field, and optionally 'value', 'link', and 'description'. ```json { "name": "👩 Emma White", "value": "381763724", "link": "https://vk.com/emma", "description": "Card ID 381763724" } ``` -------------------------------- ### WebSocket Connection URL Source: https://rightech.io/en/developers/models/protocols URL format for connecting to a device via WebSocket. Replace ':id' with the object ID. ```url ws://ws.dev.rightech.io:80/api/v1/objects/:id/connect ```