milo526 / homebridge-tuya-web

Hoobs and Homebridge plugin for Tuya devices using Home Assistant Tuya Web Api
MIT License
219 stars 96 forks source link

Error Retrieving Devices states #4

Closed rcoletti116 closed 4 years ago

rcoletti116 commented 4 years ago

Started getting this error. HomeKit still allows me to control the devices, but Homebridge shows API errors. [6/12/2020, 5:42:46 PM] [TuyaWebPlatform] Error retrieving devices states Error: No valid response from API at sendRequestJson (/usr/lib/node_modules/@milo526/homebridge-tuya-web/lib/tuyawebapi.js:78:18) at sendRequest (/usr/lib/node_modules/@milo526/homebridge-tuya-web/lib/tuyawebapi.js:309:11) at Request.request [as _callback] (/usr/lib/node_modules/@milo526/homebridge-tuya-web/lib/tuyawebapi.js:295:11) at Request.self.callback (/usr/lib/node_modules/@milo526/homebridge-tuya-web/node_modules/request/request.js:185:22) at Request.emit (events.js:198:13) at Request. (/usr/lib/node_modules/@milo526/homebridge-tuya-web/node_modules/request/request.js:1154:10) at Request.emit (events.js:198:13) at IncomingMessage. (/usr/lib/node_modules/@milo526/homebridge-tuya-web/node_modules/request/request.js:1076:12) at Object.onceWrapper (events.js:286:20) at IncomingMessage.emit (events.js:203:15) at endReadableNT (_stream_readable.js:1143:12) at process._tickCallback (internal/process/next_tick.js:63:19)

SkOODaT commented 4 years ago

im seeing same device state error~

mbierman commented 4 years ago

Here's what I'm seeing. If any further information would be helpful, please let me know.

