tuyapi
tuyapi copied to clipboard
Tuyapi timeouts after finding device
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);`
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?
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=*
).