npm install --save lumi-aqara
See example.js.
http://docs.opencloud.aqara.cn/en/development/gateway-LAN-communication/
GPL-3.0
Copryright (c) Marvin ROGER
Control your Xiaomi Smart Home devices with this Lumi Aqara library
License: GNU General Public License v3.0
npm install --save lumi-aqara
See example.js.
http://docs.opencloud.aqara.cn/en/development/gateway-LAN-communication/
GPL-3.0
Copryright (c) Marvin ROGER
What's the difference between your lib and this one?
https://github.com/aholstenson/miio
I am not sure whether it is firmware update of software update, but my setup has stopped working.
Running 1.4.0 Xiaomi2MQTT based on Lumi-Aqara. Error messages get logged:
not handled: {"cmd":"report","model":"gateway","sid":"34ce0091f88b","short_id":0,"data":"{"rgb":0,"illumination":529}"}
not handled: {"cmd":"report","model":"gateway","sid":"34ce0091f88b","short_id":0,"data":"{"rgb":0,"illumination":514}"}
not handled: {"cmd":"report","model":"sensor_ht","sid":"158d0001ddb366","short_id":34090,"data":"{"temperature":"1885"}"}
not handled: {"cmd":"report","model":"sensor_ht","sid":"158d0001ddb366","short_id":34090,"data":"{"humidity":"6595"}"}
not handled: {"cmd":"report","model":"sensor_switch.aq2","sid":"158d0001b76901","short_id":10905,"data":"{"status":"click"}"}
not handled: {"cmd":"report","model":"sensor_switch.aq2","sid":"158d0001b76901","short_id":10905,"data":"{"status":"click"}"}
not handled: {"cmd":"report","model":"sensor_ht","sid":"158d0001ddb366","short_id":34090,"data":"{"temperature":"1893"}"}
not handled: {"cmd":"report","model":"sensor_ht","sid":"158d0001ddb366","short_id":34090,"data":"{"humidity":"6602"}"}
It seems whether gateway no longer responds to whois commands, or it stopped sending heartbeat notifications.
I sometimes get a weird battery percentage like 56.99999999999999%
, maybe this line should be:
return Math.round(((SUBDEVICE_MAX_VOLT - this._voltage) / (SUBDEVICE_MAX_VOLT - SUBDEVICE_MIN_VOLT)) * 100)
I unfortunately don't own them, but extending this library with other subdevices is pretty straightforward!
I don't know why but I have some sensors temperature (not all, but all are the same model) that are not handled... Same thing for smoke sensor.
not handled: {"cmd":"report","model":"weather.v1","sid":"158d000277250e","short_id":46105,"data":"{\"humidity\":\"7047\"}"}
not handled: {"cmd":"report","model":"weather.v1","sid":"158d000277250e","short_id":46105,"data":"{\"pressure\":\"99640\"}"}
not handled: {"cmd":"report","model":"weather.v1","sid":"158d000277250e","short_id":46105,"data":"{\"temperature\":\"344\"}"}
not handled: {"cmd":"report","model":"weather.v1","sid":"158d000277250e","short_id":46105,"data":"{\"humidity\":\"7056\"}"}
not handled: {"cmd":"report","model":"weather.v1","sid":"158d000277250e","short_id":46105,"data":"{\"pressure\":\"99640\"}"}
not handled: {"cmd":"report","model":"smoke","sid":"158d00028e1e0a","short_id":21845,"data":"{\"density\":\"0\"}"}
not handled: {"cmd":"heartbeat","model":"smoke","sid":"158d00028e1e0a","short_id":21845,"data":"{\"voltage\":3155,\"alarm\":\"0\"}"}```
Any idea ?
I've cloned this repo and run the example.js (replaced with my own gateway's key).
So, the gateway, sensors and switches are discovered, gateway light changed, but i got no heartbeat or report messages. I tried to trigger devices to emit events, but still got nothing.
Is it only me having this problem?
Error when interacting with the gateway (color and sound)
gateway.setColor({ r: 255, g: 0, b: 0 })
gateway.setIntensity(100)
gateway.setSound(11,50)
Return :
not handled: {"cmd":"write_ack","sid":"34ce0089260c","data":"{"error":"Invalid key"}"}
Hi there :)
First thanks for the lib, working well, I manage to catch my xiaomi switch click in under a minute of setup, great !
But I have this error after :
Gateway discovered
Light updated: {"color":{"r":0,"g":0,"b":0},"intensity":0}
Gateway is ready
not handled: {"cmd":"read_ack","model":"sensor_ht","sid":"15xxxxxea6","short_id":24660,"data":"{\"voltage\":3005,\"temperature\":\"2447\",\"humidity\":\"490
4\"}"}
New device
Battery: 55.00000000000001%
Type: magnet
SID: 158xxxxxeef
Magnet (close)
New device
Battery: 53.6%
Type: switch
SID: 15xxxxxd0
Switch
not handled: {"cmd":"read_ack","model":"motion","sid":"15xxxxx06","short_id":61156,"data":"{\"voltage\":3045,\"status\":\"motion\"}"}
not handled: {"cmd":"read_ack","model":"plug","sid":"15xxxxxc8","short_id": 26348,"data":"{\"voltage\":3600,\"status\":\"unknown\",\"inuse\":\"0\"}"}
C:\mi-tests\node_modules\lumi-aqara\src\lib\gateway.js:89
else this._subdevices.get(msg.sid)._handleState(state)
^
TypeError: Cannot read property '_handleState' of undefined
at Gateway._handleMessage (C:\mi-tests\node_modules\lumi-aqara\src\lib\gateway.js:89:43)
at LumiDiscoverer._handleMessage (C:\mi-tests\node_modules\lumi-aqara\src\index.js:68:27)
at emitTwo (events.js:106:13)
at Socket.emit (events.js:191:7)
at UDP.onMessage (dgram.js:550:8)
any idea ?
I've read the source code of your module, many articles about MQTT topic naming, a virtual scenario of a garage application, getting data from a sensor using MQTT, etc.
Now I am able to receive the states and updates from Xiaomi sensors with MQTT using (node-xiaomi2mqtt module which is built based on your module).
My question is: Is it possible to set the state of a sensor (e.g. I want to turn on a light from my nodeJs web application by publishing MQTT message to that light) using MQTT?
This question is somehow asked in this issue last year.
Is sending commands to Xiaomi sensors possible ? If yes, how ? (Could you provide me with references, links to articles, examples, etc)
Would it also be possible to control the alarm status?
The gateway has some nice alarm feature, that makes a hell off a sound if it is armed
and a door/window is opened.
But the application to turn it on and off kinda sucks, so I would like to control the armed status some other way.
Just a little question to know how manage gateway password with multiple gateways.
Is it possible ? Do you have thinking about this ?
Hello,
I'm trying to make your code work with a Aqara HUB M2, but 'this._serverSocket.on('message', this._handleMessage.bind(this))' is never triggered when trying to auto discover Hub M2.
Any chance to get this code compatible with Aqara HUB M2 ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.