Name Picker Malfunction

    homebridge-tuyapi-extended

    1.0.9 • Public • Published

    Homebridge TuyAPI Extended

    This code is a forked and modified version of tuyapi by codetheweb. Proceed as you wish.

    Homebridge TuyaAPI Extended is a library for communicating with devices that use the Tuya cloud network. These devices are branded under many different names, but if port 6668 is open on your device chances are this library will work with it. Currently only supports smart plugs, but it should be fairly trivial to add other types of devices.

    Installation

    npm install homebridge-tuyapi-extended

    Basic Usage

    const TuyaExtendedDevice = require('homebridge-tuyapi-extended');
     
    let tuya = new TuyaExtendedDevice({
      id: 'xxxxxxxxxxxxxxxxxxxx',
      key: 'xxxxxxxxxxxxxxxx'});
     
    tuya.resolveIds().then(() => {
      tuya.get().then(status => {
        console.log('Status: ' + status);
     
        tuya.set({set: !status}).then(result => {
          console.log('Result of setting status to ' + !status + '' + result);
     
          tuya.get().then(status => {
            console.log('New status: ' + status);
            return;
          });
        });
      });
    });

    This should report the current status, set the device to the opposite of what it currently is, then report the changed status.

    See the setup instructions for how to find the needed parameters.

    📓 Docs

    See the docs.

    IMPORTANT: Only one TCP connection can be in use with a device at once. If testing this, do not have the app on your phone open.

    TODO

    1. Add automated tests
    2. Document details of protocol

    Contributors

    Original Project:

    Related

    Install

    npm i homebridge-tuyapi-extended

    DownloadsWeekly Downloads

    20

    Version

    1.0.9

    License

    MIT

    Unpacked Size

    577 kB

    Total Files

    12

    Last publish

    Collaborators

    • drumfreak