npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

aqara2mqtt

1.2.0 • Public • Published

aqara2mqtt

mqtt-smarthome NPM version dependencies Status Build Status XO code style License

Attach Aqara Smart Hubs to MQTT

Install

$ sudo npm install -g aqara2mqtt

See Domoticz Wiki on how to enable local network access to the Gateway.

Usage

Usage: aqara2mqtt [options]

Options:
  -v, --verbosity  possible values: "error", "warn", "info", "debug"
                                                               [default: "info"]
  -n, --name       instance name. used as topic prefix        [default: "aqara"]
  -k, --insecure   allow ssl connections without valid certificate     [boolean]
  -u, --url        mqtt broker url (may contain user/password)
                                                   [default: "mqtt://127.0.0.1"]
  -d, --devices    json file with sid to name mappings
  -h, --help       Show help                                           [boolean]
  --version        Show version number                                 [boolean]

Device file

You can use a json file that defines mappings from sids to names via the --devices option. Example:

{
    "1234567890abcdef": "WindowSensor1",
    "2222222222abcdef": "LeakSensor1",
    "3333333333abcdef": "LeakSensor2",
    "9876543210fedc": {
        "name": "Gateway1",
        "password": "ABCDEF1234567890"
    }
}

If you don't define a gateway password you will still receive status reports, but you will not be able to set the LED or play sounds on the gateway.

Supported Devices

All Switches, all Sensors (Cube, Weather, Vibration, Motion, Leak, Door/Window, Smoke) and the Gateway itself. As of today you can't control plugs, the air condition controller and the curtain actuator.

Topics published by aqara2mqtt

A few examples, not a complete listing, sids anonymised:

aqara/status/MotionKeller/offline {"val":false,"ts":1536254115426}
aqara/status/MotionKeller/motion {"val":true,"ts":1536253676785,"aqara":{"type":"motion","sid":"158d0000000000"}}
aqara/status/MotionKeller/brightness {"val":"21","ts":1536253676785,"aqara":{"type":"motion","sid":"158d0000000000"}}
aqara/status/Gateway/bri {"val":0,"ts":1536253741804,"aqara":{"sid":"7811d0000000","ip":"172.16.23.107"}}
aqara/status/Gateway/color {"val":"#000000","ts":1536253741804,"aqara":{"sid":"7811d0000000","ip":"172.16.23.107"}}
aqara/status/Cube/battery {"val":64,"voltage":2.965,"low":false,"ts":1536252097696,"aqara":{"type":"cube","sid":"158d0000000000"}}
aqara/status/Cube/alert {"val":true,"ts":1536254074965,"aqara":{"type":"cube","sid":"158d0000000000"}}
aqara/status/DoorBad/offline {"val":false,"ts":1536254090481}
aqara/status/DoorBad/magnet {"val":false,"ts":1536254090482,"aqara":{"type":"magnet","sid":"158d0000000000"}}
aqara/status/Cube/rotate {"time":500,"val":36,"ts":1536254398355,"aqara":{"type":"cube","sid":"158d0000000000"}}
aqara/status/Cube/free_fall {"val":true,"ts":1536254403533,"aqara":{"type":"cube","sid":"158d0000000000"}}
aqara/status/Cube/tap_twice {"val":true,"ts":1536254409346,"aqara":{"type":"cube","sid":"158d0000000000"}}
aqara/status/Switch1/offline {"val":false,"ts":1536254412160}
aqara/status/Switch1/battery {"val":99,"voltage":3.095,"low":false,"ts":1536254412161,"aqara":{"type":"switch","sid":"158d0000000000"}}
aqara/status/Switch1/press {"val":true,"ts":1536254412161,"aqara":{"type":"switch","sid":"158d0000000000"}}
aqara/status/Switch1/press_double {"val":true,"ts":1536254415962,"aqara":{"type":"switch","sid":"158d0000000000"}}

Topics subscribed by aqara2mqtt

You can address a gateway by its sid or (if defined in device file) by its name.

  • aqara/set/gateway/bri 0 - 100
  • aqara/set/gateway/color #rrggbb e.g. #0099FF
  • aqara/set/gateway/volume 0 - 100
  • aqara/set/gateway/sound
    • 0 - Police car 1
    • 1 - Police car 2
    • 2 - Accident
    • 3 - Countdown
    • 4 - Ghost
    • 5 - Sniper rifle
    • 6 - Battle
    • 7 - Air raid
    • 8 - Bark
    • 10 - Doorbell
    • 11 - Knock at a door
    • 12 - Amuse
    • 13 - Alarm clock
    • 20 - MiMix
    • 21 - Enthusiastic
    • 22 - GuitarClassic
    • 23 - IceWorldPiano
    • 24 - LeisureTime
    • 25 - ChildHood
    • 26 - MorningStreamLiet
    • 27 - MusicBox
    • 28 - Orange
    • 29 - Thinker

License

MIT © Sebastian Raff

install

npm i aqara2mqtt

Downloadsweekly downloads

0

version

1.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability