Giter Site home page Giter Site logo

Comments (32)

tsightler avatar tsightler commented on May 27, 2024

The error noted is from TuyAPI (the underlying API that this script uses) and indicates that there's no active connection to the device. Debug output would be helpful, and I should probably trap the error scenario, but since you mention that you are already running tuya-mqtt on a different device, my first guess might be that you didn't stop it there before starting it on the new device. Most Tuya devices only support a single concurrent local connection and will reject all other attempts to connect to the device locallt, so, if another instance of the script (or the Tuya app for example) is already connected to the device, then running a second instance will not be able to connect.

This should be clearly visible when running with debug output as reconnect attempts will happen every 30 seconds or so.

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

tsightler avatar tsightler commented on May 27, 2024

The "tuyacli wizard" command just pulls the device list via the Tuya Cloud service REST API and has nothing to do with connecting to the local device, it's just getting the data needed to connect to those devices.

Based on the message it appears that UDP port 6667 is already used by something on the Synology and thus can't be bound by TuyAPI. You will either need to stop whatever is using that port, or you could try manually specifying the IP, key and protocol version in the config file, which should allow the device to be discovered without requiring UDP.

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

tsightler avatar tsightler commented on May 27, 2024

It looks like this IRC service is part of Synology Chat Server feature. I'm not sure if there is a way to uninstall or disable it, but at least it's now clear that this is the problem. I'm going to close this now since this issue is not related to tuya-mqtt but feel free to come back and post a solution if you determine how to fix it.

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

tsightler avatar tsightler commented on May 27, 2024

It's not possible for tuya-mqtt to use a port other than UDP 6667 for discovery because that's the port that the Tuya devices use to broadcast their discovery packets for protocol 3.3 devices (protocol 3.1 device use UDP port 6666). Attempting to listen on another port would just mean those discovery packets would never be received.

However, as I noted above, you can manually specify the IP, key, and protocol version for the device in the config file and then discovery should not matter. When you only specify the key of the device, tuya-mqtt (really TuyAPI) has to listen on port 6667 for the UDP packet from the device to discover the IP and protocol version, but, if you manually specify this data, then UDP based discovery is not required, it will just try to connect directly to those devices using the information provided.

I have no idea why OpenHAB would be using port 6667 though as that's not typical, IMO.

from tuya-mqtt.

Flip76 avatar Flip76 commented on May 27, 2024

That's right, OpenHAB typically uses Port 8080 / 8443 TCP! Can you verify that OH is really using port 6667? What URL you use in the browser to access the OH GUI?

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

tsightler avatar tsightler commented on May 27, 2024

I found one other person that reported the same issue with the old tuya-mqtt script conflicting with OpenHAB on UDP port 6667 in the OpenHAB forum, but I never saw a resolution as to why. I don't know enough about OpenHAB to know what would be listening on that port but the summary version is that tuya-mqtt requires the ability to use this port for discovery as I can't change what port Tuya devices are hard coded to send the UDP discovery packets to so, if something else is using it, the only option is to manually specify the ID, IP address and protocol version in the config and not use discovery.

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

Flip76 avatar Flip76 commented on May 27, 2024

IMHO you need to specify IP and version manually - for example:

  {
    name: 'Plug',
    id: '363062476001********',
    key: '0354913f********',
    ip: '192.168.1.200',
    version: '3.1',
    type: 'SimpleSwitch'
  },

Also the apostrophe seems to be in a strange character (after ip: )

from tuya-mqtt.

tsightler avatar tsightler commented on May 27, 2024

Correct, as I noted above and is clearly stated in the documentation, if you don't use discovery there is no way for TuyAPI to automatically detect the protocol version so you must supply id, key, ip, and version, the latter being the protocol version of your device (typically 3.3 these days).

I'm considering making 3.3 the default guessed protocol version in the future since those seem to be by far the most common devices, but it's a breaking change for any existing user that does happen to have 3.1 protocol devices, so I've been hesitant to do it.

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

from tuya-mqtt.

Flip76 avatar Flip76 commented on May 27, 2024

Erik, could you please change your mail-format to plain text (instead of html) or send your update directly within Github. It's very hard to read your updates ( see here: #62 )

from tuya-mqtt.

Flip76 avatar Flip76 commented on May 27, 2024

Which version have you set for device id 8037870450029170f251 - can you try 3.1 and 3.3 and see if the problem still exists?

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

Sorry - I will change the format.
I have tried both 3.1 and 3.3

Hope this one is more readable:

