TheAgentK / tuya-mqtt

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

Problem installing on Synology RS914 #62

Closed palsbo closed 3 years ago

palsbo commented 3 years ago

When trying to install on RS914 (npm install) I get the following:

`ash-4.3# npm install audited 322 packages in 17.975s

45 packages are looking for funding run npm fund for details

found 2 vulnerabilities (1 low, 1 high) run npm audit fix to fix them, or npm audit for details

ash-4.3#`

running npm audit, I get the following: `ash-4.3# npm audit

                   === npm audit security report ===

┌──────────────────────────────────────────────────────────────────────────────┐ │ Manual Review │ │ Some vulnerabilities require your attention to resolve │ │ │ │ Visit https://go.npm.me/audit-guide for additional guidance │ └──────────────────────────────────────────────────────────────────────────────┘ ┌───────────────┬──────────────────────────────────────────────────────────────┐ │ Low │ Prototype Pollution │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Package │ minimist │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Patched in │ >=0.2.1 <1.0.0 || >=1.2.3 │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Dependency of │ @tuyapi/cli │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Path │ @tuyapi/cli > http-mitm-proxy > optimist > minimist │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ More info │ https://npmjs.com/advisories/1179 │ └───────────────┴──────────────────────────────────────────────────────────────┘ ┌───────────────┬──────────────────────────────────────────────────────────────┐ │ High │ Prototype Pollution in node-forge │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Package │ node-forge │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Patched in │ >= 0.10.0 │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Dependency of │ @tuyapi/cli │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Path │ @tuyapi/cli > http-mitm-proxy > node-forge │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ More info │ https://npmjs.com/advisories/1561 │ └───────────────┴──────────────────────────────────────────────────────────────┘ found 2 vulnerabilities (1 low, 1 high) in 322 scanned packages 2 vulnerabilities require manual review. See the full report for details. ash-4.3#`

Running npm audit fix, I get the following: `ash-4.3# npm audit fix up to date in 15.732s

45 packages are looking for funding run npm fund for details

fixed 0 of 2 vulnerabilities in 322 scanned packages 2 vulnerabilities required manual review and could not be updated ash-4.3#`

