{
  "pluginAlias": "Meraki",
  "pluginType": "platform",
  "singular": true,
  "fixArrays": true,
  "strictValidation": true,
  "headerDisplay": "This plugin works with Meraki Devices based on Dashboard API. Devices are exposed to HomeKit as separate accessories and each needs to be manually paired.",
  "footerDisplay": "For documentation please see [GitHub repository](https://github.com/grzegorz914/homebridge-meraki-control).",
  "schema": {
    "type": "object",
    "properties": {
      "devices": {
        "type": "array",
        "items": {
          "type": "object",
          "title": "Network",
          "properties": {
            "name": {
              "title": "Network",
              "type": "string",
              "placeholder": "Network Name",
              "description": "Here set the Name to be displayed in Homebridge/HomeKit for this Accessory.",
              "required": true
            },
            "host": {
              "title": "API Path",
              "type": "string",
              "placeholder": "https://n123.meraki.com",
              "format": "hostname",
              "description": "Here set the Meraki Api Path.",
              "required": true
            },
            "disableAccessory": {
              "title": "Disable Accessory",
              "type": "boolean",
              "default": false,
              "description": "Here You can disable this accessory.",
              "required": false
            },
            "apiKey": {
              "title": "API Key",
              "type": "string",
              "placeholder": "01032453453421923",
              "description": "Here set the Meraki Api Key.",
              "format": "password",
              "required": true
            },
            "organizationId": {
              "title": "Organization Id",
              "type": "string",
              "placeholder": "123456789",
              "description": "Here set the Organization Id.",
              "required": true
            },
            "networkId": {
              "title": "Network Id",
              "type": "string",
              "placeholder": "L_0123456789",
              "description": "Here set the Network Id.",
              "required": true
            },
            "dashboardClientsControl": {
              "title": "Dashboard Clients Control",
              "type": "boolean",
              "default": false,
              "description": "This option enable control of dashboard clients.",
              "required": false
            },
            "enablePrefixForClientName": {
              "title": "Prefix For Client Name",
              "type": "boolean",
              "default": false,
              "description": "This option enable prefix (C.) for client name displayed in HomeKit app.",
              "condition": {
                "functionBody": "return model.devices[arrayIndices].dashboardClientsControl === true;"
              },
              "required": false
            },
            "enableSonsorClients": {
              "title": "Clients Sensors",
              "type": "boolean",
              "default": false,
              "description": "This option expose Contact Sensor in HomeKit app for all exposed Clients.",
              "condition": {
                "functionBody": "return model.devices[arrayIndices].dashboardClientsControl === true;"
              },
              "required": false
            },
            "dashboardClientsPolicy": {
              "title": "Clients",
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "title": "Name",
                    "type": "string",
                    "placeholder": "Name",
                    "description": "Here set the Name to be displayed in Homebridge/HomeKit for this Client.",
                    "required": false
                  },
                  "mac": {
                    "title": "Mac",
                    "type": "string",
                    "placeholder": "Mac Address",
                    "description": "Here set the Mac Address of the Client to be exposed in Homebridge/HomeKit.",
                    "required": false
                  },
                  "type": {
                    "title": "Policy",
                    "type": "string",
                    "default": "Normal",
                    "description": "Here choice the Policy type to be appiled for this Client.",
                    "oneOf": [
                      {
                        "title": "Normal",
                        "enum": [
                          "Normal"
                        ]
                      },
                      {
                        "title": "Whitelisted",
                        "enum": [
                          "Whitelisted"
                        ]
                      },
                      {
                        "title": "Group Policy",
                        "enum": [
                          "Group policy"
                        ]
                      }
                    ],
                    "required": false
                  },
                  "mode": {
                    "title": "Enable",
                    "type": "boolean",
                    "default": false,
                    "description": "Here Enable/Disable this Client control.",
                    "required": false
                  }
                }
              },
              "condition": {
                "functionBody": "return model.devices[arrayIndices].dashboardClientsControl === true;"
              }
            },
            "accessPointsControl": {
              "title": "Access Points Control",
              "type": "boolean",
              "default": false,
              "description": "This option enable control of Access Points.",
              "required": false
            },
            "hideUnconfiguredSsids": {
              "title": "Hide Unconfigured SSIDs",
              "type": "boolean",
              "default": false,
              "description": "This option hide all unconfigured SSIDs, the name of this SSID must start with Unconfigured.",
              "condition": {
                "functionBody": "return model.devices[arrayIndices].accessPointsControl === true;"
              },
              "required": false
            },
            "enablePrefixForSsidsName": {
              "title": "Prefix For SSIDs Name",
              "type": "boolean",
              "default": false,
              "description": "This option enable prefix (W.) for SSIDs name displayed in HomeKit app.",
              "condition": {
                "functionBody": "return model.devices[arrayIndices].accessPointsControl === true;"
              },
              "required": false
            },
            "enableSonsorSsids": {
              "title": "SSIDs Sensors",
              "type": "boolean",
              "description": "This option expose Contact Sensor in HomeKit app for all exposed SSIDs.",
              "condition": {
                "functionBody": "return model.devices[arrayIndices].accessPointsControl === true;"
              },
              "required": false
            },
            "hideSsids": {
              "title": "SSIDs",
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "title": "Name",
                    "type": "string",
                    "placeholder": "SSID Name",
                    "description": "Here set the SSID Name to be not exposed in Homebridge/HomeKit.",
                    "required": false
                  },
                  "mode": {
                    "title": "Enable",
                    "type": "boolean",
                    "default": false,
                    "description": "Here Enable/Disable this SSID control.",
                    "required": false
                  }
                }
              },
              "condition": {
                "functionBody": "return model.devices[arrayIndices].accessPointsControl === true;"
              }
            },
            "switchesControl": {
              "title": "Switches Control",
              "type": "boolean",
              "default": false,
              "description": "This option enable control of Switches.",
              "required": false
            },
            "switches": {
              "title": "Switches",
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "title": "Name",
                    "type": "string",
                    "placeholder": "Switch Name",
                    "description": "Here set the Switch Name.",
                    "required": false
                  },
                  "serialNumber": {
                    "title": "Serial Number",
                    "type": "string",
                    "placeholder": "Serial Number",
                    "description": "Here set the Serial Number of the Switch to be exposed in Homebridge/HomeKit.",
                    "required": false
                  },
                  "mode": {
                    "title": "Enable",
                    "type": "boolean",
                    "default": false,
                    "description": "Here Enable/Disable this Switch control.",
                    "required": false
                  },
                  "hideUplinkPorts": {
                    "title": "Hide Uplink Ports",
                    "type": "boolean",
                    "default": false,
                    "description": "This option hide all uplink ports, the name of this Port must start with Uplink.",
                    "required": false
                  },
                  "enablePrefixForPortName": {
                    "title": "Prefix For Port Name",
                    "type": "boolean",
                    "default": false,
                    "description": "This option enable prefix (Port Number) for port name displayed in HomeKit app.",
                    "required": false
                  },
                  "enablePoePortsControl": {
                    "title": "POE Ports Control",
                    "type": "boolean",
                    "default": false,
                    "description": "This option enable POE control for controled ports.",
                    "required": false
                  },
                  "enableSensorPorts": {
                    "title": "Ports Sensors",
                    "type": "boolean",
                    "default": false,
                    "description": "This option expose Contact Sensor in HomeKit app for all exposed ports.",
                    "required": false
                  },
                  "hidePorts": {
                    "title": "Ports",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "title": "Name",
                          "type": "string",
                          "placeholder": "Port Name",
                          "description": "Here set the Port Name to be not exposed in Homebridge/HomeKit.",
                          "required": false
                        },
                        "mode": {
                          "title": "Enable",
                          "type": "boolean",
                          "default": false,
                          "description": "Here Enable/Disable this Port control.",
                          "required": false
                        }
                      }
                    }
                  }
                }
              },
              "condition": {
                "functionBody": "return model.devices[arrayIndices].switchesControl === true;"
              }
            },
            "refreshInterval": {
              "title": "Refresh Interval (sec)",
              "type": "integer",
              "minimum": 0,
              "maximum": 60,
              "default": 5,
              "description": "Here set the data refresh time in (sec).",
              "required": true
            },
            "disableLogDeviceInfo": {
              "title": "Disable Log Device Info",
              "type": "boolean",
              "default": false,
              "description": "This disable logging device info by every connections device to the network.",
              "required": false
            },
            "disableLogInfo": {
              "title": "Disable Log Info",
              "type": "boolean",
              "default": false,
              "required": false
            },
            "disableLogSuccess": {
              "title": "Disable Log Success",
              "type": "boolean",
              "default": false,
              "required": false
            },
            "disableLogWarn": {
              "title": "Disable Log Warn",
              "type": "boolean",
              "default": false,
              "required": false
            },
            "disableLogError": {
              "title": "Disable Log Error",
              "type": "boolean",
              "default": false,
              "required": false
            },
            "enableDebugMode": {
              "title": "Enable Log Debug",
              "type": "boolean",
              "default": false,
              "required": false
            }
          }
        }
      }
    }
  },
  "layout": [
    {
      "key": "devices",
      "type": "tabarray",
      "title": "{{ value.name || 'network' }}",
      "items": [
        "devices[].name",
        "devices[].host",
        "devices[].disableAccessory",
        {
          "key": "devices[]",
          "type": "section",
          "title": "Advanced Settings",
          "expandable": true,
          "expanded": false,
          "items": [
            {
              "key": "devices[]",
              "type": "tabarray",
              "title": "{{ value.title }}",
              "items": [
                {
                  "key": "devices[]",
                  "title": "Dashboard Clients",
                  "items": [
                    "devices[].dashboardClientsControl",
                    "devices[].enablePrefixForClientName",
                    "devices[].enableSonsorClients",
                    {
                      "key": "devices[]",
                      "type": "section",
                      "title": "Clients policy",
                      "expandable": true,
                      "expanded": false,
                      "items": [
                        {
                          "key": "devices[].dashboardClientsPolicy",
                          "type": "tabarray",
                          "title": "{{ value.name || 'client' }}",
                          "expandable": true,
                          "expanded": true,
                          "orderable": false,
                          "items": [
                            "devices[].dashboardClientsPolicy[].name",
                            "devices[].dashboardClientsPolicy[].mac",
                            "devices[].dashboardClientsPolicy[].type",
                            "devices[].dashboardClientsPolicy[].mode"
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "key": "devices[]",
                  "title": "Access Points",
                  "items": [
                    "devices[].accessPointsControl",
                    "devices[].hideUnconfiguredSsids",
                    "devices[].enablePrefixForSsidsName",
                    "devices[].enableSonsorSsids",
                    {
                      "key": "devices[]",
                      "type": "section",
                      "title": "Hidden SSIDs",
                      "expandable": true,
                      "expanded": false,
                      "items": [
                        {
                          "key": "devices[].hideSsids",
                          "type": "tabarray",
                          "title": "{{ value.name || 'SSID' }}",
                          "expandable": true,
                          "expanded": true,
                          "orderable": false,
                          "items": [
                            "devices[].hideSsids[].name",
                            "devices[].hideSsids[].mode"
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "key": "devices[]",
                  "title": "Switches",
                  "items": [
                    "devices[].switchesControl",
                    {
                      "key": "devices[].switches",
                      "type": "tabarray",
                      "title": "{{ value.name || 'switch' }}",
                      "expandable": true,
                      "expanded": true,
                      "orderable": false,
                      "items": [
                        "devices[].switches[].name",
                        "devices[].switches[].serialNumber",
                        "devices[].switches[].mode",
                        "devices[].switches[].hideUplinkPorts",
                        "devices[].switches[].enablePrefixForPortName",
                        "devices[].switches[].enablePoePortsControl",
                        "devices[].switches[].enableSensorPorts",
                        {
                          "key": "devices[].switches[]",
                          "type": "section",
                          "title": "Hidden Ports",
                          "expandable": true,
                          "expanded": false,
                          "items": [
                            {
                              "key": "devices[].switches[].hidePorts",
                              "type": "tabarray",
                              "title": "{{ value.name || 'port' }}",
                              "expandable": true,
                              "expanded": true,
                              "orderable": false,
                              "items": [
                                "devices[].switches[].hidePorts[].name",
                                "devices[].switches[].hidePorts[].mode"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "key": "devices[]",
                  "title": "Authorization",
                  "items": [
                    {
                      "key": "devices[].apiKey",
                      "type": "password"
                    },
                    "devices[].organizationId",
                    "devices[].networkId"
                  ]
                },
                {
                  "key": "devices[]",
                  "title": "Devices",
                  "items": [
                    "devices[].refreshInterval"
                  ]
                },
                {
                  "key": "devices[]",
                  "title": "Log",
                  "items": [
                    "devices[].disableLogDeviceInfo",
                    "devices[].disableLogInfo",
                    "devices[].disableLogSuccess",
                    "devices[].disableLogWarn",
                    "devices[].disableLogError",
                    "devices[].enableDebugMode"
                  ]
                }
              ]
            }
          ],
          "condition": {
            "functionBody": "return model.devices[arrayIndices].disableAccessory === false;"
          }
        }
      ]
    }
  ]
}