{
	"pluginAlias": "bhyve",
	"headerDisplay": "Homebridge plugin for Orbit BHyve Hose & Water Timers",
	"pluginType": "platform",
	"singular": true,
	"strictValidation": true,
	"schema": {
		"type": "object",
		"properties": {
			"name": {
				"title": "Accessory Name",
				"description": "Name for this accessory",
				"type": "string",
				"required": true,
				"placeholder": "BHyve",
				"default": "BHyve"
			},
			"email": {
				"title": "Email",
				"type": "string",
				"placeholder": "username@gmail.com",
				"required": true
			},
			"password": {
				"title": "Password",
				"type": "string",
				"placeholder": "password",
				"required": true
			},
			"locationAddress": {
				"title": "Street Address",
				"type": "string",
				"required": false,
				"placeholder": "Leave blank for all locations"
			},
			"defaultRuntime": {
				"title": "Default Runtime in Minutes",
				"description": "Default number of minutes to run zones if not provided.",
				"type": "integer",
				"minimum": 1,
				"maximum": 60,
				"required": true,
				"default": 1
			},
			"runtimeSource": {
				"title": "Runtime source",
				"type": "integer",
				"required": true,
				"default": 0,
				"description": "Select a source to load intial values for each zones runtime. These can be changed in HomeKit.<br/>These sources need to be configured or present in B-Hyve app or the default time will be used.",
				"oneOf": [
					{
						"title": "Plugin default runtime",
						"enum": [0]
					},
					{
						"title": "Device Manual Preset runtimes from B-Hyve",
						"enum": [1]
					},
					{
						"title": "Zone Cycle runtimes from B-Hyve",
						"enum": [2]
					}
				]
			},
			"useIrrigationDisplay": {
				"title": "Display as Irrigation System in HomeKit",
				"type": "boolean",
				"required": true,
				"default": true
				},
			"showSimpleValve": {
				"title": "Display as Valve in HomeKit",
				"type": "boolean",
				"required": true,
				"default": false
			},
			"displayValveType": {
				"title": "Display Valves as",
				"type": "integer",
				"required": true,
				"default": 1,
				"description": "Select valve type to display when not displaying as irrigation system",
				"oneOf": [
					{
						"title": "Generic",
						"enum": [0]
					},
					{
						"title": "Irrigation",
						"enum": [1]
					},
					{
						"title": "Shower",
						"enum": [2]
					},
					{
						"title": "Faucet",
						"enum": [3]
					}
				]
			},
			"showIrrigation": {
				"title": "Expose Irrigation System in HomeKit",
				"type": "boolean",
				"required": true,
				"default": true
			},
			"showBridge": {
				"title": "Expose WiFi Hub in HomeKit",
				"type": "boolean",
				"required": true,
				"default": false
			},
			"showFloodSensor": {
				"title": "Expose Flood Sensors in HomeKit",
				"type": "boolean",
				"required": true,
				"default": false
			},
			"showTempSensor": {
				"title": "Expose Temperature Sensors in HomeKit",
				"type": "boolean",
				"required": true,
				"default": false
			},
			"showLimitsSensor": {
				"title": "Expose Occupancy Sensors in HomeKit for Temperature high/low limits",
				"type": "boolean",
				"required": true,
				"default": false
			},
			"showStandby": {
				"title": "Expose switch for controller standby",
				"description": "Exposes off mode switch, when turned on all schedules from B-hyve will be disabled.",
				"type": "boolean",
				"required": true,
				"default": false
			},
			"showRunall": {
				"title": "All zones",
				"description": "Adds a switch to run all zones all device for the default time.",
				"type": "boolean",
				"required": true,
				"default": false
			},
			"showSchedules": {
				"title": "Expose switches for schedules",
				"description": "Exposes schedules as defined in the B-Hyve app as a switches for quick run from HomeKit.",
				"type": "boolean",
				"required": true,
				"default": false
			},
			"showAPIMessages": {
				"title": "Log API responses",
				"type": "boolean",
				"required": false,
				"default": false
			},
			"showIncomingMessages": {
				"title": "Log incoming Websocket messages",
				"type": "boolean",
				"required": false,
				"default": false
			},
			"showOutgoingMessages": {
				"title": "Log outgoing Websocket messages",
				"type": "boolean",
				"required": false,
				"default": false
			}
		}
	},
	"layout": [
		{
			"type": "help",
			"helpvalue": "<h4><b>Required settings<b/></h4>"
		},
		{
			"type": "flex",
			"flex-flow": "row wrap",
			"items": [
				"name"
			]
		},
		{
			"type": "help",
			"helpvalue": "<p class='help-block'> <h6><b>Orbit B-Hyve account login info<b></h6></p>"
		},
		{
				"type": "flex",
				"flex-flow": "row wrap",
				"items": [
					"email",
					"password"
				]
			},
		{
			"type": "help",
			"helpvalue": "<h6><b>Location Support</b></h6><p class='help-block'> If you have more than one location and want to display them in separate Homebridge/HomeKit homes you can retrive only the devices at this street address otherwise leave blank.<br/>The address must match the address configured in the b-hyve app, review the log file to see the adresses as configured in the b-hyve app.</p>"
		},
		{
			"type": "flex",
			"flex-flow": "row wrap",
			"items": [
				"locationAddress"
			]
		},
		{
			"type": "help",
			"helpvalue": "<h6><b>Irrigation System</b></h6><p class='help-block'> Display these accessories in HomeKit, display as a irrigation system with integrated sprinker zones.<br/>If unchecked, the irrigation system zones will displayed as individual tiles with the option in Homekit to show single or separate.</p>"
		},
		{
			"type": "flex",
			"flex-flow": "row wrap",
			"items": [
				"showIrrigation",
				"useIrrigationDisplay",
				"showBridge"
			]
		},
		{
			"type": "help",
			"helpvalue": "<h6><b>Hose Timer</b></h6><p class='help-block'> Display Hose Timers HT25 as a simple valve.<br/></p>"
		},
		{
			"type": "flex",
			"items": [
				"showSimpleValve",
				"displayValveType"
			]
		},
		{
			"type": "flex",
			"flex-flow": "row wrap",
			"items": [
				"defaultRuntime",
				"runtimeSource"
			]
		},
		{
			"type": "help",
			"helpvalue": "<h6><b>Flood Sensor</b></h6><p class='help-block'> Display these sensors in HomeKit.</p>"
		},
		{
			"type": "flex",
			"flex-flow": "row wrap",
			"items": [
				"showTempSensor",
				"showFloodSensor",
				"showLimitsSensor"
			]
		},
		{
			"type": "fieldset",
			"title": "Additional Switches",
			"description": "Expand to expose additonal switches",
			"expandable": true,
			"items": [
				"showStandby",
				"showSchedules",
				"showRunall"
			]
		},
		{
			"type": "fieldset",
			"title": "Debug logging",
			"description": "Expand to enable additional debug logging",
			"expandable": true,
			"flex-flow": "row wrap",
			"items": [
				"showAPIMessages",
				"showIncomingMessages",
				"showOutgoingMessages"
			]
		}
	]
}