@tylerryork/homebridge-tuya-platform
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

@0x5e/homebridge-tuya-platform

npm npm mit-license verified-by-homebridge Build and Lint

Fork version of official Tuya Homebridge plugin. Brings a lot of bug fix and new device support.

Features

  • Optimized code, improved code readability and maintainability.
  • Improved stability.
  • Less duplicate code.
  • Less API errors.
  • Less development costs for new accessory categroies.
  • More supported devices.
    • [Light] Spotlight (sxd)
    • [Light] Motion Sensor Light (gyd)
    • [Dimmer] Dual Dimmer (tgq)
    • [Dimmer] Dual Dimmer Switch (tgkg)
    • [Switch] Scene Light Socket (qjdcz)
    • [Fanv2] Ceiling Fan Light (fsd)
    • [Window] Door and Window Controller (mc)
    • [WindowCovering] Curtain Switch (clkg)
    • [Thermostat] Thermostat (wk)
    • [Thermostat] Thermostat Valve (wkf)
    • [Valve] Irrigator (ggq)
    • [AirQualitySensor] PM2.5 Detector (pm25)
    • [TemperatureHumiditySensor] Temperature and Humidity Sensor (wsdcg)
    • [MotionSensor] Motion Sensor (pir)
    • [HumanPresenceSensor] Human Presence Sensor (hps)
    • [LightSensor] Light Sensor (ldcg)
    • [CarbonMonoxideSensor] CO Detector (cobj)
    • [CarbonDioxideSensor] CO2 Detector (co2bj)
    • [LeakSensor] Water Detector (sj)
    • [HumidifierDehumidifier] Humidifier (jsq)

Supported Tuya Devices

See SUPPORTED_DEVICES.md

Changelogs

See CHANGELOG.md

Installation

Before use, please uninstall homebridge-tuya-platform first. They can't run together. (But the config is compatible, no need to delete.)

For Homebridge Web UI Users

Go to plugin page, search @0x5e/homebridge-tuya-platform and install.

For Homebridge Command Line Users

npm install @0x5e/homebridge-tuya-platform

Configuration

There's two type of project: Custom and Smart Home. The differenct between them is:

  • Custom Project pull devices from project's asset.
  • Smart Home Project pull devices from Tuya App user's home.

If you are personal user and don't know which to choose, please use Smart Home.

Before configuration, please goto Tuya IoT Platform

  • Create a cloud develop project, select the data center where your app account located. See Mappings Between OEM App Accounts and Data Centers (If you don't know where it is, just select all.)
  • Go to Project Page > Devices Panel > Link Tuya App Account, link your app account.
  • Go to Project Page > Service API > Go to Authorize, subscribe the following APIs (it's free for trial):
    • Authorization Token Management
    • Device Status Notification
    • IoT Core
    • Industry Project Client Service (for "Custom" project)
  • ⚠️Extend the API trial period every 6 months here (first-time subscription only give 1 month): Tuya IoT Platform -> Cloud -> Cloud Services -> IoT Core

For "Custom" Project

For "Smart Home" Project

  • platform - required : Must be 'TuyaPlatform'
  • options.projectType - required : Must be '2'
  • options.accessId - required : Access ID from Tuya IoT Platform -> Cloud Develop
  • options.accessKey - required : Access Secret from Tuya IoT Platform -> Cloud Develop
  • options.countryCode - required : Country Code
  • options.username - required : Username
  • options.password - required : Password
  • options.appSchema - required : App schema. 'tuyaSmart' for Tuya Smart App, 'smartlife' for Smart Life App.
  • options.homeWhitelist - optional: An array of integer home ID values to whitelist. If present, only includes devices matching this Home ID value.

Limitations

  • ⚠️Don't forget to extend the API trial period every 6 months. Maybe you can set up a reminder in calendar.
  • The app account can't be used in multiple HomeBridge/HomeAssistant instance at the same time! Please consider using different app accounts instead.
  • The plugin requires the internet access to Tuya Cloud, and the lan protocol is not supported. See #90

Troubleshooting

When your device is not working well, or not supported yet, please submit the issue and upload your device informations. If that's still not enough, you can enable the debug mode to get the detail log.

Get Device Information

After successful launching Homebridge, the device list will be saved inside Homebridge's persist path. You can get the file path from running log like this:

[2022/11/3 18:37:43] [TuyaPlatform] Device list saved at ~/.homebridge/persist/TuyaDeviceList.{uid}.json

Please remove the sensitive data such as ip, lon, lat, local_key, uid before uploading.

Enable Debug Mode

For Homebridge Web UI users:

  • Go to the Homebridge Setting page
  • Turn on the Homebridge Debug Mode -D switch
  • Restart HomeBridge.

For Homebridge Command Line Users:

  • Start Homebridge with -D flag: homebridge -D

Contributing

Please see https://github.com/homebridge/homebridge-plugin-template

PRs and issues are welcome.

Thank you for spend time using the project. If it helps you, don't hesitate to give it a star 🌟:-)

Dependencies (8)

Dev Dependencies (16)

Package Sidebar

Install

npm i @tylerryork/homebridge-tuya-platform

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

360 kB

Total Files

194

Last publish

Collaborators

  • tylerryork