[6/13/2020, 12:33:27 PM] [Smart Life] Error retrieving devices states Error: No valid response from API
    at /homebridge/node_modules/@milo526/homebridge-tuya-web/lib/tuyawebapi.js:78:18
    at /homebridge/node_modules/@milo526/homebridge-tuya-web/lib/tuyawebapi.js:309:11
    at Request._callback (/homebridge/node_modules/@milo526/homebridge-tuya-web/lib/tuyawebapi.js:295:11)
    at Request.self.callback (/homebridge/node_modules/@milo526/homebridge-tuya-web/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (/homebridge/node_modules/@milo526/homebridge-tuya-web/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (/homebridge/node_modules/@milo526/homebridge-tuya-web/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)

My Configuration

Module Version
Node.js 12.18.0
NPM 6.14.5
homebridge 1.1.0
Alpine Linux (running in a Docker on a Synology) 3.11.6
[
  {
    "name": "homebridge-config-ui-x",
    "displayName": "Homebridge Config UI X",
    "description": "A web based management, configuration and control platform for Homebridge",
    "verifiedPlugin": false,
    "installedVersion": "4.22.0",
    "globalInstall": true,
    "settingsSchema": true,
    "installPath": "/usr/local/lib/node_modules",
    "publicPackage": true,
    "latestVersion": "4.22.0",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-config-ui-x",
      "homepage": "https://github.com/oznu/homebridge-config-ui-x#readme"
    },
    "author": "oznu",
    "engines": {
      "node": ">=10.17.0",
      "homebridge": ">=0.4.22"
    }
  },
  {
    "name": "@milo526/homebridge-tuya-web",
    "description": "Homebrigde plugin for use with Tuya devices (uses Home Assistant Tuya Web API)",
    "verifiedPlugin": false,
    "installedVersion": "0.2.0",
    "globalInstall": false,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "0.2.0",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/@milo526/homebridge-tuya-web",
      "homepage": "https://github.com/milo526/homebridge-tuya-web#readme"
    },
    "author": "milo526",
    "engines": {
      "node": ">=0.12.0",
      "homebridge": ">=0.2.0"
    }
  },
  {
    "name": "homebridge-accessory-neurio",
    "description": "A neur.io accessory plugin for Homebridge:",
    "verifiedPlugin": false,
    "installedVersion": "0.9.9",
    "globalInstall": false,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "0.9.9",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-accessory-neurio",
      "homepage": "https://github.com/homespun/homebridge-accessory-neurio#readme"
    },
    "author": "mrose17",
    "engines": {
      "node": ">=0.12.0",
      "homebridge": ">=0.4.16"
    }
  },
  {
    "name": "homebridge-automation-calendar",
    "description": "Useful calendar information for HomeKit automations (seasons, week of the year, month of the year, morning twilight/sunrise/daytime/sunset/evening twilight/night)",
    "verifiedPlugin": false,
    "installedVersion": "0.0.2",
    "globalInstall": false,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "0.0.2",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-automation-calendar",
      "homepage": "https://github.com/paolotremadio/homebridge-automation-calendar#readme"
    },
    "author": "paolotremadio",
    "engines": {
      "node": ">=6.0.0",
      "homebridge": ">=0.4.0"
    }
  },
  {
    "name": "homebridge-chamberlain",
    "description": "> Homebridge plugin for MyQ garage doors.",
    "verifiedPlugin": true,
    "installedVersion": "1.6.0",
    "globalInstall": false,
    "settingsSchema": true,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "1.6.0",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-chamberlain",
      "homepage": "https://github.com/iRayanKhan/homebridge-chamberlain#readme"
    },
    "author": "caseywebdev",
    "engines": {
      "homebridge": "x"
    }
  },
  {
    "name": "homebridge-http-switch",
    "description": "Powerful http switch for Homebridge",
    "verifiedPlugin": false,
    "installedVersion": "0.5.30",
    "globalInstall": false,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "0.5.30",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-http-switch",
      "homepage": "https://github.com/Supereg/homebridge-http-switch#readme"
    },
    "author": "supereg",
    "engines": {
      "node": ">=10.17.0",
      "homebridge": ">=0.4.8"
    }
  },
  {
    "name": "homebridge-nest",
    "description": "Nest Thermostat and Protect plug-in for homebridge",
    "verifiedPlugin": true,
    "installedVersion": "4.4.6",
    "globalInstall": false,
    "settingsSchema": true,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "4.4.6",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-nest",
      "homepage": "https://github.com/chrisjshull/homebridge-nest#readme"
    },
    "author": "adrian.cable",
    "engines": {
      "homebridge": ">=0.2.5",
      "node": ">=7.0.0"
    }
  },
  {
    "name": "homebridge-powerloss-ifttt-notifier",
    "description": "Powerloss IFTTT webhook notifier",
    "verifiedPlugin": false,
    "installedVersion": "0.0.4",
    "globalInstall": false,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "0.0.4",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-powerloss-ifttt-notifier",
      "homepage": "https://github.com/ivan-aleksandrov/homebridge-powerloss-ifttt-notifier#readme"
    },
    "author": "ivan-aleksandrov",
    "engines": {
      "homebridge": ">=0.2.0",
      "node": ">=8.0.0"
    }
  },
  {
    "name": "homebridge-synology",
    "description": "Synology Diskstation support for Homebridge:",
    "verifiedPlugin": false,
    "installedVersion": "0.3.1",
    "globalInstall": false,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "0.3.1",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-synology",
      "homepage": "https://github.com/stfnhmplr/homebridge-synology#readme"
    },
    "author": "stfnhmplr",
    "engines": {
      "node": ">=0.12.0",
      "homebridge": ">=0.2.0"
    }
  },
  {
    "name": "homebridge-weather-plus",
    "description": "A comprehensive weather plugin for homekit with current observations, forecasts and history.",
    "verifiedPlugin": true,
    "installedVersion": "3.2.2",
    "globalInstall": false,
    "settingsSchema": true,
    "installPath": "/homebridge/node_modules",
    "publicPackage": true,
    "latestVersion": "3.2.2",
    "updateAvailable": false,
    "links": {
      "npm": "https://www.npmjs.com/package/homebridge-weather-plus",
      "homepage": "https://github.com/naofireblade/homebridge-weather-plus#readme"
    },
    "author": "naofireblade",
    "engines": {
      "node": ">=10.0.0",
      "homebridge": ">=1.0.0"
    }
  }
]
bwp91 commented 4 years ago

