Next: , Previous: , Up: Transports   [Contents]


6.3.5 tuya-direct

Warning: this transport was written to drive Tuya devices on the LAN, but it has not been tested end-to-end yet. During setup the devices under test did not expose a local connection, so the plugin could not be exercised against real hardware.

Talks to a Tuya device on the LAN at host:port (default port 6668). Payloads toward readers/writers are DPS-only JSON objects such as { "1": true, "2": 210 }. Protocol framing stays inside the transport.

Read and write transports for the same device should share one TCP connection via the same <socket-group> id. Omit socket-group for a private socket.

<transport id="tuya-rx" plugin="tuya-direct">
  <socket-group>demo-device</socket-group>
  <host>192.168.1.50</host>
  <port>6668</port>
  <device-id>REPLACE_DEVICE_ID</device-id>
  <local-key>0123456789abcdef</local-key>
  <mode>read</mode>
  <heartbeat-s>9</heartbeat-s>
  <status-on-connect>true</status-on-connect>
  <stale-timeout-s>120</stale-timeout-s>
</transport>

See also examples/tuya-direct/tuya-direct.stcs.xml.

host

Device IP or hostname.

port

TCP port (default 6668).

device-id

Tuya device id.

local-key

Local encryption key (do not commit real keys).

mode

read or write.

socket-group

Optional shared-socket registry key across transports.

protocol-version

auto (default) or forced 3.1 / 3.2 / 3.3 / 3.4 / 3.5.

heartbeat-s

Heartbeat interval in seconds (default 9).

status-on-connect

If true (default), query device status when the socket becomes ready.

stale-timeout-s

Seconds without traffic before a status refresh (default 120).

Tip: for command and feedback on one device, declare two transports (read + write) with the same <socket-group> so they share one TCP connection (see Configuration Tips).