Skip to main content
Goal: close the loop from Lessons 2 and 3 — data flows up to your gauge, a command flows down to your device. This is the heart of the whole platform.

Up: push a value to the gauge

The gauge you made (ID tempGauge) updates when something pushes a value to that ID. Real hardware — from firmware:
void loop() {
  device.loop();
  float temperature = readTemperature();          // your sensor
  device.updateWidget(targetId, "tempGauge", temperature);
  delay(2000);
}
LiveLink — from the Device side, send a payload the gauge can read (map its field to tempGauge in the widget’s Data tab), and watch the gauge move. Open the dashboard in Preview — the gauge tracks the value live. No polling.

Down: send a command from the switch

Flip the Switch on the dashboard. It sends your Operate command. The device receives it. Real hardware — handle it in firmware:
void setup() {
  device.setUserCommandHandler([](JsonObject &msg) {
    JsonObject on = device.findAction(msg, "Operate", "ON");
    if (!on.isNull()) { /* turn the thing on */ }
    JsonObject off = device.findAction(msg, "Operate", "OFF");
    if (!off.isNull()) { /* turn it off */ }
  });
  device.begin();
}
LiveLink — the command appears in the Device Side log the moment you toggle the switch; reply with { "status": "ok" } from the Device side.

What you just did

Value up

updateWidget(targetId, "tempGauge", value) → the bound gauge.

Command down

The switch → setUserCommandHandler on the device.
That’s the core loop working end to end — the same pattern every Hyperwisor product runs on.

Next: store data & automate

Log readings and add a rule.