`[16:06:39] root@openHABianDevice:/opt/tuya-mqtt# ./test.sh
  tuya-mqtt:info Connection established to MQTT server +0ms
  tuya-mqtt:tuyapi Search for device id 487668362cf432362176 +0ms
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +1ms
  tuya-mqtt:tuyapi Search for device id 80378704500291704621 +1ms
  tuya-mqtt:tuyapi Search for device id 73000250c44f339338aa +1ms
  tuya-mqtt:tuyapi Found device id 487668362cf432362176 +2ms
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +2ms
  tuya-mqtt:tuyapi Found device id 80378704500291704621 +0ms
  tuya-mqtt:tuyapi Found device id 73000250c44f339338aa +1ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +0ms
  tuya-mqtt:tuyapi Disconnected from device Switch1 (192.168.1.228, 487668362cf432362176, c503e1067353de66) +28ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +4ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +1ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +1ms
  tuya-mqtt:tuyapi Disconnected from device Spisebord (192.168.1.231, 80378704500291704621, 576ed7ce67b2f203) +6ms
  tuya-mqtt:tuyapi Disconnected from device Paere (192.168.1.235, 73000250c44f339338aa, c5b322f007e1823c) +1ms
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +0ms
  tuya-mqtt:error Error connecting to device id 487668362cf432362176...retry in 10 seconds. +996ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +3ms
  tuya-mqtt:error Error connecting to device id 73000250c44f339338aa...retry in 10 seconds. +1ms
  tuya-mqtt:error Error connecting to device id 80378704500291704621...retry in 10 seconds. +2ms
  tuya-mqtt:tuyapi Search for device id 487668362cf432362176 +11s
  tuya-mqtt:tuyapi Found device id 487668362cf432362176 +1ms
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +3ms
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:tuyapi Search for device id 73000250c44f339338aa +1ms
  tuya-mqtt:tuyapi Found device id 73000250c44f339338aa +1ms
  tuya-mqtt:tuyapi Search for device id 80378704500291704621 +1ms
  tuya-mqtt:tuyapi Found device id 80378704500291704621 +1ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +19ms
  tuya-mqtt:tuyapi Received JSON data from device 487668362cf432362176 -> {"1":false,"2":0} +33ms
  tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +3ms
  tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":false,"3":92} +299ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Connected to device Switch1 (192.168.1.228, 487668362cf432362176, c503e1067353de66) +666ms
  tuya-mqtt:discovery Home Assistant config topic: homeassistant/switch/487668362cf432362176/config +0ms
  tuya-mqtt:discovery {
  tuya-mqtt:discovery   name: 'Switch1',
  tuya-mqtt:discovery   state_topic: 'tuya/switch1/state',
  tuya-mqtt:discovery   command_topic: 'tuya/switch1/command',
  tuya-mqtt:discovery   availability_topic: 'tuya/switch1/status',
  tuya-mqtt:discovery   payload_available: 'online',
  tuya-mqtt:discovery   payload_not_available: 'offline',
  tuya-mqtt:discovery   unique_id: '487668362cf432362176',
  tuya-mqtt:discovery   device: {
  tuya-mqtt:discovery     ids: [ '487668362cf432362176' ],
  tuya-mqtt:discovery     name: 'Switch1',
  tuya-mqtt:discovery     mf: 'Tuya',
  tuya-mqtt:discovery     mdl: 'Switch/Socket'
  tuya-mqtt:discovery   }
  tuya-mqtt:discovery } +0ms
  tuya-mqtt:tuyapi Connected to device Spisebord (192.168.1.231, 80378704500291704621, 576ed7ce67b2f203) +17ms
  tuya-mqtt:discovery Home Assistant config topic: homeassistant/light/80378704500291704621/config +0ms
  tuya-mqtt:discovery {
  tuya-mqtt:discovery   name: 'Spisebord',
  tuya-mqtt:discovery   state_topic: 'tuya/spisebord/state',
  tuya-mqtt:discovery   command_topic: 'tuya/spisebord/command',
  tuya-mqtt:discovery   brightness_state_topic: 'tuya/spisebord/brightness_state',
  tuya-mqtt:discovery   brightness_command_topic: 'tuya/spisebord/brightness_command',
  tuya-mqtt:discovery   brightness_scale: 100,
  tuya-mqtt:discovery   availability_topic: 'tuya/spisebord/status',
  tuya-mqtt:discovery   payload_available: 'online',
  tuya-mqtt:discovery   payload_not_available: 'offline',
  tuya-mqtt:discovery   unique_id: '80378704500291704621',
  tuya-mqtt:discovery   device: {
  tuya-mqtt:discovery     ids: [ '80378704500291704621' ],
  tuya-mqtt:discovery     name: 'Spisebord',
  tuya-mqtt:discovery     mf: 'Tuya',
  tuya-mqtt:discovery     mdl: 'Dimmer Switch'
  tuya-mqtt:discovery   }
  tuya-mqtt:discovery } +1ms
  tuya-mqtt:tuyapi Connected to device Paere (192.168.1.235, 73000250c44f339338aa, c5b322f007e1823c) +7ms
  tuya-mqtt:discovery Home Assistant config topic: homeassistant/light/73000250c44f339338aa/config +5ms
  tuya-mqtt:discovery {
  tuya-mqtt:discovery   name: 'Paere',
  tuya-mqtt:discovery   state_topic: 'tuya/paere/state',
  tuya-mqtt:discovery   command_topic: 'tuya/paere/command',
  tuya-mqtt:discovery   brightness_state_topic: 'tuya/paere/brightness_state',
  tuya-mqtt:discovery   brightness_command_topic: 'tuya/paere/brightness_command',
  tuya-mqtt:discovery   brightness_scale: 100,
  tuya-mqtt:discovery   availability_topic: 'tuya/paere/status',
  tuya-mqtt:discovery   payload_available: 'online',
  tuya-mqtt:discovery   payload_not_available: 'offline',
  tuya-mqtt:discovery   unique_id: '73000250c44f339338aa',
  tuya-mqtt:discovery   device: {
  tuya-mqtt:discovery     ids: [ '73000250c44f339338aa' ],
  tuya-mqtt:discovery     name: 'Paere',
  tuya-mqtt:discovery     mf: 'Tuya',
  tuya-mqtt:discovery     mdl: 'Dimmer Switch'
  tuya-mqtt:discovery   }
  tuya-mqtt:discovery } +0ms
  tuya-mqtt:tuyapi Received JSON data from device 487668362cf432362176 -> {"1":false,"2":0} +1s
  tuya-mqtt:state tuya/switch1/state OFF +0ms
  tuya-mqtt:state MQTT DPS JSON: tuya/switch1/dps/state ->  {"1":false,"2":0} +2ms
  tuya-mqtt:state MQTT DPS1: tuya/switch1/dps/1/state ->  false +1ms
  tuya-mqtt:state MQTT DPS2: tuya/switch1/dps/2/state ->  0 +1ms
  tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +7ms
  tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":false,"3":92} +3ms
  tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +23ms
  tuya-mqtt:state tuya/spisebord/state ON +31ms
  tuya-mqtt:state tuya/spisebord/brightness_state 35 +20ms
  tuya-mqtt:state MQTT DPS JSON: tuya/spisebord/dps/state ->  {"1":true,"2":106} +1ms
  tuya-mqtt:state MQTT DPS1: tuya/spisebord/dps/1/state ->  true +0ms
  tuya-mqtt:state MQTT DPS2: tuya/spisebord/dps/2/state ->  106 +1ms
  tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":false,"3":92} +27ms
  tuya-mqtt:error Could not get value for device DPS key 2 +1s
  tuya-mqtt:state tuya/paere/state OFF +47ms
  tuya-mqtt:state MQTT DPS JSON: tuya/paere/dps/state ->  {"1":false,"3":92} +1ms
  tuya-mqtt:state MQTT DPS1: tuya/paere/dps/1/state ->  false +0ms
  tuya-mqtt:state MQTT DPS3: tuya/paere/dps/3/state ->  92 +1ms
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +9s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +9s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +23ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +1ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +29ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +25ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +28ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +28ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +26ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +1ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +28ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +27ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +29ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +30ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +32ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +28ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +1ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +27ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +29ms
  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s
  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +11s
  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms
  tuya-mqtt:error Error: Error from socket
  tuya-mqtt:error     at Socket.<anonymous> (/opt/tuya-mqtt/node_modules/tuyapi/index.js:387:30)
  tuya-mqtt:error     at Socket.emit (events.js:314:20)
  tuya-mqtt:error     at emitErrorNT (internal/streams/destroy.js:92:8)
  tuya-mqtt:error     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
  tuya-mqtt:error     at processTicksAndRejections (internal/process/task_queues.js:84:21) +10s
  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c732`

