# Issues sending dashboard keypad widget data to ESP32 via MQTT Relay

**URL:** <https://community.tago.io/t/issues-sending-dashboard-keypad-widget-data-to-esp32-via-mqtt-relay/1816>\
**Category:** Devices and Connectors\
**Created:** [January 2, 2026, 5:38am UTC](https://community.tago.io/t/issues-sending-dashboard-keypad-widget-data-to-esp32-via-mqtt-relay/1816 "2026-01-02T05:38:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smartzoocaresystem](https://avatars.discourse-cdn.com/v4/letter/s/dbc845/32.png) [@smartzoocaresystem](https://community.tago.io/u/smartzoocaresystem)\
**Post date:** [January 2, 2026, 5:38am UTC](https://community.tago.io/t/issues-sending-dashboard-keypad-widget-data-to-esp32-via-mqtt-relay/1816/1 "2026-01-02T05:38:51Z")

</div>

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:

```javascript
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:

1. I’m not sure how to trigger the Analysis automatically when someone presses a keypad button on the dashboard.

2. I get this error when I run with analysis scope:

I prefer a solution that uses the MQTT communication method.  
Thanks in advance for any guidance!

---

<div class="post-metadata">

**Author:** ![freddy.minuzzi](https://yyz2.discourse-cdn.com/flex034/user_avatar/community.tago.io/freddy.minuzzi/32/415_2.png) [@freddy.minuzzi](https://community.tago.io/u/freddy.minuzzi)\
**Post date:** [January 2, 2026, 12:14pm UTC](https://community.tago.io/t/issues-sending-dashboard-keypad-widget-data-to-esp32-via-mqtt-relay/1816/2 "2026-01-02T12:14:09Z")

</div>

> [@smartzoocaresystem](#):
>
> I’m not sure how to trigger the Analysis automatically when someone presses a keypad button on the dashboard.

Hi Sam,

In regards to your questions,

1. You can simply select the Analysis you wish to run once you’ve inputed the values to the keypad widget. You can select the Analysis to run inside the “Options” section.

 ![image](https://canada1.discourse-cdn.com/flex034/uploads/tagoio1/original/2X/5/5406fff035d5388bdb14ba03def665ad78ce039f.png)

1. You need to add your middleware endpoint inside the MQTT network you’ve created:

 ![image](https://canada1.discourse-cdn.com/flex034/uploads/tagoio1/original/2X/c/cf7e75613be97f5a73904ef07c53aa5855773c3e.png)

---

<div class="post-metadata">

**Author:** ![smartzoocaresystem](https://avatars.discourse-cdn.com/v4/letter/s/dbc845/32.png) [@smartzoocaresystem](https://community.tago.io/u/smartzoocaresystem)\
**Post date:** [January 2, 2026, 2:16pm UTC](https://community.tago.io/t/issues-sending-dashboard-keypad-widget-data-to-esp32-via-mqtt-relay/1816/3 "2026-01-02T14:16:13Z")

</div>

Hi Freddy,

Thank you! It works perfectly now, really appreciate your help! I’ll keep exploring TagoIO and see what else I can do.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex034/user_avatar/community.tago.io/system/32/24_2.png) [@system](https://community.tago.io/u/system)\
**Post date:** [January 4, 2026, 12:09pm UTC](https://community.tago.io/t/issues-sending-dashboard-keypad-widget-data-to-esp32-via-mqtt-relay/1816/4 "2026-01-04T12:09:12Z")

</div>

Closed on January 4, 2026, 12:09pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
