Universal Devices • PG3x Plugin

Smart Life / Tuya

Local LAN control of compatible Smart Life / Tuya devices from Universal Devices eisy / PG3x.
Smart Life / TuyaLocal LAN ControlTinyTuyaIoX / eisyPG3x

Overview

This PG3x plugin integrates compatible Smart Life / Tuya devices with Universal Devices eisy and IoX. Devices are controlled directly over the local network using TinyTuya, allowing normal operation without routing commands through the Tuya cloud.

Ceiling FansFan On/Off, six speeds, operating modes, direction, light control, brightness, and stop timer.
Smart SwitchesLocal On/Off control of compatible Smart Life / Tuya switches.
Energy MonitoringSupported switches can report voltage, current, power, and accumulated energy.
Local ControlNormal IoX commands travel directly from the eisy to the Tuya device over the LAN.
IoX IntegrationDevices appear as native IoX nodes and can be used in programs and scenes.
Multiple DevicesMultiple compatible Tuya fans and switches can be configured in the same plugin.
Smart Life / Tuya: devices are initially paired and associated with a Smart Life or Tuya account. After the Device ID and Local Key are obtained, normal plugin operation is local.

Smart Life / Tuya Setup

Before the plugin can control a fan locally, you must obtain several pieces of information about the Tuya device: its Device ID, Local Key, local IP address, and Tuya protocol version. The easiest method is to first add the fan to Smart Life or Tuya Smart, create a Tuya developer project, and then run the TinyTuya setup wizard on the eisy.

1. Add the Fan to Smart Life or Tuya Smart

  1. Install Smart Life or Tuya Smart on your phone.
  2. Pair the fan/controller with the app in the normal manner.
  3. Verify that the fan can be controlled successfully from the app before continuing.
The Smart Life and Tuya Smart apps use the Tuya platform. The plugin does not control the fan through the mobile app; the app is used during initial setup so the device can be associated with your Tuya account.

2. Create a Tuya IoT Developer Project

Using a web browser, go to Tuya IoT Platform and create or sign into a Tuya IoT developer account.

  1. Create a new Cloud project for Smart Home devices.
  2. Select the data center/region corresponding to the Smart Life or Tuya Smart account used to pair the fan.
  3. Open the project Overview page.
  4. Locate the project's Access ID / Client ID and Access Secret / Client Secret. These will be used by the TinyTuya wizard.

3. Link Your Smart Life / Tuya Smart Account

  1. In the Tuya IoT project, open the Devices section.
  2. Select Link Tuya App Account.
  3. Select Add App Account.
  4. A QR code will be displayed.
  5. Open Smart Life or Tuya Smart on your phone and use its QR-code scanner to scan the code.
  6. Confirm the account link.
  7. Verify that the fan appears in the Tuya IoT project device list.

4. Connect to the eisy Using SSH

SSH provides a command-line connection to the eisy. No additional SSH software is normally required on current versions of Windows.

Find the eisy IP Address

Find the eisy in your router's client/device list and note its local IP address. An address will typically look something like:

192.168.1.50

Your address will probably be different. Use the actual IP address assigned to your eisy.

Open a Terminal in Windows

  1. Right-click the Windows Start button.
  2. Select Terminal. Windows PowerShell or Command Prompt may also be used.
  3. At the prompt, enter ssh admin@ followed by the eisy IP address.

For example:

ssh admin@192.168.1.50

First SSH Connection

The first time you connect to an eisy, SSH may display a message similar to:

The authenticity of host '192.168.1.50' can't be established.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Type:

yes

Log In

The default eisy SSH login is:

Usernameadmin
Passwordadmin

If the password has previously been changed, use the current password instead.

Important: when typing an SSH password, nothing appears on the screen—not even dots or asterisks. Type the password normally and press Enter.

After a successful login, you should see a command prompt similar to:

[admin@eisy ~]$

You are now operating at the eisy command line.

5. Install TinyTuya and Run the Wizard

At the eisy SSH prompt, first make sure TinyTuya is installed:

python3 -m pip install --user --upgrade tinytuya

After the installation completes, run the TinyTuya setup wizard:

cd /home/admin
python3 -m tinytuya wizard

The TinyTuya wizard will ask for information from the Tuya IoT project, including the API/Access ID, API/Access Secret, Device ID, and region. If TinyTuya has been configured previously, it may display the saved settings and ask:

Use existing credentials (Y/n):

Press Enter to accept the existing credentials, or answer n if new Tuya project credentials need to be entered.

The wizard will then ask whether to download DP name mappings. Answer y. DP (Data Point) mappings provide descriptive information about the functions exposed by Tuya devices.

Download DP name mappings? (Y/n): y

When asked whether to poll local devices, answer y:

Poll local devices? (Y/n): y

TinyTuya will scan the local network for Tuya devices and attempt to communicate with them directly. A successful scan will look similar to:

Scanning local network for Tuya devices...
    2 local devices discovered

Polling local devices...
    [Patio Fan East] 192.168.1.50 - [On] - DPS: {...}
    [Patio Fan West] 192.168.1.51 - [On] - DPS: {...}

>> Saving device snapshot data to snapshot.json
>> Saving IP addresses to devices.json

Done.

The names and IP addresses shown above are only examples. Your devices and addresses will be different.

When successful, TinyTuya creates or updates:

/home/admin/devices.json

The devices.json file contains the Tuya device information needed to configure the plugin, including Device IDs, Local Keys, and discovered local IP addresses.

6. Identify the Fan Information

For each fan you intend to configure, identify:

