YinHangCode / homebridge-mi-aqara

a homebridge plugin for XiaoMi Aqara plugin.
1.08k stars 154 forks source link

Generate a list of SID -> Service names #132

Open tengelmeier opened 6 years ago

tengelmeier commented 6 years ago

Hi,

I found it very hard to apply human readable sensors names as for each sensor you have to:

I tried to implement a function to print out the sid to name mapping like

      "12356583246928359": {
                "ContactSensor_ContactSensor": {
                           "name": "ContactSensor_1234"
               }"
        }

so I just have to change the values in the JSON for name However it looks Accessories and Devices are not associated at all? Is there any code to look up an Accessory by sid + gatewayId?

UPDATE:

I found that in index.js, line 253 should read:

       that.DeviceUtil.update(gatewaySid, {model: result['model']});

and line 287:

       that.DeviceUtil.update(deviceSid, {model: result['model']});

Then the device list contains also model information so it is possible to traverse the code.

YinHangCode commented 6 years ago

it's need to locate an accessory through sid and type. and it's really inconvenient getting this information at the moment. so the later version, I also wanted to provide similar functions, or the function of information conversion through the Mijia(MiHome) app.

tengelmeier commented 6 years ago

With the pull request https://github.com/YinHangCode/homebridge-mi-aqara/pull/134 it is at least easier to generate the config.json