itsmepetrov / homebridge-zigbee

ZigBee Platform plugin for HomeBridge
https://itsmepetrov.github.io/homebridge-zigbee/
MIT License
106 stars 36 forks source link

Innr Plug not shown in overview #53

Open vekunz opened 4 years ago

vekunz commented 4 years ago

Hi, I bought an outlet from Innr, the Innr Smart Plug. I connected it to my Homebridge, and in the log output I can see that it connected successfully, and regularly it pings my outlet. But I can neither see the outlet in the web view not in the Home-App. I use the latest Homebridge, latest homebridge-zigbee and Node 10.

vekunz commented 4 years ago

I've now added this code locally to the devices list in .../node_modules/homebridge-zigbee/lib/devices as innr.smart_plug.js (after a bit of reverse engineering)

const HomeKitDevice = require('../HomeKitDevice')

class InnrSmartPlug extends HomeKitDevice {
  static get description() {
    return {
      model: 'SP 120',
      manufacturer: 'innr',
      name: 'Innr Smart Plug',
    }
  }

  getAvailbleServices() {
    return [{
      name: 'Outlet',
      type: 'Outlet',
    }]
  }

  onDeviceReady() {
    this.mountServiceCharacteristic({
      endpoint: 1,
      cluster: 'genOnOff',
      service: 'Outlet',
      characteristic: 'On',
      reportMinInt: 1,
      reportMaxInt: 2,
      reportChange: 1,
      parser: 'onOff',
    })
  }
}

module.exports = InnrSmartPlug

Now the plug is listed in Homebridge. The problem with this code is that it ignores the capability of the plug to measure energy consumption, but I have no idea how to add this to the code.

BobbyT commented 4 years ago

You probably need to add the characteristic for energy consumption. Check your zigbee.db, your device should have endpoints.clusters, one of them should be for that purpose. Also take a look at lib/devices/lumi.ctrl_86plug.js which seems to have support for energy consumption.

vekunz commented 4 years ago

I've noticed a problem. The official npm version 1.3.0 does not support energy consumption. The GitHub Version does, but the maintainer did not release a new version since then.

vekunz commented 4 years ago

I managed to "use" the latest git version. But I saw that homebridge-zigbee doesn't have the right parser. I try to build one, but first I have to understand the technique behind it. Hopefully I manage to create a correct implementation.