{
  "code_name": "ddns_update",
  "unique_prefix": "DDNS",
  "plugin_type": "system",
  "enabled": true,
  "data_filters": [
    {
      "compare_column": "Object_PrimaryID",
      "compare_operator": "==",
      "compare_field_id": "txtMacFilter",
      "compare_js_template": "'{value}'.toString()",
      "compare_use_quotes": true
    }
  ],
  "data_source": "script",
  "show_ui": true,
  "localized": ["display_name", "description", "icon"],
  "display_name": [
    {
      "language_code": "en_us",
      "string": "DDNS update"
    },
    {
      "language_code": "de_de",
      "string": "DDNS-Aktualisierung"
    }
  ],
  "icon": [
    {
      "language_code": "en_us",
      "string": "<i class=\"fa-solid fa-globe\"></i>"
    },
    {
      "language_code": "de_de",
      "string": "<i class=\"fa-solid fa-globe\"></i>"
    }
  ],
  "description": [
    {
      "language_code": "en_us",
      "string": "A plugin update the DDNS record."
    },
    {
      "language_code": "de_de",
      "string": "Ein Plugin zur regelmäßigen Aktualisierung eines DynDNS-Eintrags."
    }
  ],
  "params": [
    {
      "name": "prev_ip",
      "type": "sql",
      "value": "SELECT devLastIP FROM Devices WHERE devMac = 'Internet' "
    },
    {
      "name": "DDNS_UPDATE_URL",
      "type": "setting",
      "value": "DDNS_UPDATE_URL"
    },
    {
      "name": "DDNS_USER",
      "type": "setting",
      "value": "DDNS_USER"
    },
    {
      "name": "DDNS_PASSWORD",
      "type": "setting",
      "value": "DDNS_PASSWORD"
    },
    {
      "name": "DDNS_DOMAIN",
      "type": "setting",
      "value": "DDNS_DOMAIN"
    }
  ],
  "settings": [
    {
      "function": "RUN",
      "events": ["run"],
      "type": {
        "dataType": "string",
        "elements": [
          { "elementType": "select", "elementOptions": [], "transformers": [] }
        ]
      },
      "default_value": "disabled",
      "options": ["disabled", "once", "schedule", "always_after_scan"],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "When to run"
        },
        {
          "language_code": "es_es",
          "string": "Cuándo ejecutar"
        },
        {
          "language_code": "de_de",
          "string": "Wann ausführen"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "When the plugin should run. An hourly or daily <code>SCHEDULE</code> is a good option."
        },
        {
          "language_code": "de_de",
          "string": "Wann das Plugin ausgeführt werden soll. Eine stündliche oder tägliche <code>SCHEDULE</code> wird empfohlen."
        }
      ]
    },
    {
      "function": "CMD",
      "type": {
        "dataType": "string",
        "elements": [
          {
            "elementType": "input",
            "elementOptions": [{ "readonly": "true" }],
            "transformers": []
          }
        ]
      },
      "default_value": "python3 /app/front/plugins/ddns_update/script.py prev_ip={prev_ip}  DDNS_UPDATE_URL={DDNS_UPDATE_URL} DDNS_USER={DDNS_USER} DDNS_PASSWORD={DDNS_PASSWORD} DDNS_DOMAIN={DDNS_DOMAIN} ",
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Command"
        },
        {
          "language_code": "es_es",
          "string": "Comando"
        },
        {
          "language_code": "de_de",
          "string": "Befehl"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "Command to run. This can not be changed"
        },
        {
          "language_code": "es_es",
          "string": "Comando a ejecutar. Esto no se puede cambiar"
        },
        {
          "language_code": "de_de",
          "string": "Befehl zum Ausführen. Dies kann nicht geändert werden"
        }
      ]
    },
    {
      "function": "RUN_SCHD",
      "type": {
        "dataType": "string",
        "elements": [
          { "elementType": "input", "elementOptions": [], "transformers": [] }
        ]
      },
      "default_value": "*/5 * * * *",
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Schedule"
        },
        {
          "language_code": "es_es",
          "string": "Schedule"
        },
        {
          "language_code": "de_de",
          "string": "Zeitplan"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "Only enabled if you select <code>schedule</code> in the <a href=\"#DDNS_RUN\"><code>DDNS_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
        },
        {
          "language_code": "es_es",
          "string": "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#DDNS_RUN\"><code>DDNS_RUN</code></a>. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, ingresar <code>0 4 * * *</code> ejecutará el escaneo después de las 4 a.m. en el <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ código> que configuró arriba</a>. Se ejecutará la PRÓXIMA vez que pase el tiempo."
        },
        {
          "language_code": "de_de",
          "string": "Nur aktiv, wenn <code>schedule</code> in der <a href=\"#DDNS_RUN\"><code>DDNS_RUN</code> Einstellung</a> ausgewählt wurde. Sichergehen, dass das Intervall in einem korrekten cron-ähnlichen Format angegeben wurde (z.B. auf <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a> testen). <code>0 4 * * *</code> würde den Scan täglich um 4 Uhr in der <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\">oben ausgewählten <code>TIMEZONE</code></a> starten. Wird erst beim NÄCHSTEN Intervall ausgeführt."
        }
      ]
    },
    {
      "function": "RUN_TIMEOUT",
      "type": {
        "dataType": "integer",
        "elements": [
          {
            "elementType": "input",
            "elementOptions": [{ "type": "number" }],
            "transformers": []
          }
        ]
      },
      "default_value": 30,
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Run timeout"
        },
        {
          "language_code": "es_es",
          "string": "Tiempo límite de ejecución"
        },
        {
          "language_code": "de_de",
          "string": "Zeitlimit"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted."
        },
        {
          "language_code": "es_es",
          "string": "Tiempo máximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela."
        },
        {
          "language_code": "de_de",
          "string": "Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei Überschreitung dieser Zeit wird das Skript abgebrochen."
        }
      ]
    },
    {
      "function": "DOMAIN",
      "type": {
        "dataType": "string",
        "elements": [
          { "elementType": "input", "elementOptions": [], "transformers": [] }
        ]
      },
      "default_value": "your_domain.freeddns.org",
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "DynDNS domain URL"
        },
        {
          "language_code": "es_es",
          "string": "URL del dominio DynDNS"
        },
        {
          "language_code": "de_de",
          "string": "DynDNS Domain URL"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "DynDNS host URL (do not include http:// or https://)."
        },
        {
          "language_code": "es_es",
          "string": "URL del host DynDNS (no incluya http:// o https://)."
        },
        {
          "language_code": "de_de",
          "string": "DynDNS Host URL (do not include http:// or https://)."
        }
      ]
    },
    {
      "function": "USER",
      "type": {
        "dataType": "string",
        "elements": [
          { "elementType": "input", "elementOptions": [], "transformers": [] }
        ]
      },
      "default_value": "dynu_user",
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "DynDNS user"
        },
        {
          "language_code": "es_es",
          "string": "Usuario de DynDNS"
        },
        {
          "language_code": "de_de",
          "string": "DynDNS Benutzer"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "The username used to login to the DynDNS service (sometimes a full email address)."
        },
        {
          "language_code": "es_es",
          "string": "El nombre de usuario utilizado para iniciar sesión en el servicio DynDNS (a veces, una dirección de correo electrónico completa)."
        },
        {
          "language_code": "de_de",
          "string": "Benutzername, welcher zum Login beim DynDNS-Service verwendet wird (manchmal die E-Mail-Adresse)."
        }
      ]
    },
    {
      "function": "PASSWORD",
      "type": {
        "dataType": "string",
        "elements": [
          {
            "elementType": "input",
            "elementOptions": [{ "type": "password" }],
            "transformers": []
          }
        ]
      },
      "default_value": "A0000000B0000000C0000000D0000000",
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "DynDNS password"
        },
        {
          "language_code": "es_es",
          "string": "Contraseña de DynDNS"
        },
        {
          "language_code": "de_de",
          "string": "DynDNS Passwort"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "The DynDNS service access password"
        },
        {
          "language_code": "es_es",
          "string": "La contraseña de acceso al servicio DynDNS."
        },
        {
          "language_code": "de_de",
          "string": "Passwort, welches zum Login beim DynDNS-Service verwendet wird."
        }
      ]
    },
    {
      "function": "UPDATE_URL",
      "type": {
        "dataType": "string",
        "elements": [
          { "elementType": "input", "elementOptions": [], "transformers": [] }
        ]
      },
      "default_value": "https://api.dynu.com/nic/update?",
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "DynDNS update URL"
        },
        {
          "language_code": "es_es",
          "string": "URL de actualización de DynDNS"
        },
        {
          "language_code": "de_de",
          "string": "DynDNS Aktualisierungs-URL"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "Update URL starting with <code>http://</code> or <code>https://</code>."
        },
        {
          "language_code": "es_es",
          "string": "Actualice la URL que comienza con <code>http://</code> o <code>https://</code>."
        },
        {
          "language_code": "de_de",
          "string": "Aktualisierungs-URL beginnend mit <code>http://</code> oder <code>https://</code>."
        }
      ]
    },
    {
      "function": "WATCH",
      "type": {
        "dataType": "array",
        "elements": [
          {
            "elementType": "select",
            "elementOptions": [{ "multiple": "true" }],
            "transformers": []
          }
        ]
      },
      "default_value": ["Watched_Value1"],
      "options": [
        "Watched_Value1",
        "Watched_Value2",
        "Watched_Value3",
        "Watched_Value4"
      ],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Watched"
        },
        {
          "language_code": "es_es",
          "string": "Visto"
        },
        {
          "language_code": "de_de",
          "string": "Überwacht"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Previous IP (not recommended)</li><li><code>Watched_Value2</code> unused</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>"
        },
        {
          "language_code": "de_de",
          "string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>Watched_Value1</code> ist die Vorige IP (nicht empfohlen)</li><li><code>Watched_Value2</code> ist nicht in Verwendung</li><li><code>Watched_Value3</code> ist nicht in Verwendung </li><li><code>Watched_Value4</code> ist nicht in Verwendung </li></ul>"
        }
      ]
    },
    {
      "function": "REPORT_ON",
      "type": {
        "dataType": "array",
        "elements": [
          {
            "elementType": "select",
            "elementOptions": [{ "multiple": "true" }],
            "transformers": []
          }
        ]
      },
      "default_value": ["new", "watched-changed"],
      "options": [
        "new",
        "watched-changed",
        "watched-not-changed",
        "missing-in-last-scan"
      ],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Report on"
        },
        {
          "language_code": "es_es",
          "string": "Informar sobre"
        },
        {
          "language_code": "de_de",
          "string": "Benachrichtige wenn"
        }
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed."
        },
        {
          "language_code": "es_es",
          "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>Watched_ValueN</code> seleccionadas cambiaron."
        },
        {
          "language_code": "de_de",
          "string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>Watched_ValueN</code>-Spalte hat sich geändert."
        }
      ]
    }
  ],
  "database_column_definitions": [
    {
      "column": "Index",
      "css_classes": "col-sm-2",
      "show": true,
      "type": "none",
      "default_value": "",
      "options": [],
      "localized": ["name"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Index"
        }
      ]
    },
    {
      "column": "Object_PrimaryID",
      "css_classes": "col-sm-2",
      "show": true,
      "type": "device_name_mac",
      "default_value": "",
      "options": [],
      "localized": ["name"],
      "name": [
        {
          "language_code": "en_us",
          "string": "MAC"
        },
        {
          "language_code": "es_es",
          "string": "MAC"
        },
        {
          "language_code": "de_de",
          "string": "MAC"
        }
      ]
    },
    {
      "column": "Object_SecondaryID",
      "css_classes": "col-sm-2",
      "show": true,
      "type": "device_ip",
      "default_value": "",
      "options": [],
      "localized": ["name"],
      "name": [
        {
          "language_code": "en_us",
          "string": "IP"
        },
        {
          "language_code": "es_es",
          "string": "IP"
        },
        {
          "language_code": "de_de",
          "string": "IP"
        }
      ]
    },
    {
      "column": "Watched_Value1",
      "css_classes": "col-sm-2",
      "show": true,
      "type": "label",
      "default_value": "",
      "options": [],
      "localized": ["name"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Extra"
        },
        {
          "language_code": "de_de",
          "string": "Extra"
        }
      ]
    },
    {
      "column": "Dummy",
      "mapped_to_column_data": {
        "value": "DDNS"
      },
      "css_classes": "col-sm-2",
      "show": true,
      "type": "label",
      "default_value": "",
      "options": [],
      "localized": ["name"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Scan method"
        },
        {
          "language_code": "es_es",
          "string": "Método de escaneo"
        },
        {
          "language_code": "de_de",
          "string": "Scanmethode"
        }
      ]
    },
    {
      "column": "DateTimeCreated",
      "css_classes": "col-sm-2",
      "show": true,
      "type": "label",
      "default_value": "",
      "options": [],
      "localized": ["name"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Created"
        },
        {
          "language_code": "es_es",
          "string": "Creado"
        },
        {
          "language_code": "de_de",
          "string": "Erstellt"
        }
      ]
    },
    {
      "column": "DateTimeChanged",
      "css_classes": "col-sm-2",
      "show": true,
      "type": "label",
      "default_value": "",
      "options": [],
      "localized": ["name"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Changed"
        },
        {
          "language_code": "es_es",
          "string": "Cambiado"
        },
        {
          "language_code": "de_de",
          "string": "Geändert"
        }
      ]
    },
    {
      "column": "Status",
      "css_classes": "col-sm-1",
      "show": true,
      "type": "replace",
      "default_value": "",
      "options": [
        {
          "equals": "watched-not-changed",
          "replacement": "<div style='text-align:center'><i class='fa-solid fa-square-check'></i><div></div>"
        },
        {
          "equals": "watched-changed",
          "replacement": "<div style='text-align:center'><i class='fa-solid fa-triangle-exclamation'></i></div>"
        },
        {
          "equals": "new",
          "replacement": "<div style='text-align:center'><i class='fa-solid fa-circle-plus'></i></div>"
        },
        {
          "equals": "missing-in-last-scan",
          "replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
        }
      ],
      "localized": ["name"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Status"
        },
        {
          "language_code": "es_es",
          "string": "Estado"
        },
        {
          "language_code": "de_de",
          "string": "Status"
        }
      ]
    }
  ]
}
