Comments (9)
this.device = {"domain":null,"_events":{},"_eventsCount":0,"type":"gateway","model":"lumi.gateway.v3","capabilities":[],"address":"192.168.2.250","port":54321,
from miio.
Devices become available asynchronously for the gateway, you need to listen for the events deviceAvailable
and deviceUnavailable
to keep track of devices being found and removed.
device.on('deviceAvailable', subdevice => doSomethingWithSubdeviceHere)
When deviceAvailable
has triggered the device should be available in devices
but it will not be available directly after connecting to the gateway.
from miio.
i try to set power off of a power-plug by using following code:
that.device.on('deviceAvailable', subDevice => { if (subDevice.type == 'power-plug') { subDevice.setPower(1, false) .then(console.log(subDevice.name + " Power " + subDevice.power())) .catch(console.error(subDevice.name + " Failed to Power Off")); }
i got following error..
`json.sid = options.sid;
^
TypeError: Cannot create property 'sid' on string '{"id":2,"method":"toggle_plug","params":["neutral_1","off"]}'
at Gateway.call (/home/brianping7/work/home-jarvis/plugin/miHome/lib/device.js:173:13)
`
from miio.
Thanks. The sub device code was broken in 0.11.0. Can you try 0.11.1 and see if works for you?
from miio.
above error not exist anymore,but still get some error.
gateway init success power-plug Failed :Error power-plug Failed :Error
am i using the right input?
code:
`that.device.on('deviceAvailable', subDevice => {
if (subDevice.type == 'power-plug') {
subDevice.setPower(1, false)
.then(power => console.log(subDevice.type + " Power " + power))
.catch(err => console.error(subDevice.type + " Failed :" + err));
}
return;
});`
from miio.
i use 0 as channel id to try, failed again
subDevice.setPower(0, false)
from miio.
Hmm, I don't have access to the plug so hard for me to test any fixes.
What type of plug is it? There seems to be both a version that plugs into a socket and one that is an actual socket.
Could you try running setPower
and log either err.message
or err
as its own argument? Something like this:
.catch(err => console.error(subDevice.type + " Failed :", err));
Hopefully one of those will output a more detailed error message that can help with figuring out what has gone wrong.
from miio.
Hi, i use subDevice.setPower("0", false)
, the problem got fixed, thanks.
from miio.
Good! Thank you for your issue reports!
from miio.
Related Issues (20)
- Not enough non-option arguments: got 0, need at least 1 error Command failed with exit code 1.
- Xiaomi Air Monitor cgllc.airm.cgdn1
- yeelight strip plus is supported?
- Canβt find Hub / Temperature-Sensors
- yeelink.light.color5 HOT 1
- Mi Smart LED Bulb (B22) - Support
- yeelink.light.mono6 HOT 1
- [add device request] yeelink.light.ceilb
- [add device request] yeelink.light.colorb
- -Bash: miio: command not found HOT 1
- doesn't work on Firmware version: 3.2.10
- Cannot connect to light after configuring wireless network HOT 1
- yeelink.light.bslamp2 HOT 2
- Create device with lib version >= 0.15.0
- Which devices can get tokens by "miio discover" or "mirobo discover --handshake 1"?
- Does this packge still getting maintained?
- Roborock S6 - 3.5.8._2902 - unsupported device
- colorTemperature2rgbUsingTH is not defined
- Device support [Vacum mop 2 ultra]
- Error connecting to device: Error: Call to device timed out
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miio.