Open lug-gh opened 5 years ago
Hi,
handleErrorHere
is a function that you must implement.
If you don't want to implement extra logic, just do a console.log in the catch like this:
const miio = require('miio');
miio.device({ address: '192.168.99.154' })
.then(device => console.log('Connected to', device))
.catch(err => console.log(err));
Well, I feel a little dumb right now :)
But with that, I get a timeout.
miIO:~# node test.js
{ Error: Could not connect to device, handshake timeout
at Timeout.handshakeTimeout.setTimeout [as _onTimeout] (/root/node_modules/miio/lib/network.js:432:17)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5) code: 'timeout', device: null }
ping works just fine
miIO:~# ping 192.168.99.154
PING 192.168.99.154 (192.168.99.154): 56 data bytes
64 bytes from 192.168.99.154: seq=0 ttl=252 time=20.202 ms
64 bytes from 192.168.99.154: seq=1 ttl=252 time=25.884 ms
64 bytes from 192.168.99.154: seq=2 ttl=252 time=22.384 ms
64 bytes from 192.168.99.154: seq=3 ttl=252 time=20.442 ms
Getting handshake timeout, too. My devices are also in aother subnet.
Hi, i've installed miio and first got this output when doing so:
Then I ran test.js to check if basic connection works:
it failed with this output
I am running alpine linux 3.7 and my iot devices are running in a different subnet than my miio vm, is that a problem?