from tuya-mqtt.

Flip76 avatar Flip76 commented on May 27, 2024

Thanks, much better now! 👍

In one of your last updates, I saw you used type: 'TuyaDevice' - as to my knowledge this is not a valid type. What kind of device is it? Can you try GenericDevice instead of TuyaDevice?

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

TuyaDevice is defined in the device folder (tuya-device.js) . It was just for testing.

Current devices.conf looks like this:
`[
{
name: 'Switch1',
id: '487668362cf432362176',
key: 'c503e1067353de66',
ip: '192.168.1.228',
version: '3.3',
type: 'SimpleSwitch'
},
{
name: 'Bordlampe',
id: '8037870450029170f251',
key: 'b1971c7323052c78',
ip: '192.168.1.200',
version: '3.3',
type: 'SimpleDimmer'
},
{
name: 'Spisebord',
id: '80378704500291704621',
key: '576ed7ce67b2f203',
ip: '192.168.1.231',
version: '3.3',
type: 'SimpleDimmer'
},
{
name: 'Paere',
id: '73000250c44f339338aa',
key: 'c5b322f007e1823c',
ip: '192.168.1.235',
version: '3.3',
type: 'SimpleDimmer'
}
]

`

from tuya-mqtt.

Flip76 avatar Flip76 commented on May 27, 2024

The config looks ok - I guess "Bordlampe" and "Spiseboard" are the same type of devices? Did you connect via the Tuya-App after you started tuya-mqtt?

Did you try to reboot the device (physically disconnect/reconnect from power)?

from tuya-mqtt.

tsightler avatar tsightler commented on May 27, 2024

Looking at the above it seems like only a single device is actually failing, the other three show no issues. The device that is failing is rejecting the socket connection which implies that something about that device configuration is incorrect (wrong id, key, ip, protocol version) or that something is already connected to it. Also, does that device work if you use auto-discovery?

Sometimes I've had a device get in this state where it stops accepting local connections and even the Tuya app won't connect locally although control via Tuya cloud would still work, however, this usually seems to clear up after a few minutes. I had one light bulb get in this state for hours at one point, I thought I had killed it by sending an invalid value to one of the DPS keys, but, when I woke up the next morning, it had recovered in the middle of the night after hundreds of retries.

You could also try stopping tuya-mqtt and attempt to control that device via tuya-cli, but the error above is pretty basic, a standard socket error, and is coming from TuyAPI, which is used by both tuya-mqtt and tuya-cli.

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

Yes - 'Bordlampe' and 'Spisebord' is the same type/brand.
I have tuya-app connected on my iPhone. I also tried to switch off the tuya-app - no change.
the device "Bordlampe" continues to refuce to connect

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

I double checkt the parameters with tuya-cli. I have been able to use that device until yesterday (in the old configuration)
I added another device - a dual dimmer (defined as type SimpleDimmer) - at this one is also connected. (I do not know if I can use this type without creating a new device object for DualDimmer??, but this is not important right now)

from tuya-mqtt.

tsightler avatar tsightler commented on May 27, 2024

I see in logs you had previously posted that it worked at least once with auto discovery so you might want to try changing that one back to auto-discovery. You should see if it still works if you revert that device to auto-discovery. Also, please post the working tuya-cli command.

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

This is the printout from tuya-cli and copied directly into devices.conf

[ { name: 'Bordlampe', id: '8037870450029170f251', key: 'b1971c7323052c78' }, { name: 'Switch1', id: '487668362cf432362176', key: 'c503e1067353de66' }, { name: '2wDimmer', id: '38341275c82b9648acb0', key: 'a823482508e90875' }, { name: 'Spisebord', id: '80378704500291704621', key: '576ed7ce67b2f203' }, { name: 'Paere', id: '73000250c44f339338aa', key: 'c5b322f007e1823c' }, { name: 'Hoveddør', id: 'bf5959607ad139b09cqivc', key: '698139bd9dbc9f7b' } ]

This is the resulting dump:

