Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reach device #446

Closed
HaydenRichardson opened this issue Mar 29, 2021 · 9 comments
Closed

Can't reach device #446

HaydenRichardson opened this issue Mar 29, 2021 · 9 comments
Labels

Comments

@HaydenRichardson
Copy link

Hello i need help with something.When i try to run this it gives me an error connection time out.Also when i try to ping the lights ip it doesn't respond.The reason i am trying to fix this is because i am trying to make a command for my discord bot that changes the color of the light.

@kueblc
Copy link
Collaborator

kueblc commented Mar 29, 2021

You'll get more meaningful support if you include details about your problem and follow the template given when opening an issue. Please include a code sample, debug logs, something we can use to understand what the issue is.

@HaydenRichardson
Copy link
Author

const TuyAPI = require('tuyapi');

const device = new TuyAPI({
id: '0500532284f3ebfd5ef1',
key: '',
ip: '',
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);

@HaydenRichardson
Copy link
Author

When i do node ./tuya.js (the files name) it says error connection timeout i have looked around at other issues and they all say to try to ping it and when I do it doesnt respond.

@codetheweb
Copy link
Owner

If it doesn't respond to pings it almost certainly won't work with TuyAPI. Your network is probably misconfigured somewhere.

Are both the device and your computer on the same subnet with no firewall between them?

@codetheweb codetheweb changed the title Error time out Can't reach device Mar 29, 2021
@HaydenRichardson
Copy link
Author

@codetheweb im running it from a vps

@codetheweb
Copy link
Owner

That won't work, both devices need to be on the same local network. If you need to use a VPS for your application, you may want to try controlling your devices through the cloud API.

@HaydenRichardson
Copy link
Author

@codetheweb what is the difference between the cloud api and what i was trying to use.

@HaydenRichardson
Copy link
Author

Also what do i use for the username and password.

@codetheweb
Copy link
Owner

TuyaAPI/openapi#9.

Repository owner locked and limited conversation to collaborators Mar 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants