← Crafts
Switchboard preview

Switchboard

IoT research Engineering collaborator

Tuya Smart API integration for custom hardware control — cloud commands mapped to local relays, sensors, and operator workflows.

Problem

Off-the-shelf smart plugs rarely match custom hardware timelines. Switchboard experiments with Tuya Smart API bridges so bespoke firmware can subscribe to cloud commands while exposing local sensor state back to automations.

What it covers

  • Tuya device registration and command dispatch wrappers
  • Mapping cloud DP IDs to local GPIO/actuator handlers
  • Heartbeat and state publish loop for automations
  • Embedded hooks for custom sensor ingestion
scene trigger DP update GPIO command sensor state state publish Tuya app/automation Tuya cloud Switchboard bridge Local MCU
Cloud to device command
type DeviceHandler = (value: unknown) => Promise<void>;

const dpHandlers: Record<string, DeviceHandler> = {
  switch_1: async (on) => relay.set(Boolean(on)),
  temp_current: async (c) => telemetry.publish('temp', Number(c)),
};

export async function onDpUpdate(id: string, value: unknown) {
  await dpHandlers[id]?.(value);
}
Switchboard device bridge placeholder
Screenshot placeholder — swap for a Tuya device map and local GPIO panel.