tuyapi icon indicating copy to clipboard operation
tuyapi copied to clipboard

Tuyapi timeouts after finding device

Open Tiqan opened this issue 3 years ago • 2 comments

I am trying to connect to the device and then I always get a Timeout

`const TuyAPI = require('tuyapi');

const device = new TuyAPI({ ip: 'xxx.xxx.xxx.xx', id: 'xxxxxxxxxxxxxxxxxxx', key: 'xxxxxxxxxxxxxxxx', version: '3.3', issueRefreshOnConnect: true});

// Find device on network device.find().then(() => { // Connect to device device.connect(); });

// Add event listeners device.on('connected', () => { console.log('Connected to device!'); });

device.on('disconnected', () => { console.log('Disconnected from device.'); });

device.on('error', error => { console.log('Error!', error); });

device.on('dp-refresh', data => { console.log('DP_REFRESH data from device: ', data); });

device.on('data', data => { console.log('DATA from device: ', data);

});

// Disconnect after 10 seconds setTimeout(() => { device.disconnect(); }, 1000);`

image

Tiqan avatar Nov 26 '21 19:11 Tiqan

I experienced the same thing. I tried it again today after installing the latest HACS update and directly after a restart and adding the device worked this time. Maybe try again after a restart?

nickdos avatar Nov 28 '21 21:11 nickdos

Check if the correct port is open on your target device with telnet [ip] 6668.

Also, try running your script with the debug env var set (DEBUG=*).

codetheweb avatar Nov 29 '21 00:11 codetheweb