[SOLVED] Tuya (Teckin SB50) bulb Connection Issue

Tags: #<Tag:0x00007f2fb1be2660> #<Tag:0x00007f2fb1be2430>

Hi all,

I have Teckin SB50 blubs, trying to control through openHAB. I think I did all the setup as instructed by @HolgiHab in his great effort here

Here is my item:
Switch BedRoom_TL1 "Bed Room Table Lamp" [ "Switchable" ] {channel="mqtt:topic:ccca1435:1002"}

Here is my sitemap:
Frame label="Bed Room" { Switch item=BedRoom_TL1 label="Bed Room Table Lamp" }

I got and used the ID, keys and IP address of the device. I can do the tuya-cli get command and get a successful payload from the bulb:

[root@telegramhost tuya-mqtt]# DEBUG=* tuya-cli get --ip 192.168.8.109 --id xxxxxxxxxxxxxxxxxx --key xxxxxxxxxxx --all
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.8.109… +3ms
TuyAPI Socket connected. +79ms
TuyAPI GET Payload: +1ms
TuyAPI { gwId: ‘xxxxxxxxxxxxxxxx’, devId: ‘xxxxxxxxxxxxxxxxx’ } +0ms
TuyAPI Pinging 192.168.8.109 +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051bb030000ab45 +34ms
TuyAPI Parsed: +0ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from 192.168.8.109 +1ms

However, when I run the DEBUG=* node tuya-mqtt.js and send mqtt commands whether through openHAB items from the control tab or mqtt.fx app using the manual method, it keep failing as shown in the debug below:

TuyAPI:mqtt receive settings {“topic”:“tuya/xxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxx/192.168.8.109/command”,“action”:“command”,“message”:“OFF”,“options”:{“id”:“xxxxxxxxxxxxxxxxx”,“key”:“xxxxxxxxxxxxxxx”,“ip”:“192.168.8.109”}} +23s
TuyAPI:device Search device in network +23s
TuyAPI IP and ID are already both resolved. +23s
TuyAPI:device Device found in network +1ms
TuyAPI Connecting to 192.168.8.109… +0ms
TuyAPI Socket connected. +121ms
TuyAPI:device Connected to device. undefined (192.168.8.109, xxxxxxxxxxxxxxxxx, xxxxxxxxxxxxx) +122ms
TuyAPI:device GET Payload: +0ms
TuyAPI:device { gwId: ‘xxxxxxxxxxxxxxxxx’, devId: ‘xxxxxxxxxxxxxxxxx’ } +0ms
TuyAPI:mqtt receive command { set: false } +124ms
TuyAPI:device set: { set: false } +1ms
TuyAPI SET Payload: +2ms
TuyAPI {
TuyAPI devId: ‘xxxxxxxxxxxxxxxxx’,
TuyAPI gwId: ‘xxxxxxxxxxxxxxxxx’,
TuyAPI uid: ‘’,
TuyAPI t: 1567712880,
TuyAPI dps: { ‘1’: false }
TuyAPI } +0ms
TuyAPI Pinging 192.168.8.109 +10s
TuyAPI Error event from socket. 192.168.8.109 Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:201:27) {
errno: ‘ECONNRESET’,
code: ‘ECONNRESET’,
syscall: ‘read’
} +46ms
TuyAPI:device:error Error: Error from socket
TuyAPI:device:error at Socket. (/etc/openhab2/scripts/tuya-mqtt/node_modules/tuyapi/index.js:365:30)
TuyAPI:device:error at Socket.emit (events.js:209:13)
TuyAPI:device:error at emitErrorNT (internal/streams/destroy.js:91:8)
TuyAPI:device:error at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
TuyAPI:device:error at processTicksAndRejections (internal/process/task_queues.js:80:21) +34s
TuyAPI Socket closed: 192.168.8.109 +1ms
TuyAPI:device Disconnected from device. undefined (192.168.8.109, xxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxx) +10s
TuyAPI:device delete Device undefined (192.168.8.109, xxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxx) +0ms

Things I tried so far:

restarted openHAB
restarted the bulb
closed the Smart Life app as some other people recommend
tried to remove the light from the Smart Life app
factory reset the bulb and reconfigure it which renewed the key then I reused the new key in openHAB thing and try again.

I’m running on the following:

openHAB: 2.4.0-1
OS: Linux CentOS 7 (Linux telegramhost.localhost 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux)
Node: v12.10.0
NPM: 6.10.3

I think I’m in a rabbit hole now. Appreciate your help here.

Thanks.

Solved by @Fiftiz here