Hi everyone, Happy New Year to all!
I’m currently working on a solution for my client and exploring the functionality of TagoIO using a free plan account.
My current setup:
- I have an ESP32 connected to my own Mosquitto broker (anonymous, local IP).
- TagoIO is connected to the broker through MQTT Relay.
- The uplink (ESP32 → Broker → Relay → TagoIO) works perfectly — I can see data from my ESP32 in TagoIO.
What I want to do:
- Send data from the Dashboard Keypad widget back to my ESP32 using the Relay.
- Only specific variable(s) (keypad only for now) needs to be sent.
What I tried:
I’ve seen a forum post suggesting using Analysis with Network.publishToRelay(). I created the following code:
import { Analysis, Network } from "jsr:@tago-io/sdk";
const network = new Network({
token: "7b96139XXXXXXXXXXXXXX",
});
async function run(context, scope) {
const keypadValue = scope?.find(v => v.variable === "keypad")?.value;
if (!keypadValue) {
context.log("No 'keypad' variable in scope.");
return;
}
await network.publishToRelay({
device: "3aee9eaXXXXXXXXXXXXXXXXXX",
topic: "/device/esp32-02",
message: JSON.stringify({ keypad: keypadValue }),
options: { qos: 0 },
});
context.log("Keypad value sent via Relay:", keypadValue);
}
Analysis.use(run);
The issue I’m facing:
-
I’m not sure how to trigger the Analysis automatically when someone presses a keypad button on the dashboard.
-
I get this error when I run with analysis scope:
error: Uncaught (in promise) “Invalid middleware_endpoint”
[TagoIO Analysis] Error executing Deno analysis: 1
I prefer a solution that uses the MQTT communication method.
Thanks in advance for any guidance!

