{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/iobroker-configuration/latest.json",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/ioBroker/ioBroker.js-controller/master/schemas/iobroker.json",
    "sourceSha256": "751ca8831c073306f064b143213527a1a3f91ec9da9329fb71195a11aac06186",
    "fileMatch": [
      "iobroker.json",
      "iobroker-dist.json"
    ],
    "parsers": [
      "json"
    ]
  },
  "$defs": {
    "IoBJson": {
      "type": "object",
      "properties": {
        "system": {
          "type": "object",
          "properties": {
            "memoryLimitMB": {
              "type": "number",
              "description": "Do not use more than memory limit mb by ioB process (0 to deactivate)"
            },
            "hostname": {
              "type": "string",
              "description": "If empty, determine use real hostname"
            },
            "statisticsInterval": {
              "type": "number",
              "description": "Interval how often the counters for input/output in adapters and controller will be updated in ms"
            },
            "// statisticsInterval": {
              "type": "string"
            },
            "checkDiskInterval": {
              "type": "number",
              "description": "Interval how often the disk size will be checked in ms"
            },
            "// checkDiskInterval": {
              "type": "string"
            },
            "instanceStartInterval": {
              "type": "number",
              "description": "Interval to wait between multiple instances starts"
            },
            "compact": {
              "type": "boolean",
              "description": "Controller will try to start the instances as a part of the same process. No spawn will be done. Only by adapters that support it and have flag compact flag in io-package.json"
            },
            "// compact": {
              "type": "string"
            },
            "allowShellCommands": {
              "type": "boolean",
              "description": "Allow execution of \"shell\" sendToHost commands"
            },
            "// allowShellCommands": {
              "type": "string"
            },
            "memLimitWarn": {
              "type": "number",
              "description": "If the available RAM is below this threshold on adapter start, a warning will be logged."
            },
            "// memLimitWarn": {
              "type": "string"
            },
            "memLimitError": {
              "type": "number",
              "description": "If the available RAM is below this threshold on adapter start, an error will be logged."
            },
            "// memLimitError": {
              "type": "string"
            }
          },
          "required": [
            "memoryLimitMB",
            "hostname",
            "statisticsInterval",
            "// statisticsInterval",
            "checkDiskInterval",
            "// checkDiskInterval",
            "instanceStartInterval",
            "compact",
            "// compact",
            "allowShellCommands",
            "// allowShellCommands",
            "memLimitWarn",
            "// memLimitWarn",
            "memLimitError",
            "// memLimitError"
          ],
          "additionalProperties": false
        },
        "multihostService": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "secure": {
              "type": "boolean"
            },
            "password": {
              "type": "string"
            },
            "persist": {
              "type": "boolean"
            }
          },
          "required": [
            "enabled",
            "secure",
            "password",
            "persist"
          ],
          "additionalProperties": false
        },
        "objects": {
          "$ref": "#/$defs/ObjectsDatabaseOptions"
        },
        "states": {
          "$ref": "#/$defs/StatesDatabaseOptions"
        },
        "log": {
          "type": "object",
          "properties": {
            "level": {
              "$ref": "#/$defs/global.ioBroker.LogLevel"
            },
            "maxDays": {
              "type": "number"
            },
            "noStdout": {
              "type": "boolean"
            },
            "transport": {
              "type": "object"
            }
          },
          "required": [
            "level",
            "maxDays",
            "noStdout",
            "transport"
          ],
          "additionalProperties": false
        },
        "dataDir": {
          "type": "string",
          "description": "Always relative to iobroker.js-controller/"
        },
        "// dataDir": {
          "type": "string"
        },
        "plugins": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              }
            },
            "required": [
              "enabled"
            ],
            "additionalProperties": {}
          }
        },
        "// dnsResolution": {
          "type": "string"
        },
        "dnsResolution": {
          "type": "string",
          "enum": [
            "verbatim",
            "ipv4first"
          ],
          "description": "Use 'verbatim' for ipv6 first, else use 'ipv4first'"
        }
      },
      "required": [
        "system",
        "multihostService",
        "objects",
        "states",
        "log",
        "dataDir",
        "// dataDir",
        "plugins",
        "// dnsResolution",
        "dnsResolution"
      ],
      "description": "The ioBroker global config",
      "additionalProperties": false
    },
    "ObjectsDatabaseOptions": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "jsonl",
            "file",
            "redis"
          ],
          "description": "Possible values: 'file' - [port 9001], 'jsonl' - [port 9001], 'redis' - [port 6379 or 26379 for sentinel]."
        },
        "sentinelName": {
          "type": "string"
        },
        "host": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "port": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          ]
        },
        "connectTimeout": {
          "type": "number"
        },
        "writeFileInterval": {
          "type": "number"
        },
        "dataDir": {
          "type": "string"
        },
        "options": {
          "type": "object",
          "properties": {
            "auth_pass": {
              "type": "string"
            },
            "retry_max_delay": {
              "type": "number"
            },
            "retry_max_count": {
              "type": "number"
            },
            "db": {
              "type": "number"
            },
            "family": {
              "type": "number"
            },
            "tls": {
              "type": "object",
              "properties": {
                "rejectUnauthorized": {
                  "type": "boolean",
                  "description": "Needs to be false with self-signed certs"
                },
                "ca": {
                  "type": "string",
                  "description": "The certificate content"
                },
                "key": {
                  "type": "string",
                  "description": "The key file content"
                },
                "cert": {
                  "type": "string",
                  "description": "The cert file content"
                }
              },
              "description": "As soon as the tls property is defined, redis will try to connect via tls (currently only for redis)",
              "additionalProperties": false
            }
          },
          "required": [
            "auth_pass",
            "retry_max_delay",
            "retry_max_count",
            "db",
            "family"
          ],
          "additionalProperties": false
        },
        "backup": {
          "$ref": "#/$defs/DatabaseBackupOptions"
        },
        "jsonlOptions": {
          "$ref": "#/$defs/JsonlOptions"
        },
        "noFileCache": {
          "type": "boolean"
        }
      },
      "required": [
        "backup",
        "connectTimeout",
        "host",
        "jsonlOptions",
        "noFileCache",
        "options",
        "port",
        "type",
        "writeFileInterval"
      ],
      "additionalProperties": false
    },
    "DatabaseBackupOptions": {
      "type": "object",
      "properties": {
        "disabled": {
          "type": "boolean"
        },
        "files": {
          "type": "number",
          "description": "Minimal number of backup files, after the deletion will be executed according to backupTime settings"
        },
        "// files": {
          "type": "string"
        },
        "hours": {
          "type": "number",
          "description": "All backups older than configured hours will be deleted. But only if the number of files is greater than of backupNumber"
        },
        "// hours": {
          "type": "string"
        },
        "period": {
          "type": "number",
          "description": "By default backup every 2 hours. Time is in minutes. To disable backup set the value to 0"
        },
        "// period": {
          "type": "string"
        },
        "path": {
          "type": "string",
          "description": "Absolute path to back-up directory or empty to back-up in data directory"
        },
        "// path": {
          "type": "string"
        }
      },
      "required": [
        "disabled",
        "files",
        "// files",
        "hours",
        "// hours",
        "period",
        "// period",
        "path",
        "// path"
      ],
      "additionalProperties": false
    },
    "JsonlOptions": {
      "type": "object",
      "properties": {
        "// autoCompress (1)": {
          "type": "string"
        },
        "// autoCompress (2)": {
          "type": "string"
        },
        "// autoCompress (3)": {
          "type": "string"
        },
        "autoCompress": {
          "type": "object",
          "properties": {
            "sizeFactor": {
              "type": "number"
            },
            "sizeFactorMinimumSize": {
              "type": "number"
            }
          },
          "required": [
            "sizeFactor",
            "sizeFactorMinimumSize"
          ],
          "description": "The JSONL DB is append-only and will contain unnecessary entries after a while. It will be compressed when the uncompressed size is >= size * sizeFactor AND >= sizeFactorMinimumSize Note that too low values here will cause the DB to be rewritten often.",
          "additionalProperties": false
        },
        "// ignoreReadErrors": {
          "type": "string"
        },
        "ignoreReadErrors": {
          "type": "boolean",
          "const": true,
          "description": "If single lines in the DB are corrupted, they can be ignored without losing the whole DB."
        },
        "// throttleFS (1)": {
          "type": "string"
        },
        "// throttleFS (2)": {
          "type": "string"
        },
        "throttleFS": {
          "type": "object",
          "properties": {
            "// intervalMs": {
              "type": "string"
            },
            "intervalMs": {
              "type": "number",
              "description": "Write to the database file no more than every intervalMs milliseconds."
            },
            "// maxBufferedCommands": {
              "type": "string"
            },
            "maxBufferedCommands": {
              "type": "number",
              "description": "Force writing of buffered commands after so many changes. This reduces memory consumption and data loss in case of a crash."
            }
          },
          "required": [
            "// intervalMs",
            "intervalMs",
            "// maxBufferedCommands",
            "maxBufferedCommands"
          ],
          "description": "By default, the database immediately writes to the database file. Write access can be reduced using the throttleFS option. Be aware that buffered changes will be lost in case the process crashes",
          "additionalProperties": false
        }
      },
      "required": [
        "// autoCompress (1)",
        "// autoCompress (2)",
        "// autoCompress (3)",
        "autoCompress",
        "// ignoreReadErrors",
        "ignoreReadErrors",
        "// throttleFS (1)",
        "// throttleFS (2)",
        "throttleFS"
      ],
      "additionalProperties": false
    },
    "StatesDatabaseOptions": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "jsonl",
            "file",
            "redis"
          ],
          "description": "Possible values: 'file' - [port 9001], 'jsonl' - [port 9001], 'redis' - [port 6379 or 26379 for sentinel]."
        },
        "sentinelName": {
          "type": "string"
        },
        "host": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "port": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          ]
        },
        "connectTimeout": {
          "type": "number"
        },
        "writeFileInterval": {
          "type": "number"
        },
        "dataDir": {
          "type": "string"
        },
        "options": {
          "type": "object",
          "properties": {
            "auth_pass": {
              "type": "string"
            },
            "retry_max_delay": {
              "type": "number"
            },
            "retry_max_count": {
              "type": "number"
            },
            "db": {
              "type": "number"
            },
            "family": {
              "type": "number"
            },
            "tls": {
              "type": "object",
              "properties": {
                "rejectUnauthorized": {
                  "type": "boolean",
                  "description": "Needs to be false with self-signed certs"
                },
                "ca": {
                  "type": "string",
                  "description": "The certificate content"
                },
                "key": {
                  "type": "string",
                  "description": "The key file content"
                },
                "cert": {
                  "type": "string",
                  "description": "The cert file content"
                }
              },
              "description": "As soon as the tls property is defined, redis will try to connect via tls (currently only for redis)",
              "additionalProperties": false
            }
          },
          "required": [
            "auth_pass",
            "retry_max_delay",
            "retry_max_count",
            "db",
            "family"
          ],
          "additionalProperties": false
        },
        "backup": {
          "$ref": "#/$defs/DatabaseBackupOptions"
        },
        "jsonlOptions": {
          "$ref": "#/$defs/JsonlOptions"
        },
        "maxQueue": {
          "type": "number",
          "description": "Limit maximum number of log entries in the list (only read by adapter.ts from the config file)"
        }
      },
      "required": [
        "backup",
        "connectTimeout",
        "host",
        "jsonlOptions",
        "maxQueue",
        "options",
        "port",
        "type",
        "writeFileInterval"
      ],
      "additionalProperties": false
    },
    "global.ioBroker.LogLevel": {
      "type": "string",
      "enum": [
        "silly",
        "debug",
        "info",
        "warn",
        "error"
      ]
    }
  },
  "$ref": "#/$defs/IoBJson"
}