Sending command from MQTT prints the following: (node:7616) UnhandledPromiseRejectionWarning: Error: No connection has been made to the device. at TuyaDevice._send (/volume1/homes/admin/tuya-mqtt-master/node_modules/tuyapi/index.js:269:13) at pTimeout._setResolver (/volume1/homes/admin/tuya-mqtt-master/node_modules/tuyapi/index.js:242:14) at new Promise (<anonymous>) at /volume1/homes/admin/tuya-mqtt-master/node_modules/tuyapi/index.js:238:46 at run (/volume1/homes/admin/tuya-mqtt-master/node_modules/p-queue/dist/index.js:153:104) at PQueue._tryToStartAnother (/volume1/homes/admin/tuya-mqtt-master/node_modules/p-queue/dist/index.js:101:38) at /volume1/homes/admin/tuya-mqtt-master/node_modules/p-queue/dist/index.js:167:18 at new Promise (<anonymous>) at PQueue.add (/volume1/homes/admin/tuya-mqtt-master/node_modules/p-queue/dist/index.js:148:16) at TuyaDevice.set (/volume1/homes/admin/tuya-mqtt-master/node_modules/tuyapi/index.js:238:27) (node:7616) 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: 2) (node:7616) [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. Any idea? Thanks for the greate work - it works fine on my Raspberry pi but not on Synology. I have checked the configurations files and the cli.

tsightler commented 3 years ago

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.

palsbo commented 3 years ago

Thank you very much for a Quick responsse. I tried to switch off all other Equipment using the connecton to tuya, but still no Lock. Running en debug mode,  it looks like the port is not available, but running tuya-cli wizard shows the list of devices.: 

ash-4.3# tuya-cli wizard

DEBUG=tuya-mqtt:* node tuya-mqtt.js  tuya-mqtt:info Connection established to MQTT server +0ms  tuya-mqtt:tuyapi Search for device id 73000250c44f339338aa +0ms  tuya-mqtt:tuyapi Search for device id bf5959607ad139b09cqivc +17ms  tuya-mqtt:tuyapi Search for device id 80378704500291704621 +1ms  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +2ms  tuya-mqtt:tuyapi Search for device id 38341275c82b9648acb0 +1ms  tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6667 +0ms  tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms  tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6667 +1ms  tuya-mqtt:error Will attempt to find device again in 60 seconds +1ms  tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6667 +0ms  tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms  tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6667 +1ms  tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms  tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6667 +1ms  tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms

I am a bit confused😊 RegardsErik 

palsbo commented 3 years ago
Running cat Services gives this list of services and ports. Looks like port 6667 is used by some IRC, but Again tuya-cli Works??IRC is not installed.  ash-4.3# cat /etc/services# Network services, Internet style## Note that it is presently the policy of IANA to assign a single well-known# port number for both TCP and UDP; hence, officially ports have two entries# even if the protocol doesn't support UDP operations.## Updated from http://www.iana.org/assignments/port-numbers and other# sources like http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services .# New ports will be added on request if they have been officially assigned# by IANA and used in the real-world or are needed by a debian package.# If you need a huge list of used numbers please install the nmap package. tcpmux          1/tcp                           # TCP port service multiplexerecho            7/tcpecho            7/udpdiscard         9/tcp           sink nulldiscard         9/udp           sink nullsystat          11/tcp          usersdaytime         13/tcpdaytime         13/udpnetstat         15/tcpqotd            17/tcp          quotemsp             18/tcp                          # message send protocolmsp             18/udpchargen         19/tcp          ttytst sourcechargen         19/udp          ttytst sourceftp-data        20/tcpftp             21/tcpfsp             21/udp          fspdssh             22/tcp                          # SSH Remote Login Protocolssh             22/udptelnet          23/tcpsmtp            25/tcp          mailtime            37/tcp          timservertime            37/udp          timserverrlp             39/udp          resource        # resource locationnameserver      42/tcp          name            # IEN 116whois           43/tcp          nicnametacacs          49/tcp                          # Login Host Protocol (TACACS)tacacs          49/udpre-mail-ck      50/tcp                          # Remote Mail Checking Protocolre-mail-ck      50/udpdomain          53/tcp                          # Domain Name Serverdomain          53/udpmtp             57/tcp                          # deprecatedtacacs-ds       65/tcp                          # TACACS-Database Servicetacacs-ds       65/udpbootps          67/tcp                          # BOOTP serverbootps          67/udpbootpc          68/tcp                          # BOOTP clientbootpc          68/udptftp            69/udpgopher          70/tcp                          # Internet Gophergopher          70/udprje             77/tcp          netrjsfinger          79/tcphttp            80/tcp          www             # WorldWideWeb HTTPhttp            80/udp                          # HyperText Transfer Protocollink            87/tcp          ttylinkkerberos        88/tcp          kerberos5 krb5 kerberos-sec     # Kerberos v5kerberos        88/udp          kerberos5 krb5 kerberos-sec     # Kerberos v5supdup          95/tcphostnames       101/tcp         hostname        # usually from sri-niciso-tsap        102/tcp         tsap            # part of ISODEacr-nema        104/tcp         dicom           # Digital Imag. & Comm. 300acr-nema        104/udp         dicomcsnet-ns        105/tcp         cso-ns          # also used by CSO name servercsnet-ns        105/udp         cso-nsrtelnet         107/tcp                         # Remote Telnetrtelnet         107/udppop2            109/tcp         postoffice pop-2 # POP version 2pop2            109/udp         pop-2pop3            110/tcp         pop-3           # POP version 3pop3            110/udp         pop-3sunrpc          111/tcp         portmapper      # RPC 4.0 portmappersunrpc          111/udp         portmapperauth            113/tcp         authentication tap identsftp            115/tcpuucp-path       117/tcpnntp            119/tcp         readnews untp   # USENET News Transfer Protocolntp             123/tcpntp             123/udp                         # Network Time Protocolpwdgen          129/tcp                         # PWDGEN servicepwdgen          129/udploc-srv         135/tcp         epmap           # Location Serviceloc-srv         135/udp         epmapnetbios-ns      137/tcp                         # NETBIOS Name Servicenetbios-ns      137/udpnetbios-dgm     138/tcp                         # NETBIOS Datagram Servicenetbios-dgm     138/udpnetbios-ssn     139/tcp                         # NETBIOS session servicenetbios-ssn     139/udpimap2           143/tcp         imap            # Interim Mail Access P 2 and 4imap2           143/udp         imapsnmp            161/tcp                         # Simple Net Mgmt Protocolsnmp            161/udpsnmp-trap       162/tcp         snmptrap        # Traps for SNMPsnmp-trap       162/udp         snmptrapcmip-man        163/tcp                         # ISO mgmt over IP (CMOT)cmip-man        163/udpcmip-agent      164/tcpcmip-agent      164/udpmailq           174/tcp                 # Mailer transport queue for Zmailermailq           174/udpxdmcp           177/tcp                         # X Display Mgr. Control Protoxdmcp           177/udpnextstep        178/tcp         NeXTStep NextStep       # NeXTStep windownextstep        178/udp         NeXTStep NextStep       #  serverbgp             179/tcp                         # Border Gateway Protocolbgp             179/udpprospero        191/tcp                         # Cliff Neuman's Prosperoprospero        191/udpirc             194/tcp                         # Internet Relay Chatirc             194/udpsmux            199/tcp                         # SNMP Unix Multiplexersmux            199/udpat-rtmp         201/tcp                         # AppleTalk routingat-rtmp         201/udpat-nbp          202/tcp                         # AppleTalk name bindingat-nbp          202/udpat-echo         204/tcp                         # AppleTalk echoat-echo         204/udpat-zis          206/tcp                         # AppleTalk zone informationat-zis          206/udpqmtp            209/tcp                         # Quick Mail Transfer Protocolqmtp            209/udpz3950           210/tcp         wais            # NISO Z39.50 databasez3950           210/udp         waisipx             213/tcp                         # IPXipx             213/udpimap3           220/tcp                         # Interactive Mail Accessimap3           220/udp                         # Protocol v3pawserv         345/tcp                         # Perf Analysis Workbenchpawserv         345/udpzserv           346/tcp                         # Zebra serverzserv           346/udpfatserv         347/tcp                         # Fatmen Serverfatserv         347/udprpc2portmap     369/tcprpc2portmap     369/udp                         # Coda portmappercodaauth2       370/tcpcodaauth2       370/udp                         # Coda authentication serverclearcase       371/tcp         Clearcaseclearcase       371/udp         Clearcaseulistserv       372/tcp                         # UNIX Listservulistserv       372/udpldap            389/tcp                 # Lightweight Directory Access Protocolldap            389/udpimsp            406/tcp                 # Interactive Mail Support Protocolimsp            406/udpsvrloc          427/tcp                         # Server Locationsvrloc          427/udphttps           443/tcp                         # http protocol over TLS/SSLhttps           443/udpsnpp            444/tcp                         # Simple Network Paging Protocolsnpp            444/udpmicrosoft-ds    445/tcp                         # Microsoft Naked CIFSmicrosoft-ds    445/udpkpasswd         464/tcpkpasswd         464/udpurd             465/tcp         ssmtp smtps  # URL Rendesvous Directory for SSMsaft            487/tcp                 # Simple Asynchronous File Transfersaft            487/udpisakmp          500/tcp                 # IPsec - Internet Security Associationisakmp          500/udp                 #  and Key Management Protocolrtsp            554/tcp                 # Real Time Stream Control Protocolrtsp            554/udpnqs             607/tcp                         # Network Queuing systemnqs             607/udpnpmp-local      610/tcp         dqs313_qmaster          # npmp-local / DQSnpmp-local      610/udp         dqs313_qmasternpmp-gui        611/tcp         dqs313_execd            # npmp-gui / DQSnpmp-gui        611/udp         dqs313_execdhmmp-ind        612/tcp         dqs313_intercell        # HMMP Indication / DQShmmp-ind        612/udp         dqs313_intercellasf-rmcp        623/udp         # ASF Remote Management and Control Protocolqmqp            628/tcpqmqp            628/udpipp             631/tcp                         # Internet Printing Protocolipp             631/udp## UNIX specific services#exec            512/tcpbiff            512/udp         comsatlogin           513/tcpwho             513/udp         whodshell           514/tcp         cmd             # no passwords usedsyslog          514/udpprinter         515/tcp         spooler         # line printer spoolertalk            517/udpntalk           518/udproute           520/udp         router routed   # RIPtimed           525/udp         timeservertempo           526/tcp         newdatecourier         530/tcp         rpcconference      531/tcp         chatnetnews         532/tcp         readnewsnetwall         533/udp                         # for emergency broadcastsgdomap          538/tcp                         # GNUstep distributed objectsgdomap          538/udpuucp            540/tcp         uucpd           # uucp daemonklogin          543/tcp                         # Kerberized `rlogin' (v5)kshell          544/tcp         krcmd           # Kerberized `rsh' (v5)dhcpv6-client   546/tcpdhcpv6-client   546/udpdhcpv6-server   547/tcpdhcpv6-server   547/udpafpovertcp      548/tcp                         # AFP over TCPafpovertcp      548/udpidfp            549/tcpidfp            549/udpremotefs        556/tcp         rfs_server rfs  # Brunhoff remote filesystemnntps           563/tcp         snntp           # NNTP over SSLnntps           563/udp         snntpsubmission      587/tcp                         # Submission [RFC4409]submission      587/udpldaps           636/tcp                         # LDAP over SSLldaps           636/udptinc            655/tcp                         # tinc control porttinc            655/udpsilc            706/tcpsilc            706/udpkerberos-adm    749/tcp                         # Kerberos `kadmin' (v5)#webster         765/tcp                         # Network dictionarywebster         765/udprsync           873/tcprsync           873/udpftps-data       989/tcp                         # FTP over SSL (data)ftps            990/tcptelnets         992/tcp                         # Telnet over SSLtelnets         992/udpimaps           993/tcp                         # IMAP over SSLimaps           993/udpircs            994/tcp                         # IRC over SSLircs            994/udppop3s           995/tcp                         # POP-3 over SSLpop3s           995/udp## From ``Assigned Numbers'':##> The Registered Ports are not controlled by the IANA and on most systems#> can be used by ordinary user processes or programs executed by ordinary#> users.##> Ports are used in the TCP [45,106] to name the ends of logical#> connections which carry long term conversations.  For the purpose of#> providing services to unknown callers, a service contact port is#> defined.  This list specifies the port used by the server process as its#> contact port.  While the IANA can not control uses of these ports it#> does register or list uses of these ports as a convienence to the#> community.#socks           1080/tcp                        # socks proxy serversocks           1080/udpproofd          1093/tcpproofd          1093/udprootd           1094/tcprootd           1094/udpopenvpn         1194/tcpopenvpn         1194/udprmiregistry     1099/tcp                        # Java RMI Registryrmiregistry     1099/udpkazaa           1214/tcpkazaa           1214/udpnessus          1241/tcp                        # Nessus vulnerabilitynessus          1241/udp                        #  assessment scannerlotusnote       1352/tcp        lotusnotes      # Lotus Notelotusnote       1352/udp        lotusnotesms-sql-s        1433/tcp                        # Microsoft SQL Serverms-sql-s        1433/udpms-sql-m        1434/tcp                        # Microsoft SQL Monitorms-sql-m        1434/udpingreslock      1524/tcpingreslock      1524/udpprospero-np     1525/tcp                        # Prospero non-privilegedprospero-np     1525/udpdatametrics     1645/tcp        old-radiusdatametrics     1645/udp        old-radiussa-msg-port     1646/tcp        old-radacctsa-msg-port     1646/udp        old-radacctkermit          1649/tcpkermit          1649/udpgroupwise       1677/tcpgroupwise       1677/udpl2f             1701/tcp        l2tpl2f             1701/udp        l2tpradius          1812/tcpradius          1812/udpradius-acct     1813/tcp        radacct         # Radius Accountingradius-acct     1813/udp        radacctmsnp            1863/tcp                        # MSN Messengermsnp            1863/udpunix-status     1957/tcp                        # remstats unix-status serverlog-server      1958/tcp                        # remstats log serverremoteping      1959/tcp                        # remstats remoteping servercisco-sccp      2000/tcp                        # Cisco SCCPcisco-sccp      2000/udpsearch          2010/tcp        ndtppipe-server     2010/tcp        pipe_servernfs             2049/tcp                        # Network File Systemnfs             2049/udp                        # Network File Systemgnunet          2086/tcpgnunet          2086/udprtcm-sc104      2101/tcp                        # RTCM SC-104 IANA 1/29/99rtcm-sc104      2101/udpgsigatekeeper   2119/tcpgsigatekeeper   2119/udpgris            2135/tcp                # Grid Resource Information Servergris            2135/udpcvspserver      2401/tcp                        # CVS client/server operationscvspserver      2401/udpvenus           2430/tcp                        # codacon portvenus           2430/udp                        # Venus callback/wbc interfacevenus-se        2431/tcp                        # tcp side effectsvenus-se        2431/udp                        # udp sftp side effectcodasrv         2432/tcp                        # not usedcodasrv         2432/udp                        # server portcodasrv-se      2433/tcp                        # tcp side effectscodasrv-se      2433/udp                        # udp sftp side effectmon             2583/tcp                        # MON trapsmon             2583/udpdict            2628/tcp                        # Dictionary serverdict            2628/udpf5-globalsite   2792/tcpf5-globalsite   2792/udpgsiftp          2811/tcpgsiftp          2811/udpgpsd            2947/tcpgpsd            2947/udpgds-db          3050/tcp        gds_db          # InterBase servergds-db          3050/udp        gds_dbicpv2           3130/tcp        icp             # Internet Cache Protocolicpv2           3130/udp        icpiscsi-target    3260/tcpmysql           3306/tcpmysql           3306/udpnut             3493/tcp                        # Network UPS Toolsnut             3493/udpdistcc          3632/tcp                        # distributed compilerdistcc          3632/udpdaap            3689/tcp                        # Digital Audio Access Protocoldaap            3689/udpsvn             3690/tcp        subversion      # Subversion protocolsvn             3690/udp        subversionsuucp           4031/tcp                        # UUCP over SSLsuucp           4031/udpsysrqd          4094/tcp                        # sysrq daemonsysrqd          4094/udpsieve           4190/tcp                        # ManageSieve Protocolepmd            4369/tcp                        # Erlang Port Mapper Daemonepmd            4369/udpremctl          4373/tcp                # Remote Authenticated Command Serviceremctl          4373/udpf5-iquery       4353/tcp                        # F5 iQueryf5-iquery       4353/udpipsec-nat-t     4500/udp                        # IPsec NAT-Traversal [RFC3947]iax             4569/tcp                        # Inter-Asterisk eXchangeiax             4569/udpmtn             4691/tcp                        # monotone Netsync Protocolmtn             4691/udpradmin-port     4899/tcp                        # RAdmin Portradmin-port     4899/udprfe             5002/udp                        # Radio Free Ethernetrfe             5002/tcpmmcc            5050/tcp        # multimedia conference control tool (Yahoo IM)mmcc            5050/udpsip             5060/tcp                        # Session Initiation Protocolsip             5060/udpsip-tls         5061/tcpsip-tls         5061/udpaol             5190/tcp                        # AIMaol             5190/udpxmpp-client     5222/tcp        jabber-client   # Jabber Client Connectionxmpp-client     5222/udp        jabber-clientxmpp-server     5269/tcp        jabber-server   # Jabber Server Connectionxmpp-server     5269/udp        jabber-servercfengine        5308/tcpcfengine        5308/udpmdns            5353/tcp                        # Multicast DNSmdns            5353/udppostgresql      5432/tcp        postgres        # PostgreSQL Databasepostgresql      5432/udp        postgresfreeciv         5556/tcp        rptp            # Freeciv gameplayfreeciv         5556/udpamqps           5671/tcp                        # AMQP protocol over TLS/SSLamqp            5672/tcpamqp            5672/udpamqp            5672/sctpggz             5688/tcp                        # GGZ Gaming Zoneggz             5688/udpx11             6000/tcp        x11-0           # X Window Systemx11             6000/udp        x11-0x11-1           6001/tcpx11-1           6001/udpx11-2           6002/tcpx11-2           6002/udpx11-3           6003/tcpx11-3           6003/udpx11-4           6004/tcpx11-4           6004/udpx11-5           6005/tcpx11-5           6005/udpx11-6           6006/tcpx11-6           6006/udpx11-7           6007/tcpx11-7           6007/udpgnutella-svc    6346/tcp                        # gnutellagnutella-svc    6346/udpgnutella-rtr    6347/tcp                        # gnutellagnutella-rtr    6347/udpsge-qmaster     6444/tcp        sge_qmaster     # Grid Engine Qmaster Servicesge-qmaster     6444/udp        sge_qmastersge-execd       6445/tcp        sge_execd       # Grid Engine Execution Servicesge-execd       6445/udp        sge_execdmysql-proxy     6446/tcp                        # MySQL Proxymysql-proxy     6446/udpafs3-fileserver 7000/tcp        bbs             # file server itselfafs3-fileserver 7000/udp        bbsafs3-callback   7001/tcp                        # callbacks to cache managersafs3-callback   7001/udpafs3-prserver   7002/tcp                        # users & groups databaseafs3-prserver   7002/udpafs3-vlserver   7003/tcp                        # volume location databaseafs3-vlserver   7003/udpafs3-kaserver   7004/tcp                        # AFS/Kerberos authenticationafs3-kaserver   7004/udpafs3-volser     7005/tcp                        # volume managment serverafs3-volser     7005/udpafs3-errors     7006/tcp                        # error interpretation serviceafs3-errors     7006/udpafs3-bos        7007/tcp                        # basic overseer processafs3-bos        7007/udpafs3-update     7008/tcp                        # server-to-server updaterafs3-update     7008/udpafs3-rmtsys     7009/tcp                        # remote cache manager serviceafs3-rmtsys     7009/udpfont-service    7100/tcp        xfs             # X Font Servicefont-service    7100/udp        xfshttp-alt        8080/tcp        webcache        # WWW caching servicehttp-alt        8080/udpbacula-dir      9101/tcp                        # Bacula Directorbacula-dir      9101/udpbacula-fd       9102/tcp                        # Bacula File Daemonbacula-fd       9102/udpbacula-sd       9103/tcp                        # Bacula Storage Daemonbacula-sd       9103/udpxmms2           9667/tcp        # Cross-platform Music Multiplexing Systemxmms2           9667/udpnbd             10809/tcp                       # Linux Network Block Devicezabbix-agent    10050/tcp                       # Zabbix Agentzabbix-agent    10050/udpzabbix-trapper  10051/tcp                       # Zabbix Trapperzabbix-trapper  10051/udpamanda          10080/tcp                       # amanda backup servicesamanda          10080/udpdicom           11112/tcphkp             11371/tcp                       # OpenPGP HTTP Keyserverhkp             11371/udpbprd            13720/tcp                       # VERITAS NetBackupbprd            13720/udpbpdbm           13721/tcp                       # VERITAS NetBackupbpdbm           13721/udpbpjava-msvc     13722/tcp                       # BP Java MSVC Protocolbpjava-msvc     13722/udpvnetd           13724/tcp                       # Veritas Network Utilityvnetd           13724/udpbpcd            13782/tcp                       # VERITAS NetBackupbpcd            13782/udpvopied          13783/tcp                       # VERITAS NetBackupvopied          13783/udpdb-lsp          17500/tcp                       # Dropbox LanSync Protocoldcap            22125/tcp                       # dCache Access Protocolgsidcap         22128/tcp                       # GSI dCache Access Protocolwnn6            22273/tcp                       # wnn6wnn6            22273/udp ## Datagram Delivery Protocol services#rtmp            1/ddp                   # Routing Table Maintenance Protocolnbp             2/ddp                   # Name Binding Protocolecho            4/ddp                   # AppleTalk Echo Protocolzip             6/ddp                   # Zone Information Protocol #=========================================================================# The remaining port numbers are not as allocated by IANA.#========================================================================= # Kerberos (Project Athena/MIT) services# Note that these are for Kerberos v4, and are unofficial.  Sites running# v4 should uncomment these and comment out the v5 entries above.#kerberos4       750/udp         kerberos-iv kdc # Kerberos (server)kerberos4       750/tcp         kerberos-iv kdckerberos-master 751/udp         kerberos_master # Kerberos authenticationkerberos-master 751/tcppasswd-server   752/udp         passwd_server   # Kerberos passwd serverkrb-prop        754/tcp         krb_prop krb5_prop hprop # Kerberos slave propagationkrbupdate       760/tcp         kreg            # Kerberos registrationswat            901/tcp                         # swatkpop            1109/tcp                        # Pop with Kerberosknetd           2053/tcp                        # Kerberos de-multiplexorzephyr-srv      2102/udp                        # Zephyr serverzephyr-clt      2103/udp                        # Zephyr serv-hm connectionzephyr-hm       2104/udp                        # Zephyr hostmanagereklogin         2105/tcp                        # Kerberos encrypted rlogin# Hmmm. Are we using Kv4 or Kv5 now? Worrying.# The following is probably Kerberos v5  --- ajt@debian.org (11/02/2000)kx              2111/tcp                        # X over Kerberosiprop           2121/tcp                        # incremental propagation## Unofficial but necessary (for NetBSD) services#supfilesrv      871/tcp                         # SUP serversupfiledbg      1127/tcp                        # SUP debugging ## Services added for the Debian GNU/Linux distribution#linuxconf       98/tcp                          # LinuxConfpoppassd        106/tcp                         # Eudorapoppassd        106/udpmoira-db        775/tcp         moira_db        # Moira databasemoira-update    777/tcp         moira_update    # Moira update protocolmoira-ureg      779/udp         moira_ureg      # Moira user registrationspamd           783/tcp                         # spamassassin daemonomirr           808/tcp         omirrd          # online mirroromirr           808/udp         omirrdcustoms         1001/tcp                        # pmake customs servercustoms         1001/udpskkserv         1178/tcp                        # skk jisho server portpredict         1210/udp                        # predict -- satellite trackingrmtcfg          1236/tcp                        # Gracilis Packeten remote config serverwipld           1300/tcp                        # Wipl network monitorxtel            1313/tcp                        # french minitelxtelw           1314/tcp                        # french minitelsupport         1529/tcp                        # GNATScfinger         2003/tcp                        # GNU Fingerfrox            2121/tcp                        # frox: caching ftp proxyninstall        2150/tcp                        # ninstall serviceninstall        2150/udpzebrasrv        2600/tcp                        # zebra servicezebra           2601/tcp                        # zebra vtyripd            2602/tcp                        # ripd vty (zebra)ripngd          2603/tcp                        # ripngd vty (zebra)ospfd           2604/tcp                        # ospfd vty (zebra)bgpd            2605/tcp                        # bgpd vty (zebra)ospf6d          2606/tcp                        # ospf6d vty (zebra)ospfapi         2607/tcp                        # OSPF-APIisisd           2608/tcp                        # ISISd vty (zebra)afbackup        2988/tcp                        # Afbackup systemafbackup        2988/udpafmbackup       2989/tcp                        # Afmbackup systemafmbackup       2989/udpxtell           4224/tcp                        # xtell serverfax             4557/tcp                        # FAX transmission service (old)hylafax         4559/tcp                        # HylaFAX client-server protocol (new)distmp3         4600/tcp                        # distmp3host daemonmunin           4949/tcp        lrrd            # Muninenbd-cstatd     5051/tcp                        # ENBD client statdenbd-sstatd     5052/tcp                        # ENBD server statdpcrd            5151/tcp                        # PCR-1000 Daemonnoclog          5354/tcp                        # noclogd with TCP (nocol)noclog          5354/udp                        # noclogd with UDP (nocol)hostmon         5355/tcp                        # hostmon uses TCP (nocol)hostmon         5355/udp                        # hostmon uses UDP (nocol)rplay           5555/udp                        # RPlay audio servicenrpe            5666/tcp                        # Nagios Remote Plugin Executornsca            5667/tcp                        # Nagios Agent - NSCAmrtd            5674/tcp                        # MRT Routing Daemonbgpsim          5675/tcp                        # MRT Routing Simulatorcanna           5680/tcp                        # cannaserversyslog-tls      6514/tcp                        # Syslog over TLS [RFC5425]sane-port       6566/tcp        sane saned      # SANE network scanner daemonircd            6667/tcp                        # Internet Relay Chatzope-ftp        8021/tcp                        # zope management by ftptproxy          8081/tcp                        # Transparent Proxyomniorb         8088/tcp                        # OmniORBomniorb         8088/udpclc-build-daemon 8990/tcp                       # Common lisp build daemonxinetd          9098/tcpmandelspawn     9359/udp        mandelbrot      # network mandelbrotgit             9418/tcp                        # Git Version Control Systemgit             9418/udp                        # Git Version Control Systemzope            9673/tcp                        # zope serverwebmin          10000/tcpkamanda         10081/tcp                       # amanda backup services (Kerberos)kamanda         10081/udpamandaidx       10082/tcp                       # amanda backup servicesamidxtape       10083/tcp                       # amanda backup servicessmsqp           11201/tcp                       # Alamin SMS gatewaysmsqp           11201/udpxpilot          15345/tcp                       # XPilot Contact Portxpilot          15345/udpsgi-cmsd        17001/udp               # Cluster membership services daemonsgi-crsd        17002/udpsgi-gcd         17003/udp                       # SGI Group membership daemonsgi-cad         17004/tcp                       # Cluster Admin daemonisdnlog         20011/tcp                       # isdn logging systemisdnlog         20011/udpvboxd           20012/tcp                       # voice box systemvboxd           20012/udpbinkp           24554/tcp                       # binkp fidonet protocolasp             27374/tcp                       # Address Search Protocolasp             27374/udpcsync2          30865/tcp                       # cluster synchronization tooldircproxy       57000/tcp                       # Detachable IRC Proxytfido           60177/tcp                       # fidonet EMSI over telnetfido            60179/tcp                       # fidonet EMSI over TCP # Local services # Synology serviceDSM-http                5000/tcp                        # Synology DSMDSM-https               5001/tcp                        # Synology DSM for httpsfindhostd       9997/udp                        # Synology findhostdfindhostd       9998/udp                        # Synology findhostdfindhostd       9999/udp                        # Synology findhostdimage-backup    6281/tcp                                                # Synology image backup # DSM Build-in servicessdp            1900/tcp                                            # SSDPssdp                    1900/udp                                                # SSDPash-4.3# Sendt fra Mail til Windows 10 Fra: tsightlerSendt: 5. januar 2021 15:13Til: TheAgentK/tuya-mqttCc: Erik Palsbo; AuthorEmne: Re: [TheAgentK/tuya-mqtt] Problem installing on Synology RS914 (#62) 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 it on a different device, my first guess might be that you didn't stop it there before starting it on this device. Most Tuya devices only support a single concurrent local connection so, if another instance of the script (or the Tuya app for example) is already connected locally 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.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
tsightler commented 3 years ago

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.

palsbo commented 3 years ago
Sorry for all the mails. 😊Looked for the PID using the 6667 like this: ash-4.3# netstat -nlp | grep 6667udp6       0      0 :::6667                 :::*                                9037/java Decided to kill the thing without knowing the impact!! ash-4.3# kill 9037 Now tuya-mqtt  connects! ash-4.3# DEBUG=tuya-mqtt:* node tuya-mqtt.js  tuya-mqtt:info Connection established to MQTT server +0ms  tuya-mqtt:tuyapi Search for device id 73000250c44f339338aa +0ms  tuya-mqtt:tuyapi Search for device id bf5959607ad139b09cqivc +17ms  tuya-mqtt:tuyapi Search for device id 80378704500291704621 +2ms  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +2ms  tuya-mqtt:tuyapi Search for device id 38341275c82b9648acb0 +1ms  tuya-mqtt:tuyapi Found device id 80378704500291704621 +1s  tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +125ms  tuya-mqtt:tuyapi Found device id 73000250c44f339338aa +454ms  tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":true,"3":92} +160ms  tuya-mqtt:tuyapi Connected to device Spisebord (80378704500291704621, 576ed7ce67b2f203) +366ms  tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +33ms  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 +1ms  tuya-mqtt:tuyapi Connected to device Paere (73000250c44f339338aa, c5b322f007e1823c) +575ms  tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":true,"3":92} +38ms  tuya-mqtt:state MQTT DPS JSON: tuya/paere/dps/state ->  {"1":true,"3":92} +610ms  tuya-mqtt:state MQTT DPS1: tuya/paere/dps/1/state ->  true +2ms  tuya-mqtt:state MQTT DPS3: tuya/paere/dps/3/state ->  92 +0ms  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +2s  tuya-mqtt:tuyapi Received JSON data from device 8037870450029170f251 -> {"1":true,"2":255} +122ms  tuya-mqtt:tuyapi Connected to device Bordlampe (8037870450029170f251, b1971c7323052c78) +987ms  tuya-mqtt:tuyapi Received JSON data from device 8037870450029170f251 -> {"1":true,"2":255} +117ms  tuya-mqtt:state MQTT DPS JSON: tuya/bordlampe/dps/state ->  {"1":true,"2":255} +3s  tuya-mqtt:state MQTT DPS1: tuya/bordlampe/dps/1/state ->  true +1ms  tuya-mqtt:state MQTT DPS2: tuya/bordlampe/dps/2/state ->  255 +1ms  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? +2ms  tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms^C  tuya-mqtt:info Exit code: SIGINT +13s  tuya-mqtt:tuyapi Disconnected from device Bordlampe (8037870450029170f251, b1971c7323052c78) +6s  tuya-mqtt:tuyapi Disconnected from device Spisebord (80378704500291704621, 576ed7ce67b2f203) +1ms  tuya-mqtt:tuyapi Disconnected from device Paere (73000250c44f339338aa, c5b322f007e1823c) +1ms  tuya-mqtt:info Exit code: 0 +1sash-4.3# I will investigate further into Synology. So far – thank you very much for your help. Best regardsErik  Sendt fra Mail til Windows 10 Fra: tsightlerSendt: 5. januar 2021 17:04Til: TheAgentK/tuya-mqttCc: Erik Palsbo; AuthorEmne: Re: [TheAgentK/tuya-mqtt] Problem installing on Synology RS914 (#62) 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.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
tsightler commented 3 years ago

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.

palsbo commented 3 years ago
I found out, that I killed OpenHAB – not good. Is it possible to config tuya-mqtt to not using UDP 6667? I am on thin ice here.RegardsErik Sendt fra Mail til Windows 10 Fra: tsightlerSendt: 5. januar 2021 17:16Til: TheAgentK/tuya-mqttCc: Erik Palsbo; AuthorEmne: Re: [TheAgentK/tuya-mqtt] Problem installing on Synology RS914 (#62) 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.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
tsightler commented 3 years ago

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.

Flip76 commented 3 years ago

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?

palsbo commented 3 years ago
Tanks – I got the point now.Thanks a lot  Sendt fra Mail til Windows 10 Fra: tsightlerSendt: 5. januar 2021 17:33Til: TheAgentK/tuya-mqttCc: Erik Palsbo; AuthorEmne: Re: [TheAgentK/tuya-mqtt] Problem installing on Synology RS914 (#62) It's not possible for tuya-mqtt to use a port other than UDP 6667 for discover because that's the port that the Tuya devices broadcast their discovery packets to for protocol 3.3 devices. Attempting to listen on another port would just mean those discovery packets would never be received.However, as I noted above, you can manually specific the IP, key, and protocol version for the device in the config file and then discovery does 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.I have no idea why OpenHAB would be using port 6667 though as that's not typical, IMO.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
palsbo commented 3 years ago

I use 8080. It must be something internaly in OH. Erik

tir. 5. jan. 2021 kl. 17.52 skrev Flip notifications@github.com:

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?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TheAgentK/tuya-mqtt/issues/62#issuecomment-754758428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYJU4YSAIOVDPAAVEGZXJTSYM7ULANCNFSM4VUQNM3A .

--

http://www.e-julemaerket.dk/?b43be142-3678-476b-ba11-dded21173369

tsightler commented 3 years ago

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.

palsbo commented 3 years ago
I checked with my installation on Raspberry Pi. I see the same problem with discovery not working, but when I boot the device, tuya-mqtt will start first, which cause the first Discovery to Work. When OpenHAB later starts, discovery stops working, but at that point, tuya-mqtt allready have got the IP of the devices.I think the solution is:To configure the IP as you suggestedDisable discovery in tuya-mqttI have not been successful reading the documentation. I can not see exactly how to configure.I tried to put the IP into the devices.conf file like this: [  {    name: 'Switch1',    id: '487668362cf432362176',    key: 'c503e1067353de66',   ip: ‘192.168.1.200’  },.....] But it did not work.I also tried to access using the topic like this:tuya/487668362cf432362176/c503e1067353de66/192.168.1.200/command but this also failed.Is there any other documentation I missed? Also. Is it possible to disable discovery (if the configuration gets to work)? Best regards Erik  Fra: tsightlerSendt: 5. januar 2021 21:06Til: TheAgentK/tuya-mqttCc: Erik Palsbo; AuthorEmne: Re: [TheAgentK/tuya-mqtt] Problem installing on Synology RS914 (#62) 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.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
Flip76 commented 3 years ago

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: )

tsightler commented 3 years ago

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.

palsbo commented 3 years ago
Thanks Again for your help. I am trying to change the devices.conf as 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: 'TuyaDevice'  },  {    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'  }] (the device ’Bordlampe’ is also a ’SimpleDimmer’ – I tried both.)    But I have major instability. I managed to se a connecten a few times, but mostly I get this result When starting tuya-mqtt:This is on the Raspberry pi without OpenHAB running – unly MQTT-broker is running.  [14:30:10] 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. (/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) +123ms  tuya-mqtt:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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. (/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:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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 Paere (192.168.1.235, 73000250c44f339338aa, c5b322f007e1823c) +6ms  tuya-mqtt:tuyapi Disconnected from device Spisebord (192.168.1.231, 80378704500291704621, 576ed7ce67b2f203) +1ms  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +1ms  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 80378704500291704621...retry in 10 seconds. +1ms  tuya-mqtt:error Error connecting to device id 73000250c44f339338aa...retry in 10 seconds. +1ms  tuya-mqtt:tuyapi Search for device id 487668362cf432362176 +11s  tuya-mqtt:tuyapi Found device id 487668362cf432362176 +0ms  tuya-mqtt:tuyapi Search for device id 8037870450029170f251 +2ms  tuya-mqtt:tuyapi Found device id 8037870450029170f251 +0ms  tuya-mqtt:tuyapi Search for device id 80378704500291704621 +2ms  tuya-mqtt:tuyapi Found device id 80378704500291704621 +0ms  tuya-mqtt:tuyapi Search for device id 73000250c44f339338aa +1ms  tuya-mqtt:tuyapi Found device id 73000250c44f339338aa +1ms  tuya-mqtt:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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 Switch1 (192.168.1.228, 487668362cf432362176, c503e1067353de66) +38ms  tuya-mqtt:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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. (/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) +5ms  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +2ms  tuya-mqtt:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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) +7ms  tuya-mqtt:tuyapi Disconnected from device Paere (192.168.1.235, 73000250c44f339338aa, c5b322f007e1823c) +4ms  tuya-mqtt:error Error connecting to device id 487668362cf432362176...retry in 10 seconds. +990ms  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +3ms  tuya-mqtt:error Error connecting to device id 80378704500291704621...retry in 10 seconds. +1ms  tuya-mqtt:error Error connecting to device id 73000250c44f339338aa...retry in 10 seconds. +7ms^C   Sendt fra Mail til Windows 10 Fra: tsightlerSendt: 6. januar 2021 14:17Til: TheAgentK/tuya-mqttCc: Erik Palsbo; AuthorEmne: Re: [TheAgentK/tuya-mqtt] Problem installing on Synology RS914 (#62) 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.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
palsbo commented 3 years ago
In this run, 3 out of 4 devices are found first time.  The device id=8037870450029170f251 are not found, and after this, alle devices fail.  ./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. (/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 Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +39ms  tuya-mqtt:tuyapi Received JSON data from device 487668362cf432362176 -> {"1":true,"2":0} +8ms  tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +1ms  tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":false,"3":92} +21ms  tuya-mqtt:tuyapi Connected to device Switch1 (192.168.1.228, 487668362cf432362176, c503e1067353de66) +948ms  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) +19ms  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 } +0ms  tuya-mqtt:tuyapi Connected to device Paere (192.168.1.235, 73000250c44f339338aa, c5b322f007e1823c) +8ms  tuya-mqtt:discovery Home Assistant config topic: homeassistant/light/73000250c44f339338aa/config +6ms  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 } +1ms  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s  tuya-mqtt:tuyapi Received JSON data from device 487668362cf432362176 -> {"1":true,"2":0} +1s  tuya-mqtt:state tuya/switch1/state ON +0ms  tuya-mqtt:state MQTT DPS JSON: tuya/switch1/dps/state ->  {"1":true,"2":0} +2ms  tuya-mqtt:state MQTT DPS1: tuya/switch1/dps/1/state ->  true +0ms  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} +13ms  tuya-mqtt:tuyapi Received JSON data from device 73000250c44f339338aa -> {"1":false,"3":92} +6ms  tuya-mqtt:tuyapi Received JSON data from device 80378704500291704621 -> {"1":true,"2":106} +18ms  tuya-mqtt:state tuya/spisebord/state ON +33ms  tuya-mqtt:state tuya/spisebord/brightness_state 35 +22ms  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 +1ms  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} +30ms  tuya-mqtt:error Could not get value for device DPS key 2 +1s  tuya-mqtt:state tuya/paere/state OFF +5ms  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 +1ms  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 +1ms  tuya-mqtt:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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) +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 +1ms  tuya-mqtt:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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. (/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) +13s  tuya-mqtt:tuyapi Disconnected from device Bordlampe (192.168.1.200, 8037870450029170f251, b1971c7323052c78) +3s  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. (/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) +43ms  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. (/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) +38ms  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. (/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 +1ms  tuya-mqtt:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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 +1ms  tuya-mqtt:error Error: Error from socket  tuya-mqtt:error     at Socket. (/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. (/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) +45ms  tuya-mqtt:error Error connecting to device id 8037870450029170f251...retry in 10 seconds. +1s^C Sendt fra Mail til Windows 10 Fra: tsightlerSendt: 6. januar 2021 14:17Til: TheAgentK/tuya-mqttCc: Erik Palsbo; AuthorEmne: Re: [TheAgentK/tuya-mqtt] Problem installing on Synology RS914 (#62) 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.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
Flip76 commented 3 years ago

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: https://github.com/TheAgentK/tuya-mqtt/issues/62 )

Flip76 commented 3 years ago

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

palsbo commented 3 years ago

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`
Flip76 commented 3 years ago

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?

palsbo commented 3 years ago

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' } ]

`

Flip76 commented 3 years ago

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)?

tsightler commented 3 years ago

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.

palsbo commented 3 years ago

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

palsbo commented 3 years ago

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)

tsightler commented 3 years ago

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.

palsbo commented 3 years ago

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

`

palsbo commented 3 years ago

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

Flip76 commented 3 years ago

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

palsbo commented 3 years ago

no - it is still the same :)

tsightler commented 3 years ago

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.