// This is a example config (hyperion.config.json) with comments, in any case you need to create your own one with HyperCon!
// location of all configs: /etc/hyperion
// Webpage: https://www.hyperion-project.org


{
	/// general Settings
	/// * 'name'          : The user friendly name of the hyperion instance (used for network things)
	/// * 'versionBranch'          : Which branch should be used for hyperion version
	/// * 'showOptHelp'   : Show option expanations at the webui. Highly recommended for beginners.
	"general" :
	{
		"name"       : "MyHyperionConfig",
		"watchedVersionBranch" : "Stable",
		"showOptHelp" : true
	},
	/// set log level: silent warn verbose debug
	"logger" :
	{
		"level" : "warn"
	},

	/// Device configuration contains the following fields:
	/// * 'name'       : The user friendly name of the device (only used for display purposes)
	/// * 'type'       : The type of the device
	/// * [device type specific configuration]
	/// * 'colorOrder' : The order of the color bytes ('rgb', 'rbg', 'bgr', etc.).
	/// * 'rewriteTime': in ms. Data is resend to leds, if no new data is available in thistime. 0 means no refresh
	"device" :
	{
		"type"       : "file",
		"hardwareLedCount" : 1,
		"output"     : "/dev/null",
		"rate"     : 1000000,
		"colorOrder" : "rgb",
		"rewriteTime": 5000
	},

	/// Color manipulation configuration used to tune the output colors to specific surroundings.
	/// The configuration contains a list of color-transforms. Each transform contains the
	/// following fields:
	///  * 'imageToLedMappingType'      : multicolor_mean - every led has it's own calculatedmean color
	///                                   unicolor_mean   - every led has same color, color is the mean of whole image
	///  * 'channelAdjustment'
	///      * 'id'     : The unique identifier of the channel adjustments (eg 'device_1')
	///      * 'leds'   : The indices (or index ranges) of the leds to which this channel adjustment applies
	///            (eg '0-5, 9, 11, 12-17'). The indices are zero based.
	///      * 'white'/'red'/'green'/'blue'/'cyan'/'magenta'/'yellow' : Array of RGB to adjust the output color
	///      * 'gammaRed'/'gammaGreen'/'gammaBlue'  : Gamma value for each channel
	///      * 'id'     : The unique identifier of the channel adjustments (eg 'device_1')
	///      * 'id'     : The unique identifier of the channel adjustments (eg 'device_1')
	///      * 'backlightThreshold' : Minimum brightness (backlight)
	///      * 'backlightColored'   : backlight with color, instead of white
	///      * 'brightness' : overall brightness
	///      * 'brightnessCompensation' : 100 means brightness differences are compensated (white is as bright as red, is as bright as yellow.
	///                                   0 means white is 3x brighter than red, yellow is 2x brighter than red
	"color" :
	{
		"imageToLedMappingType" : "multicolor_mean",
		"channelAdjustment" :
		[
			{
				"id"   : "default",
				"leds" : "*",
				"white"   : [255,255,255],
				"red"     : [255,0,0],
				"green"   : [0,255,0],
				"blue"    : [0,0,255],
				"cyan"    : [0,255,255],
				"magenta" : [255,0,255],
				"yellow"  : [255,255,0],
				"gammaRed"   : 1.5,
				"gammaGreen" : 1.5,
				"gammaBlue"  : 1.5,
				"backlightThreshold"  : 0,
				"backlightColored"  : false,
				"brightness" : 100,
				"brightnessCompensation" : 80
			}
		]
	},

	/// smoothing
	///  * 'smoothing' : Smoothing of the colors in the time-domain with the following tuning
	///                  parameters:
	///            - 'enable'          Enable or disable the smoothing (true/false)
	///            - 'type'             The type of smoothing algorithm ('linear' or 'none')
	///            - 'time_ms'          The time constant for smoothing algorithm in milliseconds
	///            - 'updateFrequency'  The update frequency of the leds in Hz
	///            - 'updateDelay'      The delay of the output to leds (in periods of smoothing)
	///            - 'continuousOutput' Flag for enabling continuous output to Leds regardless of new input or not
	"smoothing" :
	{
		"enable"           : true,
		"type"             : "linear",
		"time_ms"          : 200,
		"updateFrequency"  : 25.0000,
		"updateDelay"      : 0,
		"continuousOutput" : true
	},

	/// Configuration for the embedded V4L2 grabber
	///  * device               : V4L2 Device to use [default="auto"] (Auto detection)
	///  * width                : The width of the grabbed frames (pixels) [default=0]
	///  * height               : The height of the grabbed frames (pixels) [default=0]
	///  * standard             : Video standard (PAL/NTSC/SECAM/NO_CHANGE) [default="NO_CHANGE"]
	///  * sizeDecimation       : Size decimation factor [default=8]
	///  * cropLeft             : Cropping from the left [default=0]
	///  * cropRight            : Cropping from the right [default=0]
	///  * cropTop              : Cropping from the top [default=0]
	///  * cropBottom           : Cropping from the bottom [default=0]
	///  * signalDetection      : enable/disable signal detection [default=false]
	///  * cecDetection         : enable/disable cec detection [default=false]
	///  * redSignalThreshold   : Signal threshold for the red channel between 0 and 100 [default=5]
	///  * greenSignalThreshold : Signal threshold for the green channel between 0 and 100 [default=5]
	///  * blueSignalThreshold  : Signal threshold for the blue channel between 0 and 100 [default=5]
	///  * sDHOffsetMin         : area for signal detection - horizontal minimum offset value. Values between 0.0 and 1.0
	///  * sDVOffsetMin         : area for signal detection - vertical minimum offset value. Values between 0.0 and 1.0
	///  * sDHOffsetMax         : area for signal detection - horizontal maximum offset value. Values between 0.0 and 1.0
	///  * sDVOffsetMax         : area for signal detection - vertical maximum offset value. Values between 0.0 and 1.0
	"grabberV4L2" :
	{
		"device"               : "auto",
		"width"                : 0,
		"height"               : 0,
		"standard"             : "NO_CHANGE",
		"sizeDecimation"       : 8,
		"priority"             : 240,
		"cropLeft"             : 0,
		"cropRight"            : 0,
		"cropTop"              : 0,
		"cropBottom"           : 0,
		"redSignalThreshold"   : 5,
		"greenSignalThreshold" : 5,
		"blueSignalThreshold"  : 5,
		"signalDetection"      : false,
		"cecDetection"         : false,
		"sDVOffsetMin"         : 0.25,
		"sDHOffsetMin"         : 0.25,
		"sDVOffsetMax"         : 0.75,
		"sDHOffsetMax"         : 0.75
	},

	///  The configuration for the frame-grabber, contains the following items:
	///   * type         : type of grabber. (auto|osx|dispmanx|amlogic|x11|xcb|framebuffer|qt) [auto]
	///   * width        : The width of the grabbed frames [pixels]
	///   * height       : The height of the grabbed frames [pixels]
	///   * frequency_Hz : The frequency of the frame grab [Hz]
	///   * ATTENTION    : Power-of-Two resolution is not supported and leads to unexpected behaviour!
	"framegrabber" :
	{
		// for all type of grabbers
		"type"         : "framebuffer",
		"frequency_Hz" : 10,
		"cropLeft"     : 0,
		"cropRight"    : 0,
		"cropTop"      : 0,
		"cropBottom"   : 0,

		// valid for grabber: osx|dispmanx|amlogic|framebuffer
		"width"        : 96,
		"height"       : 96,

		// valid for x11|xcb|qt
		"pixelDecimation"           : 8,

		// valid for qt
		"display" 0
	},

	/// The black border configuration, contains the following items:
	///  * enable             : true if the detector should be activated
	///  * threshold          : Value below which a pixel is regarded as black (value between 0 and 100 [%])
	///  * unknownFrameCnt    : Number of frames without any detection before the border is set to 0 (default 600)
	///  * borderFrameCnt     : Number of frames before a consistent detected border gets set (default 50)
	///  * maxInconsistentCnt : Number of inconsistent frames that are ignored before a new border gets a chance to proof consistency
	///  * blurRemoveCnt      : Number of pixels that get removed from the detected border to cut away blur (default 1)
	///  * mode               : Border detection mode (values=default,classic,osd,letterbox)
	"blackborderdetector" :
	{
		"enable"             : true,
		"threshold"          : 5,
		"unknownFrameCnt"    : 600,
		"borderFrameCnt"     : 50,
		"maxInconsistentCnt" : 10,
		"blurRemoveCnt"      : 1,
		"mode"               : "default"
	},

	/// foregroundEffect sets a "booteffect" or "bootcolor" during startup for a given period in ms (duration_ms)
	///  * enable      : if true, foreground effect is enabled
	///  * type        : choose between "color" or "effect"
	///  * color       : if type is color, a color is used (RGB) (example: [0,0,255])
	///  * effect      : if type is effect a effect is used (example: "Rainbow swirl fast")
	///  * duration_ms : The duration of the selected effect or color (0=endless)
	///            HINT: "foregroundEffect" starts always with priority 0, so it blocks all remotes and grabbers if the duration_ms is endless (0)
	"foregroundEffect" :
	{
		"enable"      : true,
		"type"        : "effect",
		"color"       : [0,0,255],
		"effect"      : "Rainbow swirl fast",
		"duration_ms" : 3000
	},

	/// backgroundEffect sets a background effect or color. It is used when all capture devices are stopped (manual via remote). Could be also selected via priorities selection.
	///  * enable : if true, background effect is enabled
	///  * type   : choose between "color" or "effect"
	///  * color  : if type is color, a color is used (RGB) (example: [255,134,0])
	///  * effect : if type is effect a effect is used (example: "Rainbow swirl fast")
	"backgroundEffect" :
	{
		"enable" : true,
		"type"   : "effect",
		"color"  : [255,138,0],
		"effect" : "Warm mood blobs"
	},

	/// The configuration of the Json/Proto forwarder. Forward messages to multiple instances of Hyperion on same and/or other hosts
	/// 'proto' is mostly used for video streams and 'json' for effects
	///  * enable : Enable or disable the forwarder (true/false)
	///  * proto  : Proto server adress and port of your target. Syntax:[IP:PORT] -> ["127.0.0.1:19401"] or more instances to forward ["127.0.0.1:19401","192.168.0.24:19403"]
	///  * json   : Json server adress and port of your target. Syntax:[IP:PORT] -> ["127.0.0.1:19446"] or more instances to forward ["127.0.0.1:19446","192.168.0.24:19448"]
	///  HINT:If you redirect to "127.0.0.1" (localhost) you could start a second hyperion with another device/led config!
	///       Be sure your client(s) is/are listening on the configured ports. The second Hyperion (if used) also needs to be configured! (WebUI -> Settings Level (Expert) -> Configuration -> Network Services -> Forwarder)
	"forwarder" :
	{
		"enable" : false,
		"flat"  : ["127.0.0.1:19401"],
		"json"   : ["127.0.0.1:19446"]
	},

	/// The configuration of the Json server which enables the json remote interface
	///  * port : Port at which the json server is started
	"jsonServer" :
	{
		"port" : 19444
	},

	/// The configuration of the Flatbuffer server which enables the Flatbuffer remote interface
	///  * port : Port at which the flatbuffer server is started
	"flatbufServer" :
	{
		"enable" : true,
		"port" : 19400,
		"timeout" : 5
	},

	/// The configuration of the Protobuffer server which enables the Protobuffer remote interface
	///  * port : Port at which the protobuffer server is started
	"protoServer" :
	{
		"enable" : true,
		"port" : 19445,
		"timeout" : 5
	},

	/// The configuration of the boblight server which enables the boblight remote interface
	///  * enable   : Enable or disable the boblight server (true/false)
	///  * port     : Port at which the boblight server is started
	///  * priority : Priority of the boblight server (Default=128) HINT: lower value result in HIGHER priority!
 	"boblightServer" :
 	{
 		"enable"   : false,
 		"port"     : 19333,
 		"priority" : 128
 	},

	/// Configuration of the Hyperion webserver
	///  * document_root : path to hyperion webapp files (webconfig developer only)
	///  * port          : the port where hyperion webapp is accasible
	///  * sslPort       : the secure (HTTPS) port of the hyperion webapp
	///  * crtPath       : the path to a certificate file to allow HTTPS connections. Should be in PEM format
	///  * keyPath       : the path to a private key file to allow HTTPS connections. Should be in PEM format and RSA encrypted
	///  * keyPassPhrase : optional: If the key file requires a password add it here
	"webConfig" :
	{
		"document_root" : "/path/to/files",
		"port"          : 8090,
		"sslPort"		: 8092,
		"crtPath"		: "/path/to/mycert.crt",
		"keyPath"		: "/path/to/mykey.key",
		"keyPassPhrase"	: ""
	},

	/// The configuration of the effect engine, contains the following items:
	///  * paths : An array with absolute location(s) of directories with effects,
	///            $ROOT is a keyword which will be replaced with the current rootPath that can be specified on startup from the commandline (defaults to your home directory)
	///  * disable : An array with effect names that shouldn't be loaded
	"effects" :
	{
		"paths" :
		[
			"$ROOT/custom-effects",
			"/usr/share/hyperion/effects"
		],
		"disable" :
		[
			"Rainbow swirl",
			"X-Mas"
		]
	},

	"instCapture" :
	{
		"systemEnable" : true,
		"systemPriority" : 250,
		"v4lEnable" : false,
		"v4lPriority" : 240
	},

	/// The configuration of the network security restrictions, contains the following items:
	///  * internetAccessAPI           : When true allows connection from internet to the API. When false it blocks all outside connections
	///  * restirctedInternetAccessAPI : webui voodoo only - ignore it
	///  * ipWhitelist                 : Whitelist ip addresses from the internet to allow access to the API
	///  * apiAuth                     : When true the API requires authentication through tokens to use the API. Read also "localApiAuth"
	///  * localApiAuth                : When false connections from the local network don't require an API authentification.
	///  * localAdminApiAuth           : When false connections from the local network don't require an authentification for administration access.
	"network" :
	{
		"internetAccessAPI" : false,
		"restirctedInternetAccessAPI" : false,
		"ipWhitelist" : [],
		"apiAuth" : true,
		"localApiAuth" : false,
		"localAdminAuth": true
	},

	/// Recreate and save led layouts made with web config. These values are just helpers for ui, not for Hyperion.
	"ledConfig" :
	{
  	"classic":
		{
			"top"	 	: 8,
			"bottom"	: 8,
			"left"		: 5,
			"right"		: 5,
			"glength"	: 0,
			"gpos"		: 0,
			"position"	: 0,
			"reverse"	: false,
			"hdepth"	: 8,
			"vdepth"	: 5,
			"overlap"	: 0,
			"edgegap"	: 0,
      "ptlh"		: 0,
      "ptlv"		: 0,
      "ptrh"		: 100,
      "ptrv"		: 0,
      "pblh"		: 0,
      "pblv"		: 100,
      "pbrh"		: 100,
      "pbrv"		: 100		

 		},
		"matrix":
		{
			"ledshoriz": 10,
			"ledsvert" : 10,
			"cabling"  : "snake",
			"start"    : "top-left"
    		}	
	},

	///  The configuration for each individual led. This contains the specification of the area
	///  averaged of an input image for each led to determine its color. Each item in the list
	///  contains the following fields:
	///  * hmin:       The fractional part of the image along the horizontal used for the averaging (minimum)
	///  * hmax:       The fractional part of the image along the horizontal used for the averaging (maximum)
	///  * vmin:       The fractional part of the image along the vertical used for the averaging (minimum)
	///  * vmax:       The fractional part of the image along the vertical used for the averaging (maximum)
	///  * colorOrder: Usually the global colorOrder is set at the device section, you can overwrite it here per led

	"leds":
	[
		{
			"hmax": 0.125,
			"hmin": 0,
			"vmax": 0.08,
			"vmin": 0

		},
		{
			"hmax": 0.25,
			"hmin": 0.125,
			"vmax": 0.08,
			"vmin": 0

		},
		{
			"hmax": 0.375,
			"hmin": 0.25,
			"vmax": 0.08,
			"vmin": 0
		},
		{
			"hmax": 0.5,
			"hmin": 0.375,
			"vmax": 0.08,
			"vmin": 0
		},
		{
			"hmax": 0.625,
			"hmin": 0.5,
			"vmax": 0.08,
			"vmin": 0
		},
		{
			"hmax": 0.75,
			"hmin": 0.625,
			"vmax": 0.08,
			"vmin": 0
		},
		{
			"hmax": 0.875,
			"hmin": 0.75,
			"vmax": 0.08,
			"vmin": 0
		},
		{
			"hmax": 1,
			"hmin": 0.875,
			"vmax": 0.08,
			"vmin": 0
		},
		{
			"hmax": 1,
			"hmin": 0.95,
			"vmax": 0.2,
			"vmin": 0
		},
		{
			"hmax": 1,
			"hmin": 0.95,
			"vmax": 0.4,
			"vmin": 0.2
		},
		{
			"hmax": 1,
			"hmin": 0.95,
			"vmax": 0.6,
			"vmin": 0.4
		},
		{
			"hmax": 1,
			"hmin": 0.95,
			"vmax": 0.8,
			"vmin": 0.6
		},
		{
			"hmax": 1,
			"hmin": 0.95,
			"vmax": 1,
			"vmin": 0.8
		},
		{
			"hmax": 1,
			"hmin": 0.875,
			"vmax": 1,
			"vmin": 0.92
		},
		{
			"hmax": 0.875,
			"hmin": 0.75,
			"vmax": 1,
			"vmin": 0.92
		},
		{
			"hmax": 0.75,
			"hmin": 0.625,
			"vmax": 1,
			"vmin": 0.92
		},
		{
			"hmax": 0.625,
			"hmin": 0.5,
			"vmax": 1,
			"vmin": 0.92
		},
		{
			"hmax": 0.5,
			"hmin": 0.375,
			"vmax": 1,
			"vmin": 0.92
		},
		{
			"hmax": 0.375,
			"hmin": 0.25,
			"vmax": 1,
			"vmin": 0.92
		},
		{
			"hmax": 0.25,
			"hmin": 0.125,
			"vmax": 1,
			"vmin": 0.92
		},
		{
			"hmax": 0.125,
			"hmin": 0,
			"vmax": 1,
			"vmin": 0.92
		},
		{
			"hmax": 0.05,
			"hmin": 0,
			"vmax": 1,
			"vmin": 0.8
		},
		{
			"hmax": 0.05,
			"hmin": 0,
			"vmax": 0.8,
			"vmin": 0.6
		},
		{
			"hmax": 0.05,
			"hmin": 0,
			"vmax": 0.6,
			"vmin": 0.4
		},
		{
			"hmax": 0.05,
			"hmin": 0,
			"vmax": 0.4,
			"vmin": 0.2
		},
		{
			"hmax": 0.05,
			"hmin": 0,
			"vmax": 0.2,
			"vmin": 0
		}
	]
}