The issue is too many requests to the API in a short space of time. I have found a fix... give me a few minutes to hopefully make a pull request

bwp91 commented 4 years ago

Please see pull request https://github.com/milo526/homebridge-tuya-web/pull/5

FortuneV13 commented 4 years ago

I have the same issue. Have done for quite a while now. Can get annoying as it fills the logs up but the device still works so I’ve left it.

marksthomas commented 4 years ago

Yeh, same here.

Going to have to remove the plug in as the logs are just full of this error.

rcoletti116 commented 4 years ago

Please see pull request

5

Thanks! I see you have your own fork of the original plugin. Should we go install yours?

FortuneV13 commented 4 years ago

Please see pull request

5

Thanks! I see you have your own fork of the original plugin. Should we go install yours?

Ive just installed it but still getting the same issue at the moment.

bwp91 commented 4 years ago

Ive just installed it but still getting the same issue at the moment.

Strange. Its working fine for me now. Then again I only use the plug-in for a couple of single switches. Do you have other types of devices?

FortuneV13 commented 4 years ago

Ive just installed it but still getting the same issue at the moment.

Strange. Its working fine for me now. Then again I only use the plug-in for a couple of single switches. Do you have other types of devices?

Hmm, I only have the the one single switch on mine. I did have them both installed at the same time for a moment. Maybe thats messed it up. Whats your polling set to ?

bwp91 commented 4 years ago

When i looked into the response from the API which was throwing the original error, instead of obj.header.success being "SUCCESS", it was "FrequentlyInvoke".

I'm assuming this just means too many requests at once? So my attempted fix (im not expert) was to add the lines:

if (obj.header && obj.header.code === 'SUCCESS') {
  if (obj.payload && obj.payload.devices) {
    resolve(obj.payload.devices);
  }
}
else if (obj.header && obj.header.code === 'FrequentlyInvoke') { //added
  this.log.debug('Requesting too quickly.');//added
} else {//added
  reject(new Error('No valid response from API', obj));
}
bwp91 commented 4 years ago

the idea of the code is to just "ignore" if the api responds with the 'FrequentlyInvoke' so nothing will happen but more importantly no error is thrown. My polling is set to 20

bwp91 commented 4 years ago

Ive just installed it but still getting the same issue at the moment.

I've made a couple more edits on my own fork -- try reinstalling my fork to see if thats made any difference. Otherwise someone with more experience that me will have to look!!

rcoletti116 commented 4 years ago

installed your fork @thepotterfamily but still getting the errors coinciding with my polling frequency.

bwp91 commented 4 years ago

im very new to github/npm so still making mistakes. I realise I had an old package on npm that you may have been trying instead of one with the fix. Try: https://www.npmjs.com/package/homebridge-tuya-web-beta

dikodahan commented 4 years ago

im very new to github/npm so still making mistakes. I realise I had an old package on npm that you may have been trying instead of one with the fix. Try: https://www.npmjs.com/package/homebridge-tuya-web-beta

Seems to have resolved the issue for me as well. Thank you!

bwp91 commented 4 years ago

Probably worth mentioning, not necessary to increase the polling as the nature of the “fix” is that if the request doesn’t work then the plugin will just ignore but then continue polling anyway. HTH

rcoletti116 commented 4 years ago

Yes, this fixed it! Thanks for clarifying the beta package.

FortuneV13 commented 4 years ago

Probably worth mentioning, not necessary to increase the polling as the nature of the “fix” is that if the request doesn’t work then the plugin will just ignore but then continue polling anyway. HTH

