{
  "pluginAlias": "LoxonePlatform",
  "pluginType": "platform",
  "singular": true,
  "headerDisplay": "Homebridge Proxy which exposes a Loxone System to Homekit",
  "footerDisplay": "For setup information, bug reports and feature requests please visit the [Plugin Homepage](https://github.com/rudyberends/homebridge-loxone-proxy).",
  "schema": {
    "type": "object",
    "properties": {
      "host": {
        "title": "MiniServer hostname/IP Address (without http/https)",
        "type": "string",
        "required": true
      },
      "port": {
        "title": "MiniServer Port",
        "type": "integer",
        "default": "80",
        "required": true
      },
      "TLS": {
        "title": "TLS",
        "type": "boolean"
      },
      "username": {
        "title": "Username",
        "type": "string",
        "required": true
      },
      "password": {
        "title": "Password",
        "type": "string",
        "required": true
      },
      "options": {
        "type": "object",
        "title": "Options",
        "properties": {
          "MoodSwitches": {
            "type": "string",
            "default": "enabled",
            "enum": [
              "enabled",
              "disabled"
            ]
          }
        }
      },
      "Advanced": {
        "type": "object",
        "title": "Advanced",
        "properties": {
          "NfcCodeTouchMapping": {
            "type": "string",
            "default": "DoorBell",
            "enum": [
              "DoorBell",
              "MotionSensor"
            ]
          },
          "MotionTriggersDoorbell": {
            "type": "boolean",
            "title": "Use Motion to trigger Doorbell event",
            "default": false
          },
          "JpegHeaderSize": {
            "type": "integer",
            "title": "JPEG Header Size Offset (bytes)",
            "description": "Adjust motion detection baseline when cameras prepend variable JPEG metadata.",
            "default": 623
          },
          "EnableTwoWayAudio": {
            "type": "boolean",
            "title": "Enable Two-Way Audio (experimental)",
            "description": "Enables HomeKit return audio. Loxone Intercom V2 uses automatic WebRTC talkback (no FFmpeg output args needed).",
            "default": false
          },
          "TwoWayAudioOutputArgs": {
            "type": "string",
            "title": "Two-Way Audio FFmpeg Output Args",
            "description": "Optional for non-Loxone cameras: FFmpeg output arguments for return audio. Placeholders: {camera_host}, {stream_url}, {audio_host}, {audio_user}, {audio_pass}. Example: -ac 1 -ar 8000 -acodec pcm_mulaw -f rtp rtp://{camera_host}:5004"
          }
        }
      },
      "Exclusions": {
        "type": "string",
        "title": "Excluded ItemTypes"
      },
      "roomfilter": {
        "type": "object",
        "title": "Room Filter",
        "properties": {
          "list": {
            "type": "string",
            "title": "Room Filter List"
          },
          "type": {
            "type": "string",
            "default": "exclusion",
            "title": "Room Filter Type",
            "enum": [
              "inclusion",
              "exclusion"
            ]
          }
        }
      },
      "switchAlias": {
        "type": "object",
        "title": "Switch aliases",
        "properties": {
          "Outlet": {
            "title": "Outlet (Will map all SwitchItems starting with this alias to a HomeKit Outlet)",
            "type": "string"
          },
          "Lock": {
            "title": "Lock (Will map all SwitchItems starting with this alias to a HomeKit DoorLock)",
            "type": "string"
          },
          "ReverseLockSwitch": {
            "title": "Reverse the Switch order (Switch ON equals door Unlocked)",
            "type": "boolean"
          }
        }
      },
      "InfoOnlyDigitalAlias": {
        "type": "object",
        "title": "InfoOnlyDigital aliases",
        "properties": {
          "Motion": {
            "title": "Motion (Will map all items starting with this alias to a HomeKit MotionSensor)",
            "type": "string"
          },
          "Smoke": {
            "title": "Smoke (Will map all items starting with this alias to a HomeKit SmokeSensor)",
            "type": "string"
          },
          "Leak": {
            "title": "Leak (Will map all items starting with this alias to a HomeKit LeakSensor)",
            "type": "string"
          }
        }
      },
      "InfoOnlyAnalogAlias": {
        "type": "object",
        "title": "InfoOnlyAnalog aliases",
        "properties": {
          "Brightness": {
            "title": "Brightness (Will map all items starting with this alias to a HomeKit LightSensor)",
            "type": "string"
          },
          "Humidity": {
            "title": "Humidity (Will map all items starting with this alias to a HomeKit HumiditySensor)",
            "type": "string"
          },
          "Temperature": {
            "title": "Temperature (Will map all items starting with this alias to a HomeKit TemperatureSensor)",
            "type": "string"
          }
        }
      },
      "enableHKSV": {
        "type": "boolean",
        "title": "Enable HomeKit Secure Video (HKSV)",
        "default": false
      }
    }
  },
  "layout": [
    {
      "type": "fieldset",
      "title": "Required Settings",
      "items": [
        {
          "type": "flex",
          "flex-flow": "row wrap",
          "items": ["host", "port"]
        },
        {
          "type": "flex",
          "flex-flow": "row wrap",
          "items": [
            "username",
            {
              "key": "password",
              "type": "password"
            }
          ]
        },
        {
          "type": "flex",
          "flex-flow": "row wrap",
          "items": ["TLS"]
        }
      ]
    },
    {
      "type": "fieldset",
      "title": "Filters",
      "description": "Select what to expose to HomeKit.",
      "expandable": true,
      "expanded": false,
      "items": [
        "options.MoodSwitches",
        "Exclusions",
        "roomfilter.type",
        "roomfilter.list"
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "SwitchItem Mappings",
      "description": "Map Switch items using an Alias",
      "items": [
        "switchAlias.Outlet",
        "switchAlias.Lock",
        "switchAlias.ReverseLockSwitch"
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "InfoOnlyAnalog Mappings",
      "description": "Map InfoOnlyAnalog items using an Alias",
      "items": [
        "InfoOnlyAnalogAlias.Brightness",
        "InfoOnlyAnalogAlias.Humidity",
        "InfoOnlyAnalogAlias.Temperature"
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "InfoOnlyDigital Mappings",
      "description": "Map InfoOnlyDigital items using an Alias",
      "items": [
        "InfoOnlyDigitalAlias.Motion",
        "InfoOnlyDigitalAlias.Smoke",
        "InfoOnlyDigitalAlias.Leak"
      ]
    },
  
    {
      "type": "fieldset",
      "expandable": true,
      "title": "HomeKit Secure Video (HKSV)",
      "description": "Enable or disable HKSV recording features. Requires iCloud+ and a compatible HomeKit Hub.",
      "items": [
        "enableHKSV",
        "Advanced.MotionTriggersDoorbell"
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "Advanced",
      "description": "",
      "items": [
        "Advanced.NfcCodeTouchMapping",
        "Advanced.JpegHeaderSize",
        "Advanced.EnableTwoWayAudio",
        "Advanced.TwoWayAudioOutputArgs"
      ]
    }
  ]
}
