{
  "name": "homebridge-shelly-consumption",
  "pluginAlias": "ShellyConsumption",
  "pluginType": "platform",
  "singular": true,
  "schema": {
    "type": "object",
    "properties": {
      "user": {
        "title": "Shelly user",
        "type": "string",
        "required": false
      },
      "password": {
        "title": "Shelly password",
        "type": "string",
        "required": false
      },

      "devices": {
        "title": "Shelly devices",
        "type": "array",
        "items": {
          "title": "Shelly device",
          "type": "object",
          "properties": {

            "name": {
              "title": "Name (appearing in Homekit)",
              "type": "string",
              "placeholder": "Bsp. 3EM-Ch1"
            },
            "ipAddress": {
              "title": "IP-address",
              "type": "string",
              "required": true,
              "placeholder": "Bsp. 192.168.1.X",
              "format": "ipv4"
            },
            "deviceType": {
              "title": "Device type",
              "type": "string",
              "default": "shellyem",
              "oneOf": [
                { "title": "Shelly EM", "enum": ["ShellyEM"] },
                { "title": "Shelly 3EM", "enum": ["Shelly3EM"] }
              ],
              "required": true
            },

            "emeterChannel1": {
              "title": "emeter channel 1",
              "type": "boolean"
            },
            "emeterChannel2": {
              "title": "emeter channel 2",
              "type": "boolean"
            },
            "emeterChannel3": {
              "title": "emeter channel 3",
              "type": "boolean",
              "condition": {
                "functionBody": "return model.devices[arrayIndices].deviceType === 'Shelly3EM';"
              }
            }
          }
        }
      }
    }
  }
}