unparagoned / njsTuya

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

Problem with connection to device after firmware upgrade #26

Closed RobsonW70 closed 4 years ago

RobsonW70 commented 4 years ago

Hi By mistake I upgraded firmware to version 1.1.7 (MCU Wifi) and now I cannot connect njsTuya to the device Is anybody who had the same issue? Or how can I do firmware downgrade of tthe Wifi module on the switch ?

[11:45:40] openhabian@openhab:/etc/openhab2/scripts/njsTuya$ node njstuya.js -ip 192.168.x.152 -get '{ "schema": true}' (node:3228) UnhandledPromiseRejectionWarning: undefined (node:3228) 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(). (rejection id: 1) (node:3228) [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. (node:3228) UnhandledPromiseRejectionWarning: Error: find() timed out. Is the device powered on and the ID or IP correct? at timeout (/etc/openhab2/scripts/njsTuya/node_modules/tuyapi/index.js:654:13) at Timeout.setTimeout [as _onTimeout] (/etc/openhab2/scripts/njsTuya/node_modules/p-timeout/index.js:19:13) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) (node:3228) 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(). (rejection id: 2) [11:45:55] openhabian@openhab:/etc/openhab2/scripts/njsTuya$

bnjroos commented 4 years ago

As this has not been updated for a while, you need to modify the tuyapi version to the latest. tuyapi depency in package.json should be as followed: "tuyapi": "github:codetheweb/tuyapi" Then in njsTuya, when creating the tuyadevice object, add the version:

 tuya = new TuyaDevice({
    id: tuyaID,
    key: tuyaKey,
    ip: tuyaIP,
    version: '3.3',

This worked like a charm for me.

RobsonW70 commented 4 years ago

I updated tuyapi in node_modules I change version and it dosn't work ;( and when I setup version 3.3 the devices with old firmware dont work (they work only with 3.1 ;P( Still issue with firmware 1.7 ;( R

RobsonW70 commented 4 years ago

it doesn't work with my device;(

steve1066d commented 4 years ago

did you do a npm update after making the change?

unparagoned commented 4 years ago

You should be able to specify the version using the argument -v 3.3. node njstuya.js -ip 192.168.x.152 -v 3.3 -get '{ "schema": true}'