async function main(args) { // token configurable desde args o desde configuración const token = args._token; const inputString = args.inputString; if (!inputString) { return { status: "error", message: "Por favor, ingresa una cadena de texto." }; } let outputValue; switch (inputString.toLowerCase()) { case "uno": outputValue = 10; break; case "dos": outputValue = 20; break; case "tres": outputValue = 30; break; default: return { status: "error", message: `Cadena no reconocida: "${inputString}". Solo 'uno', 'dos' o 'tres'.` }; } // Enviar a Ubidots const device = "tension-real-calibracion"; const variable = "prueba"; const url = `https://industrial.api.ubidots.com/api/v1.6/devices/${device}`; const body = {}; body[variable] = outputValue; const res = await fetch(url, { method: "POST", headers: { "X-Auth-Token": token, "Content-Type": "application/json" }, body: JSON.stringify(body) }); const ubidotsResponse = await res.json(); return { status: "ok", inputValue: inputString, outputValue: outputValue, ubidots: ubidotsResponse }; }