We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, when i call the function "hasCapability“, i'm getting the following error. if(this.handle.hasCapability('power')) { ^
TypeError: this.handle.hasCapability is not a function
i think it is because it doesn't initialized successfully, but i don't know why, their is no other log i can check, could you help? thanks.
The text was updated successfully, but these errors were encountered:
How do you create and assign the value to this.handle?
this.handle
Sorry, something went wrong.
this.handle = miio.device({ address: ip, token: token }) .then(console.log(name + ' create')) .catch(console.error(name + ' failed'));
i'm using device function.
miio.device() returns a promise that asynchronously resolves the device, so this.handle will still be pointing to that promise in the code you posted.
miio.device()
You probably want something like this instead:
miio.device({ address: ip, token: token }) .then(device => this.handle = device) .catch(handleErrorConnectingToDevice);
No branches or pull requests
Hi, when i call the function "hasCapability“, i'm getting the following error.
if(this.handle.hasCapability('power')) {
^
TypeError: this.handle.hasCapability is not a function
i think it is because it doesn't initialized successfully, but i don't know why, their is no other log i can check, could you help? thanks.
The text was updated successfully, but these errors were encountered: