TagoTiP command client
This class provides a convenient interface for sending commands to devices through TagoTiP. Unlike Services, which is configured with your analysis token, TagoTiP requires a Service Authorization token, so it is constructed with that token directly.
import { TagoTiP } from "@tago-io/sdk";const tagoTiP = new TagoTiP({ token: "your-service-authorization-token" });await tagoTiP.cmd({ serial: "mqtt1", protocol: "mqtt", body: "reboot",}); Copy
import { TagoTiP } from "@tago-io/sdk";const tagoTiP = new TagoTiP({ token: "your-service-authorization-token" });await tagoTiP.cmd({ serial: "mqtt1", protocol: "mqtt", body: "reboot",});
import { Analysis, TagoTiP } from "@tago-io/sdk";async function startAnalysis(context) { const serviceAuthorizationToken = context.environment.find( (value) => value.key === "SERVICE_AUTHORIZATION" )?.value; if (!serviceAuthorizationToken) { throw "Missing 'SERVICE_AUTHORIZATION' environment"; } const tagoTiP = new TagoTiP({ token: serviceAuthorizationToken }); await tagoTiP .cmd({ serial: "mqtt1", protocol: "mqtt", body: "reboot" }) .then(console.log) .catch(console.log);}Analysis.use(startAnalysis); Copy
import { Analysis, TagoTiP } from "@tago-io/sdk";async function startAnalysis(context) { const serviceAuthorizationToken = context.environment.find( (value) => value.key === "SERVICE_AUTHORIZATION" )?.value; if (!serviceAuthorizationToken) { throw "Missing 'SERVICE_AUTHORIZATION' environment"; } const tagoTiP = new TagoTiP({ token: serviceAuthorizationToken }); await tagoTiP .cmd({ serial: "mqtt1", protocol: "mqtt", body: "reboot" }) .then(console.log) .catch(console.log);}Analysis.use(startAnalysis);
Send a command to a device through TagoTiP.
Command object with serial, protocol and body
TagoTiP command client
This class provides a convenient interface for sending commands to devices through TagoTiP. Unlike Services, which is configured with your analysis token, TagoTiP requires a Service Authorization token, so it is constructed with that token directly.
Example: Send a command
Example: Inside an analysis, reading the token from the environment