TheAgentK / tuya-mqtt

Nodejs-Script to combine tuyaapi and openhab via mqtt
MIT License
173 stars 81 forks source link

Tuya bulb stopped working from tuya-cli, tuja-mqtt #84

Closed JacekKac closed 3 months ago

JacekKac commented 1 year ago

DEBUG=tuya-mqtt:* node tuya-mqtt.js tuya-mqtt:info Connection established to MQTT server +0ms tuya-mqtt:tuyapi Search for device id bfb80f70b6e3a8a205e0ru +0ms tuya-mqtt:tuyapi Search for device id bf541f534610c30095es6v +5ms tuya-mqtt:tuyapi Search for device id bff8864a3a5c63dcednlg0 +1ms tuya-mqtt:tuyapi Found device id bf541f534610c30095es6v +3s tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> U52AhS8B +220ms tuya-mqtt:tuyapi Connected to device ikeabulb05 (bf541f534610c30095es6v, 854ea077fa8be13b) +875ms tuya-mqtt:device-detect Attempting to detect light capabilites and DPS values... +0ms tuya-mqtt:device-detect Querying DPS 2 for white/color mode setting... +1ms tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> U52AhS8B +53ms tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> U52AhS8B +133ms tuya-mqtt:device-detect Automatic discovery of Tuya bulb settings failed and no manual configuration +179ms tuya-mqtt:error find() timed out. Is the device powered on and the ID or IP correct? +0ms tuya-mqtt:error Will attempt to find device again in 60 seconds +1ms tuya-mqtt:error find() timed out. Is the device powered on and the ID or IP correct? +6ms tuya-mqtt:error Will attempt to find device again in 60 seconds +2ms tuya-mqtt:tuyapi Search for device id bfb80f70b6e3a8a205e0ru +1m tuya-mqtt:tuyapi Search for device id bff8864a3a5c63dcednlg0 +3ms tuya-mqtt:error find() timed out. Is the device powered on and the ID or IP correct? +1m tuya-mqtt:error Will attempt to find device again in 60 seconds +1ms tuya-mqtt:error find() timed out. Is the device powered on and the ID or IP correct? +1ms tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms tuya-mqtt:command Received MQTT message -> {"topic":"tuya/ikeabulb05/dps/20/command","message":"true"} +0ms tuya-mqtt:command Received command for DPS20: true +0ms tuya-mqtt:tuyapi Set device bf541f534610c30095es6v -> {"dps":"20","set":true} +18s tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> U52AhS8B +57ms tuya-mqtt:error Timeout waiting for status response from device id: bf541f534610c30095es6v +10s tuya-mqtt:error Error connecting to device id bf541f534610c30095es6v...retry in 10 seconds. +1s

devices.conf name: 'ikeabulb05', id: 'bf541f534610c30095es6v', key: '---------', type: 'RGBTWLight' },

it used to work a month ago. I notice that iot.tuya introduced some changes to instructions send to devices "Standard instructions"/

image

not sure where the problem is....

tuya-cli get tuya-cli get --id bf541f534610c30095es6v --key ____ --dps 20 --full TypeError: Cannot read properties of undefined (reading '20') at Object.get (/usr/lib/node_modules/@tuyapi/cli/lib/control.js:49:31) at processTicksAndRejections (node:internal/process/task_queues:96:5)

lehanspb commented 1 year ago

Please try the latest version of codetheweb/tuyapi and tuya-cli

And my advice is to define IP and version in the devices.conf file. It helped me.

like this: { name: 'ikeabulb05', ip 'XX.XX.XX.XX', version: '3.X' id: 'bf541f534610c30095es6v', key: '---------', type: 'RGBTWLight' },

JacekKac commented 1 year ago

Thank you: tuya-cli -V - 1.18.3 not sure how to check current version of tuyaapi and don't know if my tuya-mqtt uses it

lehanspb commented 1 year ago

Execute this command: npm view tuyapi version

Example output: 7.5.1

Yes, tuya-mqtt has a dependency on tuyapi

JacekKac commented 1 year ago

