igdr / node-red-contrib-xiaomi-smart-devices

8 stars 4 forks source link

How to send commands to the gateway? #3

Closed GoSpursGoNL closed 5 years ago

GoSpursGoNL commented 5 years ago

Thanks for this module. I can't figure out though how to send commands to the gateway (play/stop ringtone, control the LED). Could you please explain?

igdr commented 5 years ago

Hi, it is pretty easy, for example, play sound:

image

let cmd = {
  "cmd": "write",
  "sid": "34ce008c1100",
  "model": "gateway",
  "data": {"mid": 1, "vol": 100}
}
msg.payload = cmd;
return msg;

Here is the translated documentation https://translate.google.com/translate?sl=zh-CN&tl=en&js=y&prev=_t&hl=it&ie=UTF-8&u=https%3A%2F%2Flouiszl.gitbooks.io%2Flumi-gateway-local-api%2Fcontent%2Fdevice_read_write.html&edit-text=