Real-time Monitoring of TP-Link Tapo Devices with Node-RED and FileMaker (OData)

This post documents how we built a reliable pipeline to log the real ON/OFF state of TP-Link Tapo lights into a FileMaker table using Node-RED and FileMaker Server OData. The solution polls device status every few seconds, deduplicates unchanged values, and writes changes to FileMaker with a locked-down account.

Why

  • Single source of truth for device states (not just commands).
  • Works even if state changes come from the Tapo app, voice assistants, or automations.
  • Scales to dozens of devices with minimal overhead.

Prerequisites

  • FileMaker Server with OData enabled.
  • Node-RED (we run it in Docker at home, connected to the office via VPN).
  • TP-Link Tapo device (example: L520) reachable on the LAN.
  • Node-RED palette: node-red-contrib-tapo-new-api (node name: actions).

FileMaker: table & security

Create file log_devices_home and table log with:

FieldTypeNotes
idNumberAuto-increment (primary key)
device_idTexte.g. tapo_LucePortaIngresso
stateTexton | off | offline
ts_locatTimestampAuto-enter creation timestamp (local time)

Security best practice: create an account log_writer with a privilege set that:

  • Enables extended privilege fmodata (OData).
  • Allows Create on table log only (no read/update/delete).

OData quick test (cURL)

AUTH=$(printf 'log_writer:YOUR_PASSWORD' | base64)

curl -i -X POST "https://192.168.1.27/fmi/odata/v4/log_devices_home/log" \
  -H "Authorization: Basic $AUTH" \
  -H "Content-Type: application/json" \
  -d '{"device_id":"test_node","state":"on"}' \
  -k

201 Created confirms the pipeline from your machine to FileMaker OData works. The -k flag is only for self-signed certificates (testing).

Node-RED flow: polling → normalize → deduplicate → OData

The flow structure:

[Inject every 10s] → [Tapo actions STATUS] → [Extract ON/OFF] → [RBE] → [Add headers Basic] → [HTTP request → FileMaker OData]

Function — extract ON/OFF and build minimal payload

let p = msg.payload;
const info = (p && p.tapoDeviceInfo) ? p.tapoDeviceInfo : p;

let s = "unknown";
if (typeof info === "boolean") s = info ? "on" : "off";
else if (typeof info === "string") {
  const t = info.toLowerCase().trim();
  if (t === "on" || t === "off") s = t;
} else if (info && typeof info === "object") {
  if (info.device_on !== undefined) s = info.device_on ? "on" : "off";
  else if (info.deviceOn !== undefined) s = info.deviceOn ? "on" : "off";
  else if (info.light_on !== undefined) s = info.light_on ? "on" : "off";
  else if (info.on !== undefined) s = info.on ? "on" : "off";
  else if (info.power !== undefined) s = String(info.power).toLowerCase();
  else if (info.state !== undefined) s = String(info.state).toLowerCase();
  else if (info.data && info.data.on !== undefined) s = info.data.on ? "on" : "off";
}
if (s !== "on" && s !== "off") { return null; }

msg.payload = {
  device_id: "tapo_LucePortaIngresso",
  state: s
};
return msg;

RBE — pass only when state changes

Add an RBE node with property payload.state. This avoids duplicate inserts when the state is unchanged.

Function — OData Basic Auth headers

const user = "log_writer";           
const pass = "YOUR_PASSWORD";
const b64  = Buffer.from(user + ":" + pass).toString("base64");

msg.headers = {
  "Authorization": "Basic " + b64,
  "Content-Type": "application/json"
};
return msg;

HTTP request — POST to FileMaker OData

  • Method: POST
  • URL: https://192.168.1.27/fmi/odata/v4/log_devices_home/log
  • Return: a parsed JSON object
  • Authentication: none (header already set)
  • TLS: if using self-signed certs, create a TLS config with “Verify = OFF, Self-signed = ON”.

Offline detection (optional)

msg.payload = { device_id: "tapo_LucePortaIngresso", state: "offline" };
return msg;

Result

iddevice_idstatets_locat
1tapo_LucePortaIngressoon2025-08-26 23:15:01
2tapo_LucePortaIngressooff2025-08-26 23:45:18
3tapo_LucePortaIngressooffline2025-08-27 00:05:12

Hardening & production notes

  • Use a real TLS certificate on FileMaker Server.
  • Keep log_writer restricted to Create-only on table log.
  • Adjust polling interval for scalability (15–30s with many devices).
  • Consider a Subflow to reuse configuration for multiple devices.

Appendix — OData readback (debug)

AUTH=$(printf 'admin:YOUR_ADMIN_PASSWORD' | base64)

curl -s "https://192.168.1.27/fmi/odata/v4/log_devices_home/log?\$orderby=IndicatoreDataOraCreazione%20desc&\$top=5" \
  -H "Authorization: Basic $AUTH" \
  -H "Accept: application/json" \
  -k | jq .

Reports: daily, weekly, and fully customized

Once the log table fills with events, FileMaker becomes a powerful reporting layer across heterogeneous devices (Tapo, Sonoff, Shelly). Typical out-of-the-box outputs include:

  • Daily reports per device: number of ON→OFF transitions, total ON time, first/last seen.
  • Weekly summaries: per-room or per-device-type rollups (e.g., all Tapo lights vs. Shelly relays).
  • Custom dashboards in FileMaker with charts and statistics (e.g., % uptime, average switch count per day).
  • Automations: send email reports or trigger notifications when a device remains ON for too long or goes OFFLINE.

Because the pipeline normalizes states at the edge (Node-RED) and stores them uniformly, you can mix vendors in the same reports and still get consistent analytics.

Demo video

Alongside this article we posted a short demo video showing a Tapo lamp being switched ON and OFF and the corresponding record being created in FileMaker in real time via OData.

Takeaways

Node-RED acts as a lightweight middleware to normalize telemetry from Tapo, Sonoff, and Shelly devices, and push it into FileMaker via OData. Polling, state extraction, RBE and a create-only account produce a robust, auditable log that unlocks daily and weekly reporting, custom dashboards, and on-demand notifications.

Thanks to FileMaker’s reporting capabilities, you can easily build charts, statistics, or automated emails on top of the log table, transforming raw IoT data into actionable insights. And for those who want to see it in action, we posted a short demo video showing a Tapo lamp being switched ON and OFF, with the corresponding records instantly appearing in FileMaker.


Tags:


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *