derek-miller / homebridge-unifi-smartpower

Homebridge UniFi SmartPower Plugin
Apache License 2.0
7 stars 1 forks source link

homebridge-unifi-smartpower

NPM Version verified-by-homebridge

UniFi SmartPower Homebridge Platform Plugin

UniFi SmartPower plugin for Homebridge.

Models Supported

Configuration

Required Configuration

{
  "platforms": [
    {
      "platform": "UniFiSmartPower",
      "name": "UniFi SmartPower",
      "host": "192.168.1.1", // Controller or CloudKey IP address
      "port": 443, // and port
      "username": "admin", // See note below about account credentials
      "password": "ubnt"
    }
  ]
}

Account Credentials

You can use your Ubiquiti account credentials, though 2FA is supported. However, it is strongly recommend to create a local user with Admin privileges just for this plugin. See this Ubiquity Help Article for creating new users.

Optional Configuration

Control Switch

Considering how easy it is to accidentally command an outlet/switch from HomeKit you can optionally add a switch to enable/disable control. When disabled, commands to control an outlet/switch will be ignored:

{
  "platforms": [
    {
      // ... required config, see above
      "controlSwitch": {
        "create": <true/false>,           // Defaults to false.
        "name": "<name>",                 // Defaults to "UniFi Control Enabled".
        "timeout": <number>,              // Timeout (in seconds) before the control switch reverts. Defaults to 60s. 0 disables the timeout.
        "guardOutlets": <true/false>,     // If true, outlets will be guarded by this control switch. Defaults to true.
        "guardSwitchPorts": <true/false>, // If true, switch ports will be guarded by this control switch. Defaults to true.
        "guardRpsPorts": <true/false>     // If true, RPS ports will be guarded by this control switch. Defaults to true.
      }
    }
  ]
}

Include/Exclude

Sites, devices, outlets, and/or ports can be included or excluded by their id (see logs during startup):

{
  "platforms": [
    {
      // ... required config, see above
      "includeSites": ["<site id>"],
      "excludeSites": ["<site id>"],
      "includeDevices": ["<serial number>"],
      "excludeDevices": ["<serial number>"],
      "includeOutlets": ["<serial number>.<index>"],
      "excludeOutlets": ["<serial number>.<index>"],
      "includeInactivePorts": <true/false>,          // Defaults to false
      "includePorts": ["<serial number>.<index>"],
      "excludePorts": ["<serial number>.<index>"],
      "includeInactiveRpsPorts": <true/false>,       // Defaults to false
      "includeRpsPorts": ["<serial number>.<index>"],
      "excludeRpsPorts": ["<serial number>.<index>"]
    }
  ]
}

NOTE: When includeInactivePorts is set to true all PoE capable ports will be added regardless if the switch is supplying power to a connected device or not. This is not recommended since the plugin will refresh and automatically add new ports when they become connected. Leaving this set to false will reduce clutter in the Home app by removing switches that do not control anything.

Advanced Configuration

These config values should not be configured under normal situations, but are exposed nonetheless. Min, max, and default values are enforced to keep the plugin usable.

Refresh Devices Poll Interval

The polling interval (in seconds) to query the API for devices changes:

{
  "platforms": [
    {
      // ... required config, see above
      "refreshDevicesPollInterval": <seconds>, // Defaults to 600
    }
  ]
}

Status Cache TTL

The time to live (in seconds) for a cached status to avoid excessive API calls:


{
  "platforms": [
    {
      // ... required config, see above
      "outletStatusCacheTtl": <seconds>, // Defaults to 15
    }
  ]
}

Status Poll Interval

The polling interval (in seconds) to query the API for status changes:


{
  "platforms": [
    {
      // ... required config, see above
      "outletStatusPollInterval": <seconds>, // Defaults to 15
    }
  ]
}