{ "pluginAlias": "UniFi Occupancy Sensor", "pluginType": "accessory", "schema": { "type": "object", "properties": { "name": { "title": "Sensor Name", "type": "string", "default": "Occupancy Sensor", "minLength": 1, "required": true }, "unifi": { "title": "UniFi Controller Settings", "type": "object", "properties": { "controller": { "title": "Controller URL", "type": "string", "required": true }, "username": { "title": "Username", "type": "string", "required": true }, "password": { "title": "Password", "type": "string", "required": true }, "site": { "title": "Site", "type": "string", "default": "default", "required": true }, "secure": { "title": "Validate the Controller SSL Certificate?", "type": "boolean" }, "unifios": { "title": "Does your controller run on UnifiOS?", "type": "boolean" } } }, "watch": { "title": "Watched Devices", "type": "array", "items": { "title": "Device MAC Address", "type": "string", "pattern": "^([a-f0-9]{2}:){5}[a-f0-9]{2}$" } }, "monitor": { "title": "Watched Devices", "type": "array", "items": { "title": "Device / AP", "type": "object", "properties": { "device": { "title": "Device MAC Address", "type": "string", "pattern": "^([a-f0-9]{2}:){5}[a-f0-9]{2}$", "required": true }, "ap": { "title": "AP MAC Address", "type": "string", "pattern": "^([a-f0-9]{2}:){5}[a-f0-9]{2}$" } } } }, "mode": { "title": "Watch Mode", "type": "string", "default": "any", "oneOf": [ { "title": "Any - only trigger occupancy when at least one watched device is connected", "enum": [ "any" ] }, { "title": "All - only trigger occupancy when all watched devices are connected", "enum": [ "all" ] }, { "title": "None - only trigger occupancy when none of the watched devices are connected", "enum": [ "none" ] } ], "required": true }, "watchGuests": { "title": "Watch Guest Networks?", "type": "boolean" }, "interval": { "title": "Interval in seconds to query Unifi Controller (fallback if events are not working)", "type": "integer", "required": false, "default": 1800 } } }, "layout": [ { "type": "flex", "flex-flow": "row wrap", "items": [ { "type": "flex", "flex-flow": "column", "items": [ "name", "unifi.username" ] }, { "type": "flex", "flex-flow": "column", "items": [ "unifi.controller", "unifi.password" ] } ] }, "unifi.unifios", "unifi.secure", "watchGuests", "unifi.site", "mode", "interval", { "type": "help", "helpvalue": "

Monitored Devices

Leave the AP field blank to watch for the device on all APs." }, { "nodescription": true, "notitle": true, "key": "monitor", "type": "array", "items": [ { "type": "flex", "flex-flow": "row wrap", "items": [ { "type": "flex", "flex-flow": "column", "items": [ "monitor[].device" ] }, { "type": "flex", "flex-flow": "column", "items": [ "monitor[].ap" ] } ] } ] }, { "type": "help", "helpvalue": "

Watched Devices

", "condition": { "functionBody": "return (model.watch && model.watch.length)" } }, { "nodescription": true, "notitle": true, "key": "watch", "type": "array", "items": [ { "type": "div", "displayFlex": true, "flex-direction": "row", "items": [ { "key": "watch[]" } ] } ], "condition": { "functionBody": "return (model.watch && model.watch.length)" } } ] }