{
    "pluginAlias": "Kodi",
    "pluginType": "platform",
    "singular": true,
    "headerDisplay": "Homebridge plugin for Kodi/XBMC",
    "footerDisplay": "For a detailed description, see the [readme](https://github.com/DeutscheMark/homebridge-kodi/blob/master/README.md)",
    "schema": {
        "type": "object",
        "properties": {
            "name": {
                "title": "Name",
                "type": "string",
                "description": "Will be used for all accessories as prefix.",
                "default": "Kodi",
                "required": true
            },
            "host": {
                "title": "IP Address / Hostname",
                "type": "string",
                "description": "Kodi HTTP remote control ip address/hostname. (Default: localhost)",
                "format": "hostname",
                "default": "localhost"
            },
            "port": {
                "title": "Port",
                "type": "string",
                "description": "Kodi HTTP remote control port. (Default: 8080)",
                "pattern": "^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$",
                "default": "8080"
            },
            "username": {
                "title": "Username",
                "type": "string",
                "description": "Kodi HTTP remote control username. (Default: kodi)",
                "default": "kodi"
            },
            "password": {
                "title": "Password",
                "type": "string",
                "description": "Kodi HTTP remote control password. (Default: kodi)",
                "default": "kodi"
            },
            "polling": {
                "title": "Polling",
                "type": "integer",
                "description": "Polling rate for updates in seconds. (Default: 10)",
                "default": 10,
                "minimum": 1
            },
            "retrytime": {
                "title": "Retry After",
                "type": "integer",
                "description": "Time to retry connecting to Kodi in seconds. (Default: 30)",
                "default": 30,
                "minimum": 1
            },
            "debug": {
                "title": "Debug",
                "type": "boolean",
                "description": "Enable debugging for the plugin.<br><em class='text-danger'>When enabled a lot of logs will be written depending on the polling and retry rate.</em>",
                "default": false
            },
            "power": {
                "title": "Power On/Off",
                "type": "object",
                "properties": {
                    "switch": {
                        "title": "Power On/Off",
                        "type": "boolean",
                        "default": true,
                        "description": "Add a switch for starting/stopping the Kodi instance."
                    },
                    "on": {
                        "title": "Power On Command",
                        "type": "string",
                        "description": "The shell command that will be used for the Power Switch and the TV Controls accessory to start the Kodi instance."
                    },
                    "off": {
                        "title": "Power Off Command",
                        "type": "string",
                        "description": "The shell command that will be used for the Power Switch and the TV Controls accessory to stop the Kodi instance."
                    }
                }
            },
            "television": {
                "title": "TV Accessories",
                "type": "object",
                "properties": {
                    "controls": {
                        "title": "TV Controls",
                        "type": "object",
                        "properties": {
                            "menuitems": {
                                "title": "Menu Items",
                                "type": "array",
                                "inline": true,
                                "items": {
                                    "title": "Menu Item",
                                    "type": "string",
                                    "enum": [
                                        "home",
                                        "settings",
                                        "movies",
                                        "tvshows",
                                        "tv",
                                        "music",
                                        "musicvideos",
                                        "radio",
                                        "games",
                                        "addons",
                                        "pictures",
                                        "videos",
                                        "favorites",
                                        "weather"
                                    ],
                                    "titleMap": {
                                        "home": "Home",
                                        "settings": "Settings",
                                        "movies": "Movies",
                                        "tvshows": "TV shows",
                                        "tv": "TV",
                                        "music": "Music",
                                        "musicvideos": "Music videos",
                                        "radio": "Radio",
                                        "games": "Games",
                                        "addons": "Add-ons",
                                        "pictures": "Pictures",
                                        "videos": "Videos",
                                        "favorites": "Favorites",
                                        "weather": "Weather"
                                    }
                                }
                            }
                        }
                    },
                    "tv": {
                        "title": "TV Channels",
                        "type": "object",
                        "properties": {
                            "channels": {
                                "title": "Channel",
                                "type": "array",
                                "items": {
                                    "title": "Channel Name",
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "player": {
                "title": "Player",
                "type": "object",
                "properties": {
                    "main": {
                        "title": "Main",
                        "type": "boolean",
                        "description": "Add a light bulb accessory for the playback status.",
                        "default": true
                    },
                    "play": {
                        "title": "Play",
                        "type": "boolean",
                        "description": "Add a switch for the playback status.",
                        "default": false
                    },
                    "pause": {
                        "title": "Pause",
                        "type": "boolean",
                        "description": "Add a switch for pausing the playback.",
                        "default": false
                    },
                    "stop": {
                        "title": "Stop",
                        "type": "boolean",
                        "description": "Add a switch for stopping the playback.",
                        "default": false
                    }
                }
            },
            "application": {
                "title": "Application",
                "type": "object",
                "properties": {
                    "volume": {
                        "title": "Volume",
                        "type": "boolean",
                        "description": "Add a lightbulb accessory for Kodi's application volume.",
                        "default": false
                    }
                }
            },
            "videolibrary": {
                "title": "Video Library",
                "type": "object",
                "properties": {
                    "scan": {
                        "title": "Scan",
                        "type": "boolean",
                        "description": "Add a switch for scanning the video library.",
                        "default": false
                    },
                    "clean": {
                        "title": "Clean",
                        "type": "boolean",
                        "description": "Add a switch for scanning the video library.",
                        "default": false
                    }
                }
            },
            "audiolibrary": {
                "title": "Audio Library",
                "type": "object",
                "properties": {
                    "scan": {
                        "title": "Scan",
                        "type": "boolean",
                        "description": "Add a switch for scanning the audio library.",
                        "default": false
                    },
                    "clean": {
                        "title": "Clean",
                        "type": "boolean",
                        "description": "Add a switch for cleaning the audio library.",
                        "default": false
                    }
                }
            },
            "commands": {
                "title": "Command Sequences",
                "type": "array",
                "inline": true,
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "title": "Name",
                            "type": "string",
                            "required": true
                        },
                        "interval": {
                            "title": "Interval",
                            "type": "integer",
                            "default": 200,
                            "minimum": 1
                        },
                        "sequence": {
                            "title": "Command",
                            "type": "array",
                            "required": true,
                            "items": {
                                "title": "Command",
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    },
    "layout": [
        "name",
        {
            "title": "IP Address & Port",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "items": [
                "host",
                "port"
            ]
        },
        {
            "title": "User Credentials",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "items": [
                "username",
                "password"
            ]
        },
        {
            "title": "Settings",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "items": [
                "polling",
                "retrytime",
                "debug"
            ]
        },
        {
            "title": "Power On/Off",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "items": [
                "power.switch",
                "power.on",
                "power.off"
            ]
        },
        {
            "title": "TV Controls",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "nodescription": true,
            "items": [
                {
                    "type": "help",
                    "helpvalue": "<h6>TV Controls Accessory</h6><em class='primary-text'>Add a TV accessory for menu items with Kodi remote control. (Enable accessory with at least one menu item selected)</em>"
                },
                {
                    "key": "television.controls.menuitems",
                    "type": "checkboxes",
                    "nodescription": true,
                    "notitle": true,
                    "items": [
                        {
                            "type": "div",
                            "displayFlex": false,
                            "items": [
                                {
                                    "key": "television.controls.menuitems[]",
                                    "notitle": true,
                                    "placeholder": "Enter channel name..."
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "title": "TV Channels",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "nodescription": true,
            "items": [
                {
                    "type": "help",
                    "helpvalue": "<h6>TV Channels Accessory</h6><em class='primary-text'>Add a TV accessory for tv channels with Kodi remote control. (Enable accessory with at least one channel name added)</em>"
                },
                {
                    "type": "array",
                    "key": "television.tv.channels",
                    "nodescription": true,
                    "notitle": true,
                    "items": [
                        {
                            "type": "div",
                            "displayFlex": false,
                            "items": [
                                {
                                    "key": "television.tv.channels[]",
                                    "notitle": true,
                                    "placeholder": "Enter channel name..."
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "title": "Player",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "nodescription": true,
            "items": [
                "player.play",
                "player.pause",
                "player.stop"
            ]
        },
        {
            "title": "Application",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "nodescription": true,
            "items": [
                "application.volume"
            ]
        },
        {
            "title": "Video Library",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "nodescription": true,
            "items": [
                "videolibrary.scan",
                "videolibrary.clean"
            ]
        },
        {
            "title": "Audio Library",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "nodescription": true,
            "items": [
                "audiolibrary.scan",
                "audiolibrary.clean"
            ]
        },
        {
            "title": "Command Sequences",
            "type": "fieldset",
            "expandable": true,
            "expanded": false,
            "nodescription": true,
            "items": [
                {
                    "type": "help",
                    "helpvalue": "<h6>Command Sequences</h6><em class='primary-text'>Add a command sequence accessory for Kodi.</em>"
                },
                {
                    "key": "commands",
                    "type": "array",
                    "notitle": true,
                    "nodescription": true,
                    "items": [
                        {
                            "type": "div",
                            "displayFlex": true,
                            "flex-direction": "row",
                            "flex-wrap": "wrap",
                            "items": [
                                {
                                    "key": "commands[].name",
                                    "flex": "1 1 70%",
                                    "notitle": false,
                                    "placeholder": "Enter command sequence name..."
                                },
                                {
                                    "key": "commands[].interval",
                                    "flex": "1 1 30%",
                                    "notitle": false,
                                    "placeholder": "Enter interval..."
                                },
                                {
                                    "key": "commands[].sequence",
                                    "flex": "1 1 100%",
                                    "notitle": false,
                                    "expandable": true,
                                    "expanded": false,
                                    "items": [
                                        {
                                            "key": "commands[].sequence[]",
                                            "type": "string",
                                            "notitle": true,
                                            "placeholder": "Enter sequence..."
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "display": null
}