npm view tuyapi version 7.5.1 still the same error ;(

tuya-mqtt:command Received MQTT message -> {"topic":"tuya/ikeabulb05/dps/20/command","message":"true"} +0ms tuya-mqtt:command Received command for DPS20: true +0ms tuya-mqtt:tuyapi Set device bf541f534610c30095es6v -> {"dps":"20","set":true} +43s tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> U52AhS8B +53ms tuya-mqtt:error Timeout waiting for status response from device id: bf541f534610c30095es6v +44s tuya-mqtt:error Error connecting to device id bf541f534610c30095es6v...retry in 10 seconds. +1s tuya-mqtt:tuyapi Search for device id bf541f534610c30095es6v +16s tuya-mqtt:tuyapi Found device id bf541f534610c30095es6v +0ms ^C tuya-mqtt:tuyapi Disconnected from device ikeabulb05 (bf541f534610c30095es6v, 854ea077fa8be13b) +413ms tuya-mqtt:info Exit code: SIGINT +1m tuya-mqtt:info Exit code: 0 +1s

lehanspb commented 1 year ago

Is there any difference when you execute these commands?

tuya-cli get --id bf541f534610c30095es6v --key ____ --dps 20 tuya-cli get --id bf541f534610c30095es6v --key ____ --dps 20 --protocol-version 3.3 tuya-cli get --ip XX.XX.XX.XX --id bf541f534610c30095es6v --key ____ --dps 20 --protocol-version 3.3

JacekKac commented 1 year ago

tuya-cli get tuya-cli get --id bf541f534610c30095es6v --key ____ --dps 20 TypeError: Cannot read properties of undefined (reading '20') at Object.get (/usr/lib/node_modules/@tuyapi/cli/lib/control.js:49:31) at processTicksAndRejections (node:internal/process/task_queues:96:5)

tuya-cli get tuya-cli get --id bf541f534610c30095es6v --key 854ea077fa8be13b --dps 20 --protocol-version 3.3 TypeError: Cannot read properties of undefined (reading '20') at Object.get (/usr/lib/node_modules/@tuyapi/cli/lib/control.js:49:31) at processTicksAndRejections (node:internal/process/task_queues:96:5)

tuya-cli get tuya-cli get --ip 192.168.0.17 --id bf541f534610c30095es6v --key _____ --dps 20 --protocol-version 3.3 TypeError: Cannot read properties of undefined (reading '20') at Object.get (/usr/lib/node_modules/@tuyapi/cli/lib/control.js:49:31) at processTicksAndRejections (node:internal/process/task_queues:96:5)

lehanspb commented 1 year ago

Please try my fork of tuya-mqtt: https://github.com/lehanspb/tuya-mqtt I've made some changes such as useful dp-refresh function. it is possible that dependencies will be updated during installation and may be this solves your problem.

JacekKac commented 1 year ago

Using tuya app:

tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> 33tmCokCVpqJa +10s
  tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> 33CgBkbqfIvIgNM +7s
  tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> 33tmCokCVI2pCE +4s
  tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> 33CgBk4MPK orS +3s
  tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> 33tmCokCV2N9qG +1s
  tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> 33CgBk4MPKwssEL +1s

using mqtt :

tuya-mqtt:command Received MQTT message -> {"topic":"tuya/ikeabulb05/dps/20/command","message":"true"} +0ms tuya-mqtt:command Received command for DPS20: true +0ms tuya-mqtt:tuyapi Set device bf541f534610c30095es6v -> {"dps":"20","set":true} +11s tuya-mqtt:command Received MQTT message -> {"topic":"tuya/ikeabulb05/hsb_command","message":"309,64,43"} +39ms tuya-mqtt:command Received MQTT command message is a text string +39ms tuya-mqtt:command Invalid command topic tuya/ikeabulb05/hsb_command for device id: bf541f534610c30095es6v +1ms tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> U52AhS8B +43ms tuya-mqtt:error Timeout waiting for status response from device id: bf541f534610c30095es6v +34s tuya-mqtt:command Received MQTT message -> {"topic":"tuya/ikeabulb05/dps/20/command","message":"true"} +5s tuya-mqtt:command Received command for DPS20: true +5s tuya-mqtt:tuyapi Set device bf541f534610c30095es6v -> {"dps":"20","set":true} +5s tuya-mqtt:command Received MQTT message -> {"topic":"tuya/ikeabulb05/hsb_command","message":"309,64,74"} +51ms tuya-mqtt:command Received MQTT command message is a text string +51ms tuya-mqtt:command Invalid command topic tuya/ikeabulb05/hsb_command for device id: bf541f534610c30095es6v +0ms tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> U52AhS8B +58ms tuya-mqtt:error Error connecting to device id bf541f534610c30095es6v...retry in 10 seconds. +1s tuya-mqtt:error Timeout waiting for status response from device id: bf541f534610c30095es6v +4s tuya-mqtt:command Received MQTT message -> {"topic":"tuya/ikeabulb05/dps/20/command","message":"false"} +6s tuya-mqtt:command Received command for DPS20: false +6s tuya-mqtt:tuyapi Set device bf541f534610c30095es6v -> {"dps":"20","set":false} +6s tuya-mqtt:tuyapi Received string data from device bf541f534610c30095es6v -> U52AhS8B +78ms tuya-mqtt:tuyapi Search for device id bf541f534610c30095es6v +5s tuya-mqtt:tuyapi Found device id bf541f534610c30095es6v +1ms tuya-mqtt:error Timeout waiting for status response from device id: bf541f534610c30095es6v +6s tuya-mqtt:error Error connecting to device id bf541f534610c30095es6v...retry in 10 seconds. +1s

lehanspb commented 1 year ago

You can also enable full debug: DEBUG=* node tuya-mqtt.js This will give you even more debug information.