{
  "pluginAlias": "HomebridgeDummy",
  "pluginType": "platform",
  "singular": true,
  "customUi": true,
  "customUiPath": "./dist/homebridge-ui",
  "schema": {
    "type": "object",
    "definitions": {
      "units": {
        "type": "string",
        "title": "Единицы",
        "enum": [ "MILLISECONDS", "SECONDS", "MINUTES", "HOURS"],
        "enumNames": ["Миллисекунды", "Секунды", "Минуты", "Часы"]
      },
      "sensor": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "title": "Подключить датчик",
            "enum": ["CarbonDioxideSensor", "CarbonMonoxideSensor", "ContactSensor", "LeakSensor", "MotionSensor", "OccupancySensor", "SmokeSensor"],
            "enumNames": ["Углекислый газ", "Угарный газ", "Контакт", "Протечка", "Движение", "Присутствие", "Дым"]
          },
          "behavior": {
            "type": "string",
            "title": "Поведение датчика",
            "enum": ["MIRROR", "TIMER"],
            "enumNames": ["Зеркалирование аксессуара", "Управление по таймеру"]
          }
        }
      },
      "notification": {
        "type": "object",
        "properties": {
          "api": {
            "type": "string",
            "title": "API",
            "enum": ["PINGIE_NOTIFY", "PUSHOVER"],
            "enumNames": ["Notify! (notify.pingie.com)", "Pushover (pushover.net)"]
          },
          "token": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "title": "Заголовок срабатывания (необязательно)"
          },
          "text": {
            "type": "string",
            "title": "Текст срабатывания",
            "description": "Когда аксессуар устанавливается в противоположное значение (не по умолчанию)"
          },
          "resetTitle": {
            "type": "string",
            "title": "Заголовок сброса (необязательно)"
          },
          "resetText": {
            "type": "string",
            "title": "Текст сброса",
            "description": "Когда аксессуар возвращается к значению по умолчанию"
          },
          "groupType": {
            "type": "string"
          },
          "iconURL": {
            "type": "string"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "api": {
                  "enum": ["PINGIE_NOTIFY"]
                }
              },
              "required": ["api"]
            },
            "then": {
              "required": ["token", "id"]
            }
          },
          {
            "if": {
              "properties": {
                "api": {
                  "enum": ["PUSHOVER"]
                }
              },
              "required": ["api"]
            },
            "then": {
              "required": ["token"]
            }
          },
          {
            "if": {
              "properties": {
                "id": {
                }
              },
              "required": ["id"]
            },
            "then": {
              "required": ["token"]
            }
          },
          {
            "if": {
              "properties": {
                "title": {
                }
              },
              "required": ["title"]
            },
            "then": {
              "required": ["text"]
            }
          },
          {
            "if": {
              "properties": {
                "title": {
                }
              },
              "required": ["resetTitle"]
            },
            "then": {
              "required": ["resetText"]
            }
          }
        ],
        "anyOf": [
          {
            "if": {
              "properties": {
                "token": {
                }
              },
              "required": ["token"]
            },
            "then": {
              "required": ["text"]
            }
          },
          {
            "if": {
              "properties": {
                "token": {
                }
              },
              "required": ["token"]
            },
            "then": {
              "required": ["resetText"]
            }
          }
        ]
      },
      "schedule": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "title": "Тип",
            "enum": [ "TIMEOUT", "INTERVAL", "CRON", "SUNRISE", "SUNSET", "DAWN", "DUSK", "GOLDEN_HOUR", "NIGHT"],
            "enumNames": ["После задержки", "Интервал", "Cron", "Восход", "Закат", "Рассвет", "Сумерки", "Золотой час", "Ночь"]
          },
          "time": {
            "type": "integer",
            "title": "Время",
            "minimum": 1
          },
          "units": { "$ref": "#/definitions/units" },
          "random": {
            "type": "boolean",
            "title": "Случайность",
            "description": "Время будет случайным, указанное значение — максимум"
          },
          "cron": {
            "type": "string",
            "title": "Предустановка",
            "enum": [ "@secondly", "@minutely", "@hourly", "@daily", "@weekly", "@weekdays", "@weekends", "@monthly", "@yearly", "CRON_CUSTOM"],
            "enumNames": ["Ежесекундно", "Ежеминутно", "Ежечасно", "Ежедневно", "Еженедельно", "Будни", "Выходные", "Ежемесячно", "Ежегодно", "Пользовательский"]
          },
          "cronCustom": {
            "type": "string",
            "title": "Произвольный Cron",
            "placeholder": "* * * * * *",
            "pattern": "(^((\\*\\/)?([0-5]?[0-9])((,|-|\\/)([0-5]?[0-9]))*|\\*)\\s((\\*\\/)?((2[0-3]|1[0-9]|[0-9]|00))((,|-|\\/)(2[0-3]|1[0-9]|[0-9]|00))*|\\*)\\s((\\*\\/)?([1-9]|[12][0-9]|3[01])((,|-|\\/)([1-9]|[12][0-9]|3[01]))*|\\*)\\s((\\*\\/)?([1-9]|1[0-2])((,|-|\\/)([1-9]|1[0-2]))*|\\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))\\s((\\*\\/)?[0-6]((,|-|\\/)[0-6])*|\\*|00|(sun|mon|tue|wed|thu|fri|sat))$)"
          },
          "offset": {
            "type": "number",
            "title": "Смещение",
            "enum": [-45, -30, -20, -15, -10, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 10, 15, 20, 30, 45],
            "enumNames": ["-45 Минуты", "-30 Минуты", "-20 Минуты", "-15 Минуты", "-10 Минуты", "-5 Минуты", "-4 Минуты", "-3 Минуты", "-2 Минуты", "-1 Минуты", "+1 Минуты", "+2 Минуты", "+3 Минуты", "+4 Минуты", "+5 Минуты", "+10 Минуты", "+15 Минуты", "+20 Минуты", "+30 Минуты", "+45 Минуты"]
          },
          "latitude": {
            "type": "number",
            "title": "Широта"
          },
          "longitude": {
            "type": "number",
            "title": "Долгота"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "type": {
                  "enum": ["TIMEOUT", "INTERVAL"]
                }
              }
            },
            "then": {
              "required": ["time", "units"]
            }
          },
          {
            "if": {
              "properties": {
                "type": {
                  "const": "CRON"
                }
              }
            },
            "then": {
              "required": ["cron"]
            }
          },
          {
            "if": {
              "required": ["cron"],
              "properties": {
                "cron": {
                  "const": "CRON_CUSTOM"
                }
              }
            },
            "then": {
              "required": ["cronCustom"]
            }
          },
          {
            "if": {
              "properties": {
                "type": {
                  "enum": ["SUNRISE", "SUNSET", "DAWN", "DUSK", "GOLDEN_HOUR", "NIGHT"]
                }
              }
            },
            "then": {
              "required": ["latitude", "longitude"]
            }
          }
        ]
      },
      "limiter": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "number",
            "title": "Лимит"
          },
          "units": {
            "type": "string",
            "title": "Единицы",
            "enum": [ "SECONDS", "MINUTES", "HOURS"],
            "enumNames": ["Секунды", "Минуты", "Часы"],
            "required": true
          },
          "period": {
            "type": "string",
            "title": "За период",
            "enum": [ "HOUR", "DAY", "WEEK", "MONTH"],
            "enumNames": ["Час", "День", "Неделя", "Месяц"],
            "required": true
          },
          "resetOnRestart": {
            "type": "boolean"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "limit": {
                }
              },
              "required": ["limit"]
            },
            "then": {
              "required": ["units", "period"]
            }
          },
          {
            "if": {
              "properties": {
                "units" : {
                }
              },
              "required": [ "units" ]
            },
            "then": {
              "required": [ "limit"]
            }
          },
          {
            "if": {
              "properties": {
                "period" : {
                }
              },
              "required": [ "period" ]
            },
            "then": {
              "required": [ "limit"]
            }
          }
        ]
      },
      "operand": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "title": "Тип",
            "enum": [ "ACCESSORY", "LOG", "PING" ],
            "enumNames": [ "Аксессуар", "Наблюдатель журнала", "Доступность" ],
            "required": true
          },
          "accessoryId": {
            "type": "string",
            "title": "Аксессуар"
          },
          "accessoryState": {
            "type": "string",
            "title": "Состояние",
            "enum": [ "on", "off", "open", "closed", "locked", "unlocked" ],
            "enumNames": [ "Вкл.", "Выкл.", "Открыто", "Закрыто", "Заблокировано", "Разблокировано" ]
          },
          "pattern": {
            "type": "string",
            "title": "Строка поиска или RegEx"
          },
          "pingHost": {
            "type": "string",
            "title": "Хост"
          },
          "pingAvailability": {
            "type": "string",
            "title": "Состояние",
            "enum": [ "AVAILABLE",  "NOT_AVAILABLE"],
            "enumNames": [ "Доступно", "Недоступно" ]
          },
          "pingInterval": {
            "type": "integer",
            "title": "Интервал",
            "minimum": 1
          },
          "pingUnits": {
            "$ref": "#/definitions/units"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "type": {
                  "const": "ACCESSORY"
                }
              },
              "required": ["type"]
            },
            "then": {
              "required": ["accessoryId", "accessoryState"]
            }
          },
          {
            "if": {
              "properties": {
                "type": {
                    "const": "LOG"
                }
              },
              "required": ["type"]
            },
            "then": {
              "required": ["pattern"]
            }
          },
          {
            "if": {
              "properties": {
                "type": {
                    "const": "PING"
                }
              },
              "required": ["type"]
            },
            "then": {
                "required": ["pingHost", "pingAvailability", "pingInterval", "pingUnits"]
            }
          }
        ]
      },
      "conditions": {
        "type": "object",
        "properties": {
          "operator": {
            "type": "string",
            "title": "Активировать, когда…",
            "enum": [ "and", "or"],
            "enumNames": ["ВСЕ условия выполнены", "ЛЮБОЕ условие выполнено"]
          },
          "operands": {
            "type": "array",
            "minItems":1,
            "items": { "$ref": "#/definitions/operand" }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "operator": {
                }
              },
              "required": ["operator"]
            },
            "then": {
              "required": ["operands"]
            }
          }
        ]
      },
      "simulation": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "time": {
            "type": "integer",
            "minimum": 1
          },
          "units": { "$ref": "#/definitions/units" }
        }
      },
      "fadeOut": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "title": "Тип",
            "enum": [ "INCREMENTAL", "FIXED"],
            "enumNames": ["Пошаговый", "Фиксированный"]
          },
          "time": {
            "title": "Время",
            "type": "integer",
            "minimum": 1
          },
          "units": { "$ref": "#/definitions/units" }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "type": {
                }
              },
              "required": ["type"]
            },
            "then": {
              "required": ["time", "units"]
            }
          },
          {
            "if": {
                "properties": {
                  "time": {
                  }
                },
                "required": ["time"]
            },
            "then": {
                "required": ["type"]
            }
          },
          {
            "if": {
                "properties": {
                  "units": {
                  }
                },
                "required": ["units"]
            },
            "then": {
                "required": ["type"]
            }
          }
        ]
      }
    },
    "properties": {
      "name": {
        "type": "string",
        "default": "Homebridge Dummy"
      },
      "accessories": {
        "type": "array",
        "items": {
          "type": "object",
          "required": ["name", "type"],
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string",
              "title": "Имя"
            },
            "type": {
              "type": "string",
              "title": "Тип",
              "enum": ["Door", "GarageDoorOpener", "HumidifierDehumidifier", "HumiditySensor", "Lightbulb", "LockMechanism", "Outlet", "StatelessProgrammableSwitch", "Switch", "TemperatureSensor", "Thermostat", "Valve", "Window", "WindowCovering"],
              "enumNames": ["Дверь", "Гаражные ворота", "Увлажнитель/осушитель", "Датчик влажности", "Лампочка", "Замок", "Розетка", "Кнопка без состояния", "Выключатель", "Датчик температуры", "Термостат", "Клапан", "Окно", "Оконные шторы (жалюзи)"]
            },
            "protocol": {
              "type": "string",
              "title": "Протокол",
              "enum": [ "HomeKit", "Matter"],
              "enumNames": ["HomeKit (по умолчанию)", "Matter (бета)"],
              "default": "HomeKit"
            },
            "groupName": {
              "type": "string",
              "title": "Имя группы"
            },
            "sensor": { "$ref": "#/definitions/sensor" },
            "notification": { "$ref": "#/definitions/notification" },
            "schedule": { "$ref": "#/definitions/schedule" },
            "fadeOut": { "$ref": "#/definitions/fadeOut" },
            "autoReset": { "$ref": "#/definitions/schedule" },
            "limiter": { "$ref": "#/definitions/limiter" },
            "conditions": { "$ref": "#/definitions/conditions" },
            "simulation": { "$ref": "#/definitions/simulation" },
            "temperatureUnits": {
              "type": "string",
              "title": "Единицы температуры",
              "enum": ["C", "F"],
              "enumNames": ["°C", "°F"]
            },
            "isDimmer": {
              "type": "boolean",
              "title": "Включить яркость"
            },
            "defaultState": {
              "type": "string",
              "title": "Состояние по умолчанию",
              "enum": ["on", "off"],
              "enumNames": ["Вкл.", "Выкл."]
            },
            "defaultLockState": {
              "type": "string",
              "title": "Состояние по умолчанию",
              "enum": ["locked", "unlocked"],
              "enumNames": ["Заблокировано", "Разблокировано"]
            },
            "defaultPosition": {
              "type": "string",
              "title": "Положение по умолчанию",
              "enum": ["open", "closed"],
              "enumNames": ["Открыто", "Закрыто"]
            },
            "defaultThermostatState": {
              "type": "string",
              "title": "Состояние по умолчанию",
              "enum": ["auto", "heat", "cool", "off"],
              "enumNames": ["Авто", "Обогрев", "Охлаждение", "Выкл."]
            },
            "defaultTemperature": {
              "type": "number",
              "title": "Температура по умолчанию"
            },
            "minimumTemperature": {
              "type": "number",
              "title": "Мин. температура"
            },
            "maximumTemperature": {
              "type": "number",
              "title": "Макс. температура"
            },
            "validStates": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "enum": ["off", "heat", "cool", "auto"]
              }
            },
            "humidifierType": {
              "type": "string",
              "title": "Тип",
              "enum": ["humidifier", "dehumidifier"],
              "enumNames": ["Увлажнитель", "Осушитель"]
            },
            "valveType": {
              "type": "string",
              "title": "Тип клапана",
              "enum": ["generic", "faucet", "irrigation", "shower"],
              "enumNames": ["Общий", "Кран", "Ирригация", "Душ"]
            },
            "commandOn": {
              "type": "string",
              "title": "Команда вкл."
            },
            "commandOff": {
              "type": "string",
              "title": "Команда выкл."
            },
            "commandLock": {
              "type": "string",
              "title": "Команда блокировки"
            },
            "commandUnlock": {
              "type": "string",
              "title": "Команда разблокировки"
            },
            "commandOpen": {
              "type": "string",
              "title": "Команда открытия"
            },
            "commandClose": {
              "type": "string",
              "title": "Команда закрытия"
            },
            "commandHumidity": {
              "type": "string",
              "title": "Команда изменения влажности"
            },
            "commandTemperature": {
              "type": "string",
              "title": "Команда изменения температуры"
            },
            "commandSync": {
              "type": "string",
              "title": "Команда синхронизации"
            },
            "syncSchedule": { "$ref": "#/definitions/schedule" },
            "resetOnRestart": {
              "type": "boolean",
              "title": "Сброс при перезапуске"
            },
            "enableWebhook": {
              "type": "boolean",
              "title": "Включить вебхук"
            },
            "disableLogging": {
              "type": "boolean",
              "title": "Отключить логирование"
            },
            "enableHistory": {
              "type": "boolean",
              "title": "Включить историю"
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "commandSync": {
                  }
                },
                "required": ["commandSync"]
              },
              "then": {
                "required": ["syncSchedule"]
              }
            }
          ]
        }
      },
      "verbose": {
        "type": "boolean"
      },
      "webhookConfig": {
        "type": "object",
        "properties": {
          "port": {
            "type": "number"
          },
          "keyPath": {
            "type": "string"
          },
          "certPath": {
            "type": "string"
          },
          "passphrase": {
            "type": "string"
          }
        }
      }
    }
  },
  "layout": [
    {
      "type": "array",
      "key": "accessories",
      "notitle": true,
      "items": [
        {
          "type": "fieldset",
          "expandable": true,
          "title": "Аксессуар",
          "items": [
            {
              "type": "div",
              "displayFlex": true,
              "flex-direction": "row",
              "notitle": true,
              "items": [
                {
                  "key": "accessories[].name",
                  "flex": "0 0 33%"
                },
                {
                  "key": "accessories[].type",
                  "flex": "0 0 33%"
                },
                {
                  "key": "accessories[].groupName",
                  "flex": "0 0 33%",
                  "condition": {
                    "functionBody": "return model.accessories?.[arguments[1]]?.protocol !== 'Matter';"
                  }
                }
              ]
            },
            {
              "type": "fieldset",
              "notitle": true,
              "condition": {
                "functionBody": "return model.accessories?.[arguments[1]]?.type;"
              },
              "items": [
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "condition": {
                    "functionBody": "return ['Lightbulb','Outlet','Switch'].includes(model.accessories?.[arguments[1]]?.type);"
                  },
                  "items": [
                    {
                      "key": "accessories[].protocol",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return ['Lightbulb','Outlet','Switch'].includes(model.accessories?.[arguments[1]]?.type);"
                      }
                    },
                    {
                      "key": "accessories[].defaultState",
                      "flex": "0 0 auto"
                    },
                    {
                      "key": "accessories[].sensor.type",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.protocol !== 'Matter';"
                      }
                    },
                    {
                      "key": "accessories[].sensor.behavior",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.sensor.type !== undefined;"
                      }
                    }
                  ]
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "condition": {
                    "functionBody": "return ['LockMechanism'].includes(model.accessories?.[arguments[1]]?.type);"
                  },
                  "items": [
                    {
                      "key": "accessories[].defaultLockState",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].sensor.type",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].sensor.behavior",
                      "flex": "0 0 33%",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.sensor.type !== undefined;"
                      }
                    }
                  ]
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "condition": {
                    "functionBody": "return ['Door', 'GarageDoorOpener', 'Window', 'WindowCovering'].includes(model.accessories?.[arguments[1]]?.type);"
                  },
                  "items": [
                    {
                      "key": "accessories[].defaultPosition",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].sensor.type",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].sensor.behavior",
                      "flex": "0 0 33%",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.sensor.type !== undefined;"
                      }
                    }
                  ]
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "items": [
                    {
                      "key": "accessories[].temperatureUnits",
                      "flex": "0 0 33%",
                      "condition": {
                        "functionBody": "return ['TemperatureSensor','Thermostat'].includes(model.accessories?.[arguments[1]]?.type);"
                      }
                    },
                    {
                      "key": "accessories[].defaultThermostatState",
                      "flex": "0 0 33%",
                      "condition": {
                        "functionBody": "return ['Thermostat'].includes(model.accessories?.[arguments[1]]?.type);"
                      }
                    }
                  ]
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "condition": {
                    "functionBody": "return ['Thermostat'].includes(model.accessories?.[arguments[1]]?.type);"
                  },
                  "items": [
                    {
                      "key": "accessories[].defaultTemperature",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].minimumTemperature",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].maximumTemperature",
                      "flex": "0 0 33%"
                    }
                  ]
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "condition": {
                    "functionBody": "return ['HumidifierDehumidifier'].includes(model.accessories?.[arguments[1]]?.type);"
                  },
                  "items": [
                    {
                      "key": "accessories[].defaultState",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].humidifierType",
                      "flex": "0 0 33%"
                    }
                  ]
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "condition": {
                    "functionBody": "return ['Valve'].includes(model.accessories?.[arguments[1]]?.type);"
                  },
                  "items": [
                    {
                      "key": "accessories[].defaultState",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].valveType",
                      "flex": "0 0 33%"
                    }
                  ]
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "items": [
                    {
                      "key": "accessories[].enableWebhook",
                      "flex": "0 0 auto"
                    },
                    {
                      "flex": "0 0 5%"
                    },
                    {
                      "key": "accessories[].enableHistory",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.protocol !== 'Matter' && ['Door', 'GarageDoorOpener', 'HumidifierDehumidifier', 'HumiditySensor', 'Outlet', 'Lightbulb', 'Switch', 'TemperatureSensor', 'Thermostat', 'Window', 'WindowCovering'].includes(model.accessories?.[arguments[1]]?.type);"
                      }
                    },
                    {
                      "flex": "0 0 5%"
                    },
                    {
                      "key": "accessories[].simulation.enabled",
                      "title": "Симулировать открытие/закрытие",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return ['Door', 'GarageDoorOpener', 'Window', 'WindowCovering'].includes(model.accessories?.[arguments[1]]?.type);"
                      }
                    },
                    {
                      "key": "accessories[].isDimmer",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.type === 'Lightbulb';"
                      }
                    }
                  ]
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "items": [
                    {
                      "key": "accessories[].disableLogging",
                      "flex": "0 0 auto"
                    },
                    {
                      "flex": "0 0 5%"
                    },
                    {
                      "key": "accessories[].resetOnRestart",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.type !== 'StatelessProgrammableSwitch';"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "fieldset",
              "title": "Расписание",
              "description": "Устанавливать аксессуар в противоположное (не по умолчанию) значение через заданные интервалы или в указанное время",
              "condition": {
                "functionBody": "const type = model.accessories?.[arguments[1]]?.type; return type && !['HumiditySensor','TemperatureSensor','Thermostat'].includes(type);"
              },
              "items": [
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "items": [
                    {
                      "key": "accessories[].schedule.type",
                      "flex": "0 0 auto"
                    },
                    {
                      "key": "accessories[].schedule.time",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return ['TIMEOUT', 'INTERVAL'].includes(model.accessories?.[arguments[1]]?.schedule?.type);"
                      }
                    },
                    {
                      "key": "accessories[].schedule.units",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return ['TIMEOUT', 'INTERVAL'].includes(model.accessories?.[arguments[1]]?.schedule?.type);"
                      }
                    },
                    {
                      "key": "accessories[].schedule.cron",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return model.accessories?.[arguments[1]]?.schedule?.type === 'CRON';"
                      }
                    },
                    {
                      "key": "accessories[].schedule.cronCustom",
                      "flex": "1 0 auto",
                      "condition": {
                          "functionBody": "return model.accessories?.[arguments[1]]?.schedule?.cron === 'CRON_CUSTOM';"
                      }
                    },
                    {
                      "key": "accessories[].schedule.offset",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.schedule?.type);"
                      }
                    },
                    {
                      "key": "accessories[].schedule.latitude",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.schedule?.type);"
                      }
                    },
                    {
                      "key": "accessories[].schedule.longitude",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.schedule?.type);"
                      }
                    }
                  ]
                },
                {
                  "key": "accessories[].schedule.random",
                  "condition": {
                      "functionBody": "const schedule = model.accessories?.[arguments[1]]?.schedule; return ['TIMEOUT', 'INTERVAL'].includes(schedule?.type) && schedule?.time;"
                  }
                }
              ]
            },
            {
              "type": "fieldset",
              "title": "Затухание",
              "description": "Уменьшает яркость за фиксированный период или постепенно снижает на 1% за каждый временной интервал",
              "condition": {
                "functionBody": "const accessory = model.accessories?.[arguments[1]]; return accessory?.isDimmer === true && !accessory?.autoReset;"
              },
              "items": [
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "items": [
                    {
                      "key": "accessories[].fadeOut.type",
                      "flex": "0 0 auto"
                    },
                    {
                      "key": "accessories[].fadeOut.time",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return model.accessories?.[arguments[1]]?.fadeOut?.type;"
                      }
                    },
                    {
                      "key": "accessories[].fadeOut.units",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return model.accessories?.[arguments[1]]?.fadeOut?.type;"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "fieldset",
              "title": "Автосброс",
              "description": "Возвращает аксессуар к значению по умолчанию",
              "condition": {
                "functionBody": "const accessory = model.accessories?.[arguments[1]]; const type = accessory?.type; return !accessory?.fadeOut && type && !['HumiditySensor','StatelessProgrammableSwitch','TemperatureSensor','Thermostat'].includes(type);"
              },
              "items": [
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "items": [
                    {
                      "key": "accessories[].autoReset.type",
                      "flex": "0 0 auto"
                    },
                    {
                      "key": "accessories[].autoReset.time",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return ['TIMEOUT', 'INTERVAL'].includes(model.accessories?.[arguments[1]]?.autoReset?.type);"
                      }
                    },
                    {
                      "key": "accessories[].autoReset.units",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return ['TIMEOUT', 'INTERVAL'].includes(model.accessories?.[arguments[1]]?.autoReset?.type);"
                      }
                    },
                    {
                      "key": "accessories[].autoReset.cron",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return model.accessories?.[arguments[1]]?.autoReset?.type === 'CRON';"
                      }
                    },
                    {
                      "key": "accessories[].autoReset.cronCustom",
                      "flex": "1 0 auto",
                      "condition": {
                          "functionBody": "return model.accessories?.[arguments[1]]?.autoReset?.cron === 'CRON_CUSTOM';"
                      }
                    },
                    {
                      "key": "accessories[].autoReset.offset",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.autoReset?.type);"
                      }
                    },
                    {
                      "key": "accessories[].autoReset.latitude",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.autoReset?.type);"
                      }
                    },
                    {
                      "key": "accessories[].autoReset.longitude",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.autoReset?.type);"
                      }
                    }
                  ]
                },
                {
                  "key": "accessories[].autoReset.random",
                  "condition": {
                      "functionBody": "const autoReset = model.accessories?.[arguments[1]]?.autoReset; return ['TIMEOUT', 'INTERVAL'].includes(autoReset?.type) && autoReset?.time;"
                  }
                }
              ]
            },
            {
              "type": "fieldset",
              "title": "Уведомление",
              "description": "Получать уведомление, когда аксессуар переходит в противоположное (не по умолчанию) значение. Подробнее см. в вики.",
              "condition": {
                "functionBody": "const type = model.accessories?.[arguments[1]]?.type; return type && !['HumiditySensor','TemperatureSensor','Thermostat'].includes(type);"
              },
              "items": [
                {
                  "type": "fieldset",
                  "items": [
                    {
                      "type": "div",
                      "displayFlex": true,
                      "flex-direction": "row",
                      "notitle": true,
                      "items": [
                        {
                          "key": "accessories[].notification.api",
                          "flex": "0 0 auto"
                        },
                        {
                          "key": "accessories[].notification.token",
                          "title": "Токен",
                          "flex": "1 0 auto",
                          "condition": {
                            "functionBody": "return model.accessories?.[arguments[1]]?.notification?.api === 'PINGIE_NOTIFY';"
                          }
                        },
                        {
                          "key": "accessories[].notification.token",
                          "title": "Ключ пользователя",
                          "flex": "1 0 auto",
                          "condition": {
                            "functionBody": "return model.accessories?.[arguments[1]]?.notification?.api === 'PUSHOVER';"
                          }
                        },
                        {
                          "key": "accessories[].notification.id",
                          "flex": "1 0 auto",
                          "title": "ID устройства или группы",
                          "condition": {
                            "functionBody": "return model.accessories?.[arguments[1]]?.notification?.api === 'PINGIE_NOTIFY';"
                          }
                        },
                        {
                          "key": "accessories[].notification.id",
                          "flex": "1 0 auto",
                          "title": "Токен приложения (необязательно)",
                          "condition": {
                            "functionBody": "return model.accessories?.[arguments[1]]?.notification?.api === 'PUSHOVER';"
                          }
                        }
                      ]
                    },
                    {
                      "type": "div",
                      "displayFlex": true,
                      "flex-direction": "row",
                      "notitle": true,
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.notification?.token || model.accessories?.[arguments[1]]?.notification?.id;"
                      },
                      "items": [
                        {
                          "key": "accessories[].notification.title",
                          "flex": "0 0 30%"
                        },
                        {
                          "key": "accessories[].notification.text",
                          "flex": "0 0 70%"
                        }
                      ]
                    },
                    {
                      "type": "div",
                      "displayFlex": true,
                      "flex-direction": "row",
                      "notitle": true,
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.notification?.token || model.accessories?.[arguments[1]]?.notification?.id;"
                      },
                      "items": [
                        {
                          "key": "accessories[].notification.resetTitle",
                          "flex": "0 0 30%"
                        },
                        {
                          "key": "accessories[].notification.resetText",
                          "flex": "0 0 70%"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "fieldset",
              "title": "Лимит времени",
              "description": "Ограничить суммарное время, когда аксессуар может быть в нештатном (не по умолчанию) состоянии, для каждого указанного периода",
              "condition": {
                "functionBody": "const type = model.accessories?.[arguments[1]]?.type; return type && !['HumiditySensor','StatelessProgrammableSwitch','TemperatureSensor','Thermostat'].includes(type);"
              },
              "items": [
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "items": [
                    {
                      "key": "accessories[].limiter.limit",
                      "flex": "0 0 33%"
                    },
                    {
                      "key": "accessories[].limiter.units",
                      "flex": "0 0 33%",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.limiter?.limit;"
                      }
                    },
                    {
                      "key": "accessories[].limiter.period",
                      "flex": "0 0 33%",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1]]?.limiter?.limit;"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "fieldset",
              "title": "Условия активации",
              "description": "Устанавливает аксессуар в противоположное (не по умолчанию) значение при выполнении указанных условий",
              "condition": {
                "functionBody": "const type = model.accessories?.[arguments[1]]?.type; return type && !['HumiditySensor','TemperatureSensor','Thermostat'].includes(type);"
              },
              "items": [
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "items": [
                    {
                      "key": "accessories[].conditions.operator",
                      "flex": "0 0 auto"
                    }
                  ]
                }
              ]
            },
            {
              "type": "array",
              "title": "Условие",
              "notitle": true,
              "condition": {
                "functionBody": "return model.accessories?.[arguments[1]]?.conditions?.operator;"
              },
              "key": "accessories[].conditions.operands",
              "items": [
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "items": [
                    {
                      "key": "accessories[].conditions.operands[].type",
                      "flex": "0 0 auto"
                    },
                    {
                      "key": "accessories[].conditions.operands[].accessoryId",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1][0]]?.conditions?.operands?.[arguments[1][1]]?.type === 'ACCESSORY';"
                      }
                    },
                    {
                      "key": "accessories[].conditions.operands[].accessoryState",
                      "flex": "0 0 auto",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1][0]]?.conditions?.operands?.[arguments[1][1]]?.accessoryId;"
                      }
                    },
                    {
                      "key": "accessories[].conditions.operands[].pattern",
                      "flex": "1 0 auto",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1][0]]?.conditions?.operands?.[arguments[1][1]]?.type === 'LOG';"
                      }
                    },
                    {
                      "key": "accessories[].conditions.operands[].pingHost",
                      "flex": "0 0 28%",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1][0]]?.conditions?.operands?.[arguments[1][1]]?.type === 'PING';"
                      }
                    },
                    {
                      "key": "accessories[].conditions.operands[].pingAvailability",
                      "flex": "0 0 22%",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1][0]]?.conditions?.operands?.[arguments[1][1]]?.type === 'PING';"
                      }
                    },
                    {
                      "key": "accessories[].conditions.operands[].pingInterval",
                      "flex": "0 0 10%",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1][0]]?.conditions?.operands?.[arguments[1][1]]?.type === 'PING';"
                      }
                    },
                    {
                      "key": "accessories[].conditions.operands[].pingUnits",
                      "flex": "0 0 20%",
                      "condition": {
                        "functionBody": "return model.accessories?.[arguments[1][0]]?.conditions?.operands?.[arguments[1][1]]?.type === 'PING';"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "fieldset",
              "title": "Команды",
              "description": "Выполнять произвольные команды (например, curl) при изменении состояния аксессуара",
              "condition": {
                "functionBody": "return model.accessories?.[arguments[1]]?.type;"
              },
              "items": [
                {
                  "key": "accessories[].commandOn",
                  "condition": {
                    "functionBody": "return ['HumidifierDehumidifier','Lightbulb','Outlet','StatelessProgrammableSwitch','Switch','Thermostat','Valve'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "key": "accessories[].commandOff",
                  "condition": {
                    "functionBody": "return ['HumidifierDehumidifier','Lightbulb','Outlet','Switch','Thermostat','Valve'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "key": "accessories[].commandLock",
                  "condition": {
                    "functionBody": "return ['LockMechanism'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "key": "accessories[].commandUnlock",
                  "condition": {
                    "functionBody": "return ['LockMechanism'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "key": "accessories[].commandOpen",
                  "condition": {
                    "functionBody": "return ['Door', 'GarageDoorOpener', 'Window', 'WindowCovering'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "key": "accessories[].commandClose",
                  "condition": {
                    "functionBody": "return ['Door', 'GarageDoorOpener', 'Window', 'WindowCovering'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "key": "accessories[].commandHumidity",
                  "condition": {
                    "functionBody": "return ['HumiditySensor'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "key": "accessories[].commandTemperature",
                  "condition": {
                    "functionBody": "return ['TemperatureSensor','Thermostat'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "key": "accessories[].commandSync",
                  "condition": {
                    "functionBody": "return !['StatelessProgrammableSwitch'].includes(model.accessories?.[arguments[1]]?.type);"
                  }
                },
                {
                  "type": "div",
                  "displayFlex": true,
                  "flex-direction": "row",
                  "notitle": true,
                  "condition": {
                    "functionBody": "return model.accessories?.[arguments[1]]?.commandSync !== undefined"
                  },
                  "items": [
                    {
                      "key": "accessories[].syncSchedule.type",
                      "title": "Расписание синхронизации",
                      "flex": "0 0 auto"
                    },
                    {
                      "key": "accessories[].syncSchedule.time",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return ['TIMEOUT', 'INTERVAL'].includes(model.accessories?.[arguments[1]]?.syncSchedule?.type);"
                      }
                    },
                    {
                      "key": "accessories[].syncSchedule.units",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return ['TIMEOUT', 'INTERVAL'].includes(model.accessories?.[arguments[1]]?.syncSchedule?.type);"
                      }
                    },
                    {
                      "key": "accessories[].syncSchedule.cron",
                      "flex": "0 0 auto",
                      "condition": {
                          "functionBody": "return model.accessories?.[arguments[1]]?.syncSchedule?.type === 'CRON';"
                      }
                    },
                    {
                      "key": "accessories[].syncSchedule.cronCustom",
                      "flex": "1 0 auto",
                      "condition": {
                          "functionBody": "return model.accessories?.[arguments[1]]?.syncSchedule?.cron === 'CRON_CUSTOM';"
                      }
                    },
                    {
                      "key": "accessories[].syncSchedule.offset",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.syncSchedule?.type);"
                      }
                    },
                    {
                      "key": "accessories[].syncSchedule.latitude",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.syncSchedule?.type);"
                      }
                    },
                    {
                      "key": "accessories[].syncSchedule.longitude",
                      "flex": "0 1 auto",
                      "condition": {
                          "functionBody": "return ['SUNRISE', 'SUNSET', 'DAWN', 'DUSK', 'GOLDEN_HOUR', 'NIGHT'].includes(model.accessories?.[arguments[1]]?.syncSchedule?.type);"
                      }
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}