All working for me now. nice work!

derthobo commented 4 years ago

Is it normal that outlets expose as switches now? :(

bwp91 commented 4 years ago

Is it normal that outlets expose as switches now? :(

was that after installing my own fork?

dikodahan commented 4 years ago

With v0.3.0 I now see each outlet as 2 accessories in HomeKit and Homebridge. Each Outlet now shows up as both a switch and an outlet.

bwp91 commented 4 years ago

With v0.3.0 I now see each outlet as 2 accessories in HomeKit and Homebridge. Each Outlet now shows up as both a switch and an outlet.

This happened to me too, all I can suggest is to clear the Homebridge cache (you can do it per-device through config-ui-x). so clear the cache of the devices used through this plugin and then restart homebridge. the down side is that the accessories will be "reset" in the apple Home app so will need to be added back to any scenes/automations etc.

dikodahan commented 4 years ago

With v0.3.0 I now see each outlet as 2 accessories in HomeKit and Homebridge. Each Outlet now shows up as both a switch and an outlet.

This happened to me too, all I can suggest is to clear the Homebridge cache (you can do it per-device through config-ui-x). so clear the cache of the devices used through this plugin and then restart homebridge. the down side is that the accessories will be "reset" in the apple Home app so will need to be added back to any scenes/automations etc.

Cool. Solved the duplicates for me.

SkOODaT commented 4 years ago

can we have the beta pushed to release so it will just update 😉 seems to be fixed by the comments :) NM i see this is a diff fork lol

derthobo commented 4 years ago

Is it normal that outlets expose as switches now? :(

was that after installing my own fork?

Yes. After deleting the cache and reinstalling the plugin it works fine! :) thank you for your work :)

marksthomas commented 4 years ago

Newbie question - how does one install this fork?

mbierman commented 4 years ago

If you mean the pull request, I think it would be npm i @fratton/homebridge-tuya-web -g

marksthomas commented 4 years ago

If you mean the pull request, I think it would be npm i @fratton/homebridge-tuya-web -g

Thanks. That's worked in that the error has been reduced to one line, but be good to get this sorted fully. Thanks for the help.

mbierman commented 4 years ago

So I tried installing @fratton's fork. Unfortunately not so good. Things do seem to be generally working, but the errors have not gone away.

