Shelly 3EM Pro
Onboard via Shelly Web UI
let INGEST_URL = "https://api.irs.systems/functions/v1/iot-ingest-telemetry";
let API_KEY = "dk_3230af..";
let INGEST_INTERVAL_MS = 600000; // 10 minutes
Timer.set(INGEST_INTERVAL_MS, true, function () {
Shelly.call("EM.GetStatus", { id: 0 }, function (emResult, emError) {
if (emError) {
print("Error reading EM:", emError);
return;
}
Shelly.call("EMData.GetStatus", { id: 0 }, function (edResult, edError) {
if (edError) {
print("Error reading EMData:", edError);
return;
}
let payload = {
timestamp: new Date().toISOString(),
total_power: emResult.total_act_power,
total_energy: edResult.total_act,
device_mac: Shelly.getDeviceInfo().mac,
};
Shelly.call(
"HTTP.Request",
{
method: "POST",
url: INGEST_URL,
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY,
},
body: JSON.stringify(payload),
},
function (res, err) {
if (err) {
print("HTTP Error:", err);
} else {
print("Sent to Supabase:", res.code);
}
}
);
});
});
});Last updated
Was this helpful?

