Coder Social home page Coder Social logo

marvinroger / node-lumi-aqara Goto Github PK

View Code? Open in Web Editor NEW
46.0 7.0 27.0 194 KB

Control your Xiaomi Smart Home devices with this Lumi Aqara library

License: GNU General Public License v3.0

JavaScript 100.00%
aqara gateway home iot smart xiaomi

node-lumi-aqara's Introduction

node-lumi-aqara's People

Contributors

curry684 avatar dependabot[bot] avatar dsbaars avatar hamtar0 avatar hobbyquaker avatar martenwibom avatar marvinroger avatar raidok avatar svrooij avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-lumi-aqara's Issues

Not receiving "report" messages

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?

Multiple gateways

Just a little question to know how manage gateway password with multiple gateways.
Is it possible ? Do you have thinking about this ?

Round battery percentage?

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)

Sensors not handled

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 ?

Control alarm status?

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.

Cannot read property '_handleState' of undefined

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 ?

Set sensors' state by sending commands to them using MQTT

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)

Aqara Hub M2 compatbility

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 ?

Stopped working

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.

write_ack

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"}"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.