{
    "pluginAlias": "AirportExpressConnected",
    "pluginType": "platform",
    "singular": true,
    "headerDisplay": "# AirPort Express Connected \n\n Plugin that creates an occupancy sensor that shows wether or not there is an active AirPlay 2 connection to AirPort Express (2nd Gen.) devices. \n\n This plugin is supposed to be a painless experience. There is **no configuration required**. Just install and start the plugin. Devices will be automatically discovered and sensors created. Tweaking the configuration is completely optional. \n\n Made with ❤ by [maxileith](https://github.com/maxileith).",
    "schema": {
        "type": "object",
        "properties": {
            "name": {
                "title": "Platform Name",
                "type": "string",
                "default": "Airport Express Connected",
                "placeholder": "Airport Express Connected",
                "required": true,
                "description": "The name of the plugin, e.g. shown in the logs."
            },
            "update": {
                "title": "Update",
                "description": "All settings that affect the detection of state changes of AirPort Express devices:",
                "type": "object",
                "properties": {
                    "refreshRate": {
                        "title": "Refresh Rate (seconds)",
                        "type": "integer",
                        "placeholder": 3,
                        "default": 3,
                        "required": true,
                        "minimum": 1,
                        "maximum": 60,
                        "description": "Interval in which the current AirPlay 2 status is queried."
                    },
                    "ignoreGroupWithLeadingDevice": {
                        "title": "Ignore Group with leading device.",
                        "type": "boolean",
                        "default": true,
                        "required": true,
                        "description": "When disconnecting from an AirPlay group, the group will predestine a leading device, thus the AirPort Express is still connected to a device and will be report as connected. This configuration option ensures that the AirPort Express is reported as disconnected if it is part of a group with a leading device. It is recommended for most users to enable this option. However, in edge cases like playing music from a HomePod to the AirPort Express, this will prohibit the AirPort Express from being reported as connected."
                    },
                    "unreachable": {
                        "title": "Unreachable",
                        "description": "Settings regarding the behavior of the exposed accessories in case the AirPort Express is unreachable.",
                        "type": "object",
                        "properties": {
                            "ignore": {
                                "title": "Ignore",
                                "type": "boolean",
                                "placeholder": false,
                                "default": false,
                                "required": true,
                                "description": "Do not report that the AirPort Express is unreachable."
                            },
                            "threshold": {
                                "title": "Threshold (seconds)",
                                "type": "integer",
                                "placeholder": 30,
                                "default": 30,
                                "required": true,
                                "minimum": 10,
                                "maximum": 600,
                                "description": "Time an AirPort Express device must be unreachable to be reported as unreachable."
                            },
                            "reportDisconnected": {
                                "title": "Report as disconnected",
                                "type": "boolean",
                                "placeholder": false,
                                "default": false,
                                "required": true,
                                "description": "If selected, the plugin will report the AirPort Express as disconnected, thus automations that are triggered on disconnect are being triggered before the device is reported as unreachable."
                            }
                        }
                    }
                }
            },
            "discovery": {
                "title": "Discover",
                "description": "All settings that affect the discovery of AirPort Express devices:",
                "type": "object",
                "properties": {
                    "enabled": {
                        "title": "Enabled",
                        "type": "boolean",
                        "placeholder": true,
                        "default": true,
                        "required": true,
                        "description": "Should new device be discovered? When disabled, only already cached devices will be exposed."
                    },
                    "always": {
                        "title": "Always",
                        "type": "boolean",
                        "placeholder": true,
                        "default": true,
                        "required": true,
                        "description": "When enabled, new device will be discovered always. When disabled, new device will only be discovered at startup."
                    },
                    "intervals": {
                        "title": "Intervals (seconds)",
                        "type": "integer",
                        "placeholder": 30,
                        "default": 30,
                        "required": true,
                        "minimum": 10,
                        "maximum": 600,
                        "description": "Intervals in which to search for new devices."
                    },
                    "whitelist": {
                        "title": "Whitelist",
                        "type": "object",
                        "properties": {
                            "enabled": {
                                "title": "Enabled",
                                "type": "boolean",
                                "placeholder": false,
                                "default": false,
                                "required": true,
                                "description": "Only discover devices on the whitelist. This won't affect cached devices. (Can't be enabled when the blacklist is already enabled)"
                            },
                            "list": {
                                "title": "Serial Numbers",
                                "type": "array",
                                "default": [],
                                "required": true,
                                "items": {
                                    "title": "Serial Number",
                                    "type": "string",
                                    "minLength": 12,
                                    "maxLength": 12
                                },
                                "uniqueItems": true
                            }
                        }
                    },
                    "blacklist": {
                        "title": "Blacklist",
                        "type": "object",
                        "properties": {
                            "enabled": {
                                "title": "Enabled",
                                "type": "boolean",
                                "placeholder": false,
                                "default": false,
                                "required": true,
                                "description": "Only discover devices not on the blacklist. This won't affect cached devices. (Can't be enabled when the whitelist is already enabled)"
                            },
                            "list": {
                                "title": "Serial Numbers",
                                "type": "array",
                                "default": [],
                                "required": true,
                                "items": {
                                    "title": "Serial Number",
                                    "type": "string",
                                    "minLength": 12,
                                    "maxLength": 12
                                },
                                "uniqueItems": true
                            }
                        }
                    },
                    "discardKnownDevices": {
                        "title": "Discard Known Devices",
                        "type": "boolean",
                        "placeholder": false,
                        "default": false,
                        "required": true,
                        "description": "Delete known devices from cache if they do not match the white- or blacklist any longer."
                    }
                }
            }
        }
    },
    "form": null,
    "display": null
}
