sibartlett / homebridge-wink3

Homebridge plugin for wink.com
https://sibartlett.github.io/homebridge-wink3
ISC License
54 stars 20 forks source link

Support for manually specified accessory information? #67

Closed schmittx closed 3 years ago

schmittx commented 7 years ago

I've got a lot of devices connected through Wink and to better organize them (it's admittedly a bit neurotic), I'm wondering if support for manually-specified accessory information (firmware, manufacturer, model, and serial number) can be added?

My image would be to specify in the Homebridge config (see mockup below) or some other external file.

    {
      "platform": "Wink",
      "name": "Wink",
      "client_id": "<REDACTED>",
      "client_secret": "<REDACTED>",
      "accessory_info": [
        {"3044396": {
          "firmware_revision": "1.2.3",
          "manufacturer": "Acme",
          "model": "ABC123",
          "serial_number": "123456789"
          }
        }
      ]

I've tried the following in AccessoryHelper.js but no luck. I think I'm not defining/referencing the JSON correctly. Can anyone help?

    var accessory_firmware = this.config.accessory_info.String(device.object_id).firmware_revision || require("../package.json").version;
    var accessory_manufacturer = this.config.accessory_info.String(device.object_id).manufacturer || toTitleCase(device.device_manufacturer.replace(/_/g, " "));
    var accessory_model = this.config.accessory_info.String(device.object_id).model || model;
    var accessory_serial = this.config.accessory_info.String(device.object_id).serial_number || device.object_id;

    accessory
      .getService(Service.AccessoryInformation)
      .setCharacteristic(Characteristic.FirmwareRevision, accessory_firmware)
      .setCharacteristic(Characteristic.Manufacturer, accessory_manufacturer)
      .setCharacteristic(Characteristic.Model, accessory_model)
      .setCharacteristic(Characteristic.SerialNumber, accessory_serial);