`[17:06:51] root@openHABianDevice:/opt/tuya-mqtt# ./test.sh
tuya-mqtt:info Connection established to MQTT server +0ms
tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +0ms
tuya-mqtt:tuyapi Search for device id 487668362cf432362176 +7ms
tuya-mqtt:tuyapi Search for device id 38341275c82b9648acb0 +1ms
tuya-mqtt:tuyapi Search for device id 80378704500291704621 +1ms
tuya-mqtt:tuyapi Search for device id 73000250c44f339338aa +0ms
tuya-mqtt:tuyapi Search for device id bf5959607ad139b09cqivc +1ms
tuya-mqtt:tuyapi Found device id 80378704500291704621 +1s
tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +55ms
tuya-mqtt:tuyapi Found device id 73000250c44f339338aa +239ms
tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":false,"3":92} +51ms
tuya-mqtt:tuyapi Found device id 38341275c82b9648acb0 +546ms
tuya-mqtt:tuyapi Found device id 487668362cf432362176 +3ms
tuya-mqtt:tuyapi Received JSON data from device 487668362cf432362176 -> {"1":false,"2":0} +34ms
tuya-mqtt:tuyapi Received JSON data from device 38341275c82b9648acb0 -> {"1":true,"2":1000,"6":0,"7":true,"8":300,"12":0} +2ms
tuya-mqtt:tuyapi Connected to device Spisebord (80378704500291704621, 576ed7ce67b2f203) +89ms
tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +27ms
tuya-mqtt:state MQTT DPS JSON: tuya/spisebord/dps/state -> {"1":true,"2":106} +0ms
tuya-mqtt:state MQTT DPS1: tuya/spisebord/dps/1/state -> true +1ms
tuya-mqtt:state MQTT DPS2: tuya/spisebord/dps/2/state -> 106 +28ms
tuya-mqtt:tuyapi Connected to device Paere (73000250c44f339338aa, c5b322f007e1823c) +261ms
tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":false,"3":92} +36ms
tuya-mqtt:state MQTT DPS JSON: tuya/paere/dps/state -> {"1":false,"3":92} +268ms
tuya-mqtt:state MQTT DPS1: tuya/paere/dps/1/state -> false +1ms
tuya-mqtt:state MQTT DPS3: tuya/paere/dps/3/state -> 92 +1ms
tuya-mqtt:tuyapi Connected to device Switch1 (487668362cf432362176, c503e1067353de66) +561ms
tuya-mqtt:tuyapi Connected to device 2wDimmer (38341275c82b9648acb0, a823482508e90875) +3ms
tuya-mqtt:tuyapi Received JSON data from device 487668362cf432362176 -> {"1":false,"2":0} +26ms
tuya-mqtt:state MQTT DPS JSON: tuya/switch1/dps/state -> {"1":false,"2":0} +588ms
tuya-mqtt:state MQTT DPS1: tuya/switch1/dps/1/state -> false +1ms
tuya-mqtt:state MQTT DPS2: tuya/switch1/dps/2/state -> 0 +1ms
tuya-mqtt:tuyapi Received JSON data from device 38341275c82b9648acb0 -> {"1":true,"2":1000,"6":0,"7":true,"8":300,"12":0} +5ms
tuya-mqtt:state MQTT DPS JSON: tuya/2wdimmer/dps/state -> {"1":true,"2":1000,"6":0,"7":true,"8":300,"12":0} +3ms
tuya-mqtt:state MQTT DPS1: tuya/2wdimmer/dps/1/state -> true +0ms
tuya-mqtt:state MQTT DPS2: tuya/2wdimmer/dps/2/state -> 1000 +1ms
tuya-mqtt:state MQTT DPS6: tuya/2wdimmer/dps/6/state -> 0 +1ms
tuya-mqtt:state MQTT DPS7: tuya/2wdimmer/dps/7/state -> true +0ms
tuya-mqtt:state MQTT DPS8: tuya/2wdimmer/dps/8/state -> 300 +1ms
tuya-mqtt:state MQTT DPS12: tuya/2wdimmer/dps/12/state -> 0 +0ms
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 +0ms
tuya-mqtt:error find() timed out. Is the device powered on and the ID or IP correct? +3ms
tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms
tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +1m
tuya-mqtt:tuyapi Search for device id bf5959607ad139b09cqivc +1ms
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 +0ms
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

`

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

Everything but "Bordlampe" works. "Bordlampe" does work from tuya-app (and google home)

from tuya-mqtt.

Flip76 avatar Flip76 commented on May 27, 2024

Just a thought: Could it be that the ip-address of "Bordlampe" has been changed? Do you use DHCP?

from tuya-mqtt.

palsbo avatar palsbo commented on May 27, 2024

no - it is still the same :)

from tuya-mqtt.

tsightler avatar tsightler commented on May 27, 2024

Personally I would just delete and reinitialize that device and try again with the new key since all of the other devices seem to be working fine. There's obviously no issue with tuya-mqtt. As I said above, I would suggest you attempt to control the device with tuya-cli get/set (this has nothing to do with tuya-cli wizard output) and see if that works.

Unfortunately I don't have time to troubleshoot your device/environment specific issues and I think we can safely say that the issue is not with tuya-mqtt at this point, so I will be bowing out of this thread for now. I do hope you get it working.

from tuya-mqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.