marvinroger / node-lumi-aqara

Control your Xiaomi Smart Home devices with this Lumi Aqara library
GNU General Public License v3.0
46 stars 27 forks source link

Set sensors' state by sending commands to them using MQTT #30

Open ghasemikasra39 opened 5 years ago

ghasemikasra39 commented 5 years ago

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)

curry684 commented 5 years ago

This is not possible in the "driver" as the hardware does not support it, nor should it. Faking this data should be a part of the application test suite, you could easily do this using mosquitto_pub in your case as you are using an MQTT bridge.