{
    "pluginAlias": "EnOceanPlatform",
    "pluginType": "platform",
    "singular": true,
    "strictValidation": false,
    "schema": {
        "type": "object",
        "properties": {
            "devices": {
                "title": "EnOcean Devices",
                "type": "array",
                "description": "List of EnOcean devices to add as accessories.",
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "required": true,
                            "title": "Display Name",
                            "type": "string"
                        },
                        "id": {
                            "required": true,
                            "title": "EnOcean ID",
                            "type": "string",
                            "placeholder": "xx:xx:xx:xx"
                        },
                        "eep": {
                            "required": true,
                            "title": "EnOcean Equipment Profile (EEP)",
                            "type": "string",
                            "placeholder": "rr-ff-tt"
                        },
                        "model": {
                            "required": false,
                            "title": "Model",
                            "type": "string"
                        },
                        "manufacturer": {
                            "required": false,
                            "title": "Manufacturer",
                            "type": "string"
                        },
                        "time": {
                            "required": false,
                            "title": "Time [s]",
                            "type": "number",
                            "placeholder": "",
                            "description": "<ul><li>Window Covering: the travel time of the blinds in seconds.</li><li>Contact Sensor: this time the contact is open before the status tampered is active.</li></ul>No effect on other accessories."
                        },
                        "accessoryKind": {
                            "required": false,
                            "title": "Accessory Kind Override",
                            "type": "string",
                            "oneOf": [
                                {
                                    "title": "Contact Sensor",
                                    "enum": [
                                        "contactSensor"
                                    ]
                                },
                                {
                                    "title": "Leak Sensor",
                                    "enum": [
                                        "leakSensor"
                                    ]
                                },
                                {
                                    "title": "Lightbulb",
                                    "enum": [
                                        "lightbulb"
                                    ]
                                },
                                {
                                    "title": "Motion Sensor",
                                    "enum": [
                                        "motionSensor"
                                    ]
                                },
                                {
                                    "title": "Outlet",
                                    "enum": [
                                        "outlet"
                                    ]
                                },
                                {
                                    "title": "Stateless Programmable Switch",
                                    "enum": [
                                        "statelessProgrammableSwitch"
                                    ]
                                },
                                {
                                    "title": "Switch",
                                    "enum": [
                                        "switch"
                                    ]
                                },
                                {
                                    "title": "Temperature Sensor",
                                    "enum": [
                                        "temperatureSensor"
                                    ]
                                },
                                {
                                    "title": "Window Covering",
                                    "enum": [
                                        "windowCovering"
                                    ]
                                }
                            ],
                            "description": "Allows to override tha accessory type. Useful for e.g. RORG F6 (RPS) telegrams when they should be contact sensors but this cannot be known from the EEP."
                        },
                        "localSenderIndex": {
                            "required": false,
                            "title": "Local Sender ID Offset",
                            "type": "integer",
                            "maximum": 127,
                            "placeholder": "",
                            "description": "Override the offset to the Base ID (1 to 127). Usually automatically assigned."
                        }
                    }
                }
            },
            "name": {
                "title": "Platform Name",
                "description": "Name of the platform as it appears in the Homebridge logs in square braces.",
                "default": "EnOcean",
                "type": "string",
                "required": true
            },
            "comDevice": {
                "title": "EnOcean device path",
                "description": "Path to the EnOcean transceiver device.",
                "type": "string",
                "required": true,
                "typeahead": {
                    "source": [
                        "/dev/ttyUSB0",
                        "/dev/ttyUSB1",
                        "/dev/serial/by-id/usb-EnOcean_GmbH_EnOcean_USB_300_DB_xxxxxx-if00-port0"
                    ]
                }
            },
            "isAutoCreateEnabled": {
                "title": "Auto-Create",
                "description": "React on Eltako teach-in request messages (MSC type) and create and bind some devices automatically.",
                "default": false,
                "type": "boolean"
            },
            "isLearnSwitchEnabled": {
                "title": "Learn Switch",
                "description": "Create a switch accessory in Homebridge (EnOcean Learn) to switch learn/teach-in mode.",
                "default": true,
                "type": "boolean"
            },
            "isHistoryServiceEnabled": {
                "title": "History Service for Eve App",
                "description": "Use the fakegato-history service to support history graphs in the Eve app.",
                "default": true,
                "type": "boolean"
            }
        }
    },
    "layout": [
        {
            "type": "fieldset",
            "title": "EnOcean Devices",
            "key": "devices",
            "expandable": false,
            "expanded": true,
            "items": [
                {
                    "type": "fieldset",
                    "title": "Device {{ $index }} - {{ value.name || 'New device' }}",
                    "expandable": true,
                    "expanded": false,
                    "items": [
                        {
                            "type": "flex",
                            "flex-flow": "row wrap",
                            "items": [
                                "devices[].name",
                                "devices[].id",
                                "devices[].eep"
                            ]
                        },
                        {
                            "type": "flex",
                            "flex-flow": "row wrap",
                            "items": [
                                {
                                    "type": "flex",
                                    "flex": "1 1 33.33%",
                                    "items": [
                                        "devices[].model"
                                    ]
                                },
                                {
                                    "type": "flex",
                                    "flex": "1 1 33.33%",
                                    "items": [
                                        "devices[].manufacturer"
                                    ]
                                },
                                {
                                    "type": "flex",
                                    "flex": "1 1 33.33%",
                                    "items": []
                                }
                            ]
                        },
                        {
                            "type": "section",
                            "title": "Advanced Settings",
                            "expandable": true,
                            "expanded": false,
                            "items": [
                                "devices[].time",
                                "devices[].accessoryKind",
                                "devices[].localSenderIndex"
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "type": "fieldset",
            "title": "Platform Settings",
            "items": [
                "name",
                "comDevice",
                "isAutoCreateEnabled",
                "isLearnSwitchEnabled",
                "isHistoryServiceEnabled"
            ]
        }
    ]
}