ValueDescription
Device IDThe unique Tuya identifier for the fan/controller.
Local KeyThe key used to authenticate local LAN communication.
IP AddressThe fan controller's current LAN address.
Protocol VersionThe Tuya local protocol version. The FC86B5-5D controllers tested with this plugin use 3.4. Other controllers may use a different version.

7. Enter the Information in PG3x

Open the Tuya Fan plugin in PG3x and enter the information under Custom Configuration Parameters.

For the first fan:

ParameterValue
fan1_nameA friendly name, such as Patio Fan East
fan1_idTuya Device ID
fan1_ipLocal IP address
fan1_keyTuya Local Key
fan1_versionProtocol version, typically 3.4 for tested hardware

Additional fans use fan2_*, fan3_*, and so forth.

8. Save and Restart the Plugin

  1. Save the Custom Configuration Parameters.
  2. Restart the Tuya Fan plugin.
  3. Open IoX and verify that the fan node appears.
  4. Test Fan On, Fan Off, and Fan Speed.
Normal operation is local: once setup is complete, the plugin communicates directly from the eisy to the fan over your LAN. The Tuya cloud and Smart Life/Tuya Smart app are not in the normal control path.

Configuration

Each fan is configured using PG3x Custom Parameters. The parameter number corresponds to the fan number.

ParameterPurpose
fan1_nameDisplay name shown in IoX.
fan1_idTuya Device ID.
fan1_ipLocal IP address of the fan controller.
fan1_keyTuya Local Key.
fan1_versionTuya protocol version. Tested controllers use 3.4.

For additional fans use fan2_*, fan3_*, and so on through fan16_*.

Recommended: assign each fan a DHCP reservation so its local IP address does not change.

After changing Custom Parameters, save the changes and restart the plugin.

Smart Life / Tuya Power Switches

In addition to ceiling fans, the plugin supports compatible Smart Life / Tuya power switches. Supported switches appear as native IoX nodes and can provide local On/Off control along with electrical measurements when those values are exposed by the device.

Switch Configuration

Power switches are configured using PG3x Custom Parameters in the same manner as ceiling fans. For the first switch use:

ParameterPurpose
switch1_nameDisplay name shown in IoX.
switch1_idTuya Device ID.
switch1_ipLocal IP address of the switch.
switch1_keyTuya Local Key.
switch1_versionTuya local protocol version. The default for switches is 3.5.

Additional switches use switch2_*, switch3_*, and so forth through switch16_*.

Required values: name, Device ID, IP address, and Local Key must all be supplied for each configured switch. If the protocol version is omitted, the plugin defaults to 3.5.

IoX Switch Node

A configured power switch provides standard IoX On and Off commands. After an On or Off command is sent, the plugin queries the device to confirm its actual relay state rather than simply assuming that the command succeeded.

Energy Monitoring

When supported by the Tuya switch, the node also reports electrical measurements supplied by the device:

MeasurementTuya DPSReported Value
Voltage20Volts
Current18Amps
Power19Watts
Accumulated Energy17kWh
Additional Status26Off / On
Online Status66Offline / Online

Metering values are refreshed approximately every 30 seconds, independently of the normal PG3x polling interval. This allows changing power consumption to be reflected in IoX without requiring frequent polling of every device by PG3x.

Local operation: switch On/Off commands and metering queries are sent directly between the eisy and the switch over the local network.

Switch Communication

The switch implementation opens a new local Tuya connection when communicating with the device rather than maintaining an idle persistent socket. This improves compatibility with tested Tuya 3.5 switches that may silently expire an idle persistent connection.

Ceiling Fan Nodes & Functions

FunctionStatus / RangeCommand
Fan PowerOn / OffFan On, Fan Off
Fan Speed1–6Set Fan Speed
Fan ModeNormal / Sleep / NaturalSet Mode
DirectionForward / ReverseSet Direction
LightOn / OffLight On, Light Off
Brightness0–100%Set Brightness
Stop TimerOff / 1 / 2 / 4 / 8 hoursSet Timer
Fan Speed behavior: setting a fan speed automatically turns the fan on before applying the requested speed. This allows an IoX scene to turn on a fan and select its speed using a single responder command.

Using Ceiling Fans in IoX Scenes

IoX scenes can use the fan node as a responder. Because a responder normally selects one command for the node, the Fan Speed command automatically includes Fan On behavior.

For example, four keypad buttons can provide simple preset control:

SceneFan Responder Command
HighFan Speed 6
MediumFan Speed 4
LowFan Speed 2
OffFan Off

A speed command therefore works whether the fan is already running or currently off.

Tested Hardware

ItemTested Configuration
Controller modelFC86B5-5D
ManufacturerShenzhen Funpower General Technology Co., Ltd.
Tuya protocol3.4

Other Tuya ceiling fan controllers may work if they use the same DPS mapping.

DPS Mapping

DPSFunctionExpected Values
1Fan powerBoolean
2Fan modenormal, sleep, nature
3Fan speed1–6
8Directionforward, reverse
15Light powerBoolean
16Light brightness0–100
22Stop timeroff, 1hour, 2hour, 4hour, 8hour

Local Operation

IoX Command→Tuya Fan Plugin→TinyTuya→Local Fan Controller

Once configured, normal fan control and status polling occur directly between eisy and the Tuya device over the LAN.

Internet or Tuya cloud availability is therefore not required for routine fan operation.

Troubleshooting

Security Notes

Version

Current version: 1.2.0

Version 1.2.0 expands the plugin beyond ceiling fans with support for compatible Smart Life / Tuya power switches, including local On/Off control and energy-monitoring values where supported by the device. Ceiling fan control remains fully supported.