unparagoned / njsTuya

Openhab interface for Tuya home automation devices sold under various names
27 stars 11 forks source link

After upgrading my pi and then rebooting ... #34

Closed edwolfe3 closed 3 years ago

edwolfe3 commented 3 years ago

After I did an upgrade of my pi (acting as my openhab server), I starting receiving the following output:

  njstuya booting njstuya +0ms
  njstuya "{argName} value is: 06200045dc4f2236e565_2 +7ms
  njstuya "{argName} value is: cloud +0ms
  njstuya api {"userName":"[blanked]","password":"[blanked]","countryCode":"1","bizType":"smart_life","region":"us"} or [blanked] +4ms
  cloudtuya {"responseStatus":"error","errorMsg":"you cannot auth exceed once in 60 seconds"} +0ms
  cloudtuya {
  cloudtuya   responseStatus: 'error',
  cloudtuya   errorMsg: 'you cannot auth exceed once in 60 seconds'
  cloudtuya } +2ms
  njstuya Token {"responseStatus":"error","errorMsg":"you cannot auth exceed once in 60 seconds"} +510ms
  cloudtuya { devId: '06200045dc4f2236e565_2' } +5ms
  cloudtuya INVAILD_REQUEST_2 +436ms
(node:4100) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'devices' of undefined
    at CloudTuya.find (/etc/openhab2/scripts/node_modules/cloudtuya/cloudtuya.js:101:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async CloudTuya.state (/etc/openhab2/scripts/node_modules/cloudtuya/cloudtuya.js:147:19)
    at async runCloud (/etc/openhab2/scripts/node_modules/njstuya/njstuya.js:206:26)
(node:4100) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4100) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.5.10
                               Release Build

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab> 
unparagoned commented 3 years ago

Added support to cache token, so it doesn't need to auth on every use. Should work fine now.