6/16/2020, 1:32:23 AM] [Smart Life] [GET][Driveway OFF] Characteristic.On Error: Error: Invalid payload in response: 
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/lib/tuyawebapi.js:120:20
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/lib/tuyawebapi.js:310:11
    at Request._callback (/homebridge/node_modules/@fratton/homebridge-tuya-web/lib/tuyawebapi.js:296:11)
    at Request.self.callback (/homebridge/node_modules/@fratton/homebridge-tuya-web/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (/homebridge/node_modules/@fratton/homebridge-tuya-web/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (/homebridge/node_modules/@fratton/homebridge-tuya-web/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
[6/16/2020, 1:32:24 AM] [Smart Life] [GET][Driveway OFF] Characteristic.On Error: Error: Invalid payload in response: 
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/lib/tuyawebapi.js:120:20
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/lib/tuyawebapi.js:310:11
    at Request._callback (/homebridge/node_modules/@fratton/homebridge-tuya-web/lib/tuyawebapi.js:296:11)
    at Request.self.callback (/homebridge/node_modules/@fratton/homebridge-tuya-web/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (/homebridge/node_modules/@fratton/homebridge-tuya-web/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (/homebridge/node_modules/@fratton/homebridge-tuya-web/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
[6/16/2020, 1:42:12 AM] [Smart Life] Error retrieving devices states undefined

Update 1

I rebooted the container running homebridge and for now at least, the messages are gone. I'll keep my eyes open for a day or so and see how things run and report back if I have any news.

Update 2 One recurring error is back.

[6/16/2020, 2:26:12 AM] [Smart Life] Error retrieving devices states undefined
[6/16/2020, 2:32:12 AM] [Smart Life] Error retrieving devices states undefined  

My Configuration

{
    "platform": "TuyaWebPlatform",
    "name": "Smart Life",
    "options": {
        "username": "",
        "password": "",
        "countryCode": "1",
        "platform": "smart_life",
        "pollingInterval": 120
    }
},
mbierman commented 4 years ago

More errors now.

[6/16/2020, 11:25:03 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:27:03 AM] [Smart Life] Error retrieving devices states undefined
[6/16/2020, 11:29:03 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:31:03 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:33:03 AM] [Smart Life] Error retrieving devices states undefined
[6/16/2020, 11:35:03 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:37:03 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:39:03 AM] [Smart Life] Error retrieving devices states undefined
[6/16/2020, 11:41:04 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:43:03 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:45:05 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:47:03 AM] [Smart Life] Error retrieving devices states undefined
[6/16/2020, 11:49:03 AM] [Smart Life] Error retrieving devices states undefined
[6/16/2020, 11:51:04 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:51:45 AM] [Config] [@fratton/homebridge-tuya-web] Failed to check registry.npmjs.org for updates: timeout of 5000ms exceeded
[6/16/2020, 11:53:03 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[6/16/2020, 11:55:03 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    [6/16/2020, 11:57:04 AM] [Smart Life] Error retrieving devices states TypeError: Cannot read property 'updateAccessory' of undefined
    at /homebridge/node_modules/@fratton/homebridge-tuya-web/index.js:97:42
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
mbierman commented 4 years ago

So I just noticed the update to the @fratton's fork of homebridge-tuya-web. After installing that I'm not seeing errors (at least not yet).

steveb85 commented 4 years ago

Would love to get consensus on which to install and move forward with, maybe they can be merged?

mbierman commented 4 years ago

Would love to get consensus on which to install and move forward with, maybe they can be merged?

I would love for these to be merged. I'd rather see more effort made on one branch than having users try and figure out which fork to use and which bugs are worse than others at any given time. More development focus on a single fork would make for a much better plugin that is fixed and enhanced faster.

I don't know exhaustively what the differences are, but I know that @fratton's fork supports scenes. While I don't feel strongly that scenes are critical to import since they can be done in homekit, @milo526's fork gave errors because of scenes which bothers me.

milo526 commented 4 years ago

Hello, Thank you all for your feedback and sorry for not responding, for some reason Github did not think it would be useful to send me mails on newly created issues although it did notify me of forks created -_-'.

I would love to have clarity for all users on what branch/fork/version to install.

I originally made this fork to support a specific model of Tuya fan that I bought, this worked great for me. I do not use other functionality of the Tuya app such as scenes or timers.

I would love to work together with both @fratton and @thepotterfamily to create one version of this library that could be actively maintained, please let me know your intentions and we can probably figure something out.

bwp91 commented 4 years ago

@milo526 Completely agree. Im very new to github so after forking your package I made a change to fix the issue in this topic, but then made a few more changes (ie the config schema file). I'm also aware that some people might now have my version installed, but tbh I'd rather merge the changes into your package. So what Im going to do is delete my repository (the -beta) version, refork yours, make just the necessary changes for my fix, and then make a pull request. So anyone who has my package installed can then revert back to this one!

bwp91 commented 4 years ago

Pull request made :)

mbierman commented 4 years ago

Hello, Thank you all for your feedback and sorry for not responding, for some reason Github did not think it would be useful to send me mails on newly created issues although it did notify me of forks created -_-'.

I would love to have clarity for all users on what branch/fork/version to install.

I originally made this fork to support a specific model of Tuya fan that I bought, this worked great for me. I do not use other functionality of the Tuya app such as scenes or timers.

I would love to work together with both @fratton and @thepotterfamily to create one version of this library that could be actively maintained, please let me know your intentions and we can probably figure something out.

What about @basdelfos ?

milo526 commented 4 years ago

Hello, Thank you all for your feedback and sorry for not responding, for some reason Github did not think it would be useful to send me mails on newly created issues although it did notify me of forks created -_-'. I would love to have clarity for all users on what branch/fork/version to install. I originally made this fork to support a specific model of Tuya fan that I bought, this worked great for me. I do not use other functionality of the Tuya app such as scenes or timers. I would love to work together with both @fratton and @thepotterfamily to create one version of this library that could be actively maintained, please let me know your intentions and we can probably figure something out.

What about @basdelfos ?

Well since their repo starts with

!! THIS REPOSITORY IS NOT ACTIVELY MAINTAINED ANYMORE, PLEASE FEEL FREE TO CREATE FORK !!

I don't expect a lot there. I would however love to hear their intentions from them.

mbierman commented 4 years ago

Well since their repo starts with

!! THIS REPOSITORY IS NOT ACTIVELY MAINTAINED ANYMORE, PLEASE FEEL FREE TO CREATE FORK !! I don't expect a lot there. I would however love to hear their intentions from them.

Doh! Sorry. good point. Missed that.

milo526 commented 4 years ago

For all in this thread, an update has just been released that silences these errors, they are not yet fixed, just logged to the debug log instead of your default log. I hope to be able to work on a fix this weekend.

bwp91 commented 4 years ago

For all in this thread, an update has just been released that silences these errors, they are not yet fixed, just logged to the debug log instead of your default log. I hope to be able to work on a fix this weekend.

https://github.com/milo526/homebridge-tuya-web/issues/4#issuecomment-644121708

Surely the "FrequentlyInvoke" response is from too making many requests to the tuya api? Not really sure how else this could be solved from this end (except perhaps increasing polling time)?

milo526 commented 4 years ago

The cause of the problem is indeed clear and as you described, there are however other (possibly better) solutions to this problem.

Once the error is detected the plugin should back-off and reduce the interval at which it sends these polling requests. I would like to take a look at this and see if I can find some documentation for this so the plugin could also enforce a minimum polling time or if the plugin could use its available requests more efficiently (possibly querying multiple devices at the same time)

fratton commented 4 years ago

I don't know exhaustively what the differences are, but I know that @fratton's fork supports scenes. While I don't feel strongly that scenes are critical to import since they can be done in homekit, @milo526's fork gave errors because of scenes which bothers me.

Hi, I created my fork for myself and friends with the end of support of Tuya Smart Life's IFTTT . I use the scenes because the Smartlife IR gateway does not seem to be supported by tuyawebapi.js We could add in the configuration file for scenes true / false for enable or not the scenes in config.schema.json ?

mbierman commented 4 years ago

@fratton That would be fantastic! A Boolean value or something in the user’s config would be amazing!

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

milo526 commented 4 years ago

Thank you all for your input here, since this issue has grown quite a bit in size, and has attracted multiple issues I will close this issue.

Implementation of scenes can be tracked in #8.
The API issue has been suppressed for now and I'm continuously looking into ways to improve this.
With regards to what library to use? I'd like to call this library actively maintained. @fratton his fork currently supports scenes, if that is a must switch to that version for now. @vitramir its version currently supports some more devices but seems to have some unsuppressed issues with the API, if these devices are a must for you please switch to that branch.

@thepotterfamily its fork has been deprecated referencing back to this library (the fixed in that fork have been backported to this version).

Lastly homebridge-tuya-web (the original one by @basdelfos) is currently equal to @milo526/homebridge-tuya-web, bas kindly put up a notice on his repo referencing to my repo. I plan on deprecating one of the packages and referencing to the other one once the next major version gets released (what namespace should we use? @milo526/homebridge-tuya-web has more installs homebridge-tuya-web is cleaner and easier)

I believe that answers all the questions in this issue. If you have any questions please respond in another already opened issue or open a new issue.