Skip to content

Commit

Permalink
(simatec) Gotify Notication added
Browse files Browse the repository at this point in the history
  • Loading branch information
simatec committed Dec 10, 2023
1 parent 267184b commit c654ca5
Show file tree
Hide file tree
Showing 19 changed files with 324 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ When the adapter crashes or another Code error happens, this error message that
## Changelog
<!-- ### **WORK IN PROGRESS** -->
### **WORK IN PROGRESS**
* (simatec) Gotify Notication added
* (simatec) dependencies updated

### 2.9.5 (2023-11-29)
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Google Drive Pfad für ioBroker Sicherung",
"Google Drive path": "Google Drive Pfad",
"Google Drive: Yes": "Google Drive: Ja",
"Gotify": "Gotify",
"Gotify instance": "Gotify Instanz",
"Grafana API-Key or Service Token": "Grafana API-Key oder Service Token",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Grafana Hostname / IP",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Google Drive path for ioBroker backup",
"Google Drive path": "Google Drive path",
"Google Drive: Yes": "Google Drive: Yes",
"Gotify": "Gotify",
"Gotify instance": "Gotify instance",
"Grafana API-Key or Service Token": "Grafana API-Key or Service Token",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Grafana host name / IP",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/es/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Ruta de Google Drive para copia de seguridad de iobroker",
"Google Drive path": "Ruta de acceso de Google Drive",
"Google Drive: Yes": "Google Drive: si",
"Gotify": "Gotify",
"Gotify instance": "Caso Gotify",
"Grafana API-Key or Service Token": "Grafana API-Key o Token de servicio",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Nombre de host / IP de Grafana",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/fr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Google Drive Path pour la sauvegarde iobroker",
"Google Drive path": "Chemin Google Drive",
"Google Drive: Yes": "Google Drive: oui",
"Gotify": "Gotify",
"Gotify instance": "Gotify instance",
"Grafana API-Key or Service Token": "Grafana API-Key ou jeton de service",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Nom d'hôte / IP Grafana",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/it/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Percorso di Google Drive per il backup di iobroker",
"Google Drive path": "Percorso di Google Drive",
"Google Drive: Yes": "Google Drive: sì",
"Gotify": "Gotify",
"Gotify instance": "Esempio di guadagno",
"Grafana API-Key or Service Token": "Token API-Key o servizio Grafana",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Nome host / IP Grafana",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/nl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Google Drive Path voor iobroker-back-up",
"Google Drive path": "Google Drive-pad",
"Google Drive: Yes": "Google Drive: ja",
"Gotify": "Gotify",
"Gotify instance": "Vertaling:",
"Grafana API-Key or Service Token": "Grafana API-Key of Service Token",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Grafana hostnaam / IP",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/pl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Ścieżka do Dysku Google do tworzenia kopii zapasowych iobroker",
"Google Drive path": "Ścieżka Dysku Google",
"Google Drive: Yes": "Dysk Google: Tak",
"Gotify": "Gotify",
"Gotify instance": "Gotyfikować",
"Grafana API-Key or Service Token": "Grafana API-Key or Service Token (ang.)",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Nazwa / adres IP hosta Grafana",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/pt/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Caminho do Google Drive para backup do iobroker",
"Google Drive path": "Caminho do Google Drive",
"Google Drive: Yes": "Google Drive: sim",
"Gotify": "Gotify",
"Gotify instance": "Exemplo de identificação",
"Grafana API-Key or Service Token": "Gráfico API-Key ou Token de Serviço",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Nome / IP do host Grafana",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/ru/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Путь для резервного копирования ioBroker",
"Google Drive path": "Путь",
"Google Drive: Yes": "Google Диск: Да",
"Gotify": "Gotify",
"Gotify instance": "Gotify пример",
"Grafana API-Key or Service Token": "Grafana API-Key или сервисный токен",
"Grafana Backup": "Grafana",
"Grafana Hostname": "Имя хоста / IP",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/uk/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "Шлях Google Drive для резервного копіювання ioBroker",
"Google Drive path": "Шлях Google Drive",
"Google Drive: Yes": "Диск Google: так",
"Gotify": "Gotify",
"Gotify instance": "Зареєструватися",
"Grafana API-Key or Service Token": "API-ключ або маркер служби Grafana",
"Grafana Backup": "Графана",
"Grafana Hostname": "Ім'я хосту Grafana / IP",
Expand Down
2 changes: 2 additions & 0 deletions admin/i18n/zh-cn/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"Google Drive Path for iobroker backup": "ioBroker 备份的 Google Drive 路径",
"Google Drive path": "谷歌云端硬盘路径",
"Google Drive: Yes": "谷歌驱动器:是的",
"Gotify": "Gotify",
"Gotify instance": "评 注",
"Grafana API-Key or Service Token": "Grafana API 密钥或服务令牌",
"Grafana Backup": "格拉法纳",
"Grafana Hostname": "Grafana 主机名/IP",
Expand Down
41 changes: 34 additions & 7 deletions admin/index_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -817,13 +817,14 @@ <h6 class="translate title" style="background-color:#174475; font-size: 0.9rem;
<div class="row">
<div class="input-field col s11 m2">
<select class="value" id="notificationsType">
<option value="Telegram" class="translate">Telegram</option>
<option value="E-Mail" class="translate">E-Mail</option>
<option value="Pushover" class="translate">Pushover</option>
<option value="WhatsApp" class="translate">WhatsApp</option>
<option value="Signal" class="translate">Signal</option>
<option value="Matrix" class="translate">Matrix</option>
<option value="Discord" class="translate">Discord</option>
<option value="E-Mail" class="translate">E-Mail</option>
<option value="Discord" class="translate">Discord</option>
<option value="Gotify" class="translate">Gotify</option>
<option value="Matrix" class="translate">Matrix</option>
<option value="Pushover" class="translate">Pushover</option>
<option value="Signal" class="translate">Signal</option>
<option value="Telegram" class="translate">Telegram</option>
<option value="WhatsApp" class="translate">WhatsApp</option>
</select>
<label for="notificationsType" class="translate">notifications type</label>
</div>
Expand Down Expand Up @@ -889,6 +890,32 @@ <h6 class="translate title" style="background-color:#174475; font-size: 0.9rem;
<label for="whatsappOnlyError" class="translate">Notification only on errors</label>
</div>
</div>
<!-- Gotify -->
<div class="row gotify">
<div class="input-field col s12 m6 l3 gotify">
<select id="gotifyInstance" class="value"></select>
<label for="gotifyInstance" class="translate">Gotify instance</label>
</div>
<div class="input-field col s12 m6 l3 gotify">
<select class="value" id="gotifyNoticeType">
<option value="longGotifyNotice" class="translate">Long Notifications</option>
<option value="shortGotifyNotice" class="translate">Short Notifications</option>
</select>
<label class="translate" for="gotifyNoticeType">Notification Style</label>
</div>
</div>
<div class="row gotify">
<div class="input-field col s12 m6 l3 gotify">
<input type="number" class="value" id="gotifyWaitToSend" min="0" max="20"/>
<label for="gotifyWaitToSend" class="translate">Waiting for the send (seconds)</label>
</div>
</div>
<div class="row gotify">
<div class="input-field col s12 m6 l3 gotify">
<input class="value" id="gotifyOnlyError" type="checkbox"/>
<label for="gotifyOnlyError" class="translate">Notification only on errors</label>
</div>
</div>
<!-- Signal -->
<div class="row signal">
<div class="input-field col s12 m6 l3 signal">
Expand Down
20 changes: 20 additions & 0 deletions admin/index_m.js
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,10 @@ function load(settings, onChange) {
fillInstances('whatsappInstance', instances, settings['whatsappInstance'], 'whatsapp-cmb');
});

getAdapterInstances('gotify', function (instances) {
fillInstances('gotifyInstance', instances, settings['gotifyInstance'], 'gotify');
});

getAdapterInstances('signal-cmb', function (instances) {
fillInstances('signalInstance', instances, settings['signalInstance'], 'signal-cmb');
});
Expand Down Expand Up @@ -1583,6 +1587,7 @@ function showHideSettings(settings) {
$('.email').hide();
$('.pushover').hide();
$('.whatsapp').hide();
$('.gotify').hide();
$('.signal').hide();
$('.matrix').hide();
$('.discord').hide();
Expand All @@ -1591,6 +1596,7 @@ function showHideSettings(settings) {
$('.telegram').hide();
$('.pushover').hide();
$('.whatsapp').hide();
$('.gotify').hide();
$('.signal').hide();
$('.matrix').hide();
$('.discord').hide();
Expand All @@ -1599,13 +1605,15 @@ function showHideSettings(settings) {
$('.telegram').hide();
$('.email').hide();
$('.whatsapp').hide();
$('.gotify').hide();
$('.signal').hide();
$('.matrix').hide();
$('.discord').hide();
$('.pushover').show();
} else if ($(this).val() === 'WhatsApp') {
$('.telegram').hide();
$('.email').hide();
$('.gotify').hide();
$('.pushover').hide();
$('.signal').hide();
$('.matrix').hide();
Expand All @@ -1614,6 +1622,7 @@ function showHideSettings(settings) {
} else if ($(this).val() === 'Signal') {
$('.telegram').hide();
$('.email').hide();
$('.gotify').hide();
$('.pushover').hide();
$('.whatsapp').hide();
$('.matrix').hide();
Expand All @@ -1622,6 +1631,7 @@ function showHideSettings(settings) {
} else if ($(this).val() === 'Matrix') {
$('.telegram').hide();
$('.email').hide();
$('.gotify').hide();
$('.pushover').hide();
$('.whatsapp').hide();
$('.signal').hide();
Expand All @@ -1630,11 +1640,21 @@ function showHideSettings(settings) {
} else if ($(this).val() === 'Discord') {
$('.telegram').hide();
$('.email').hide();
$('.gotify').hide();
$('.pushover').hide();
$('.whatsapp').hide();
$('.signal').hide();
$('.matrix').hide();
$('.discord').show();
} else if ($(this).val() === 'Gotify') {
$('.telegram').hide();
$('.email').hide();
$('.discord').hide();
$('.pushover').hide();
$('.whatsapp').hide();
$('.signal').hide();
$('.matrix').hide();
$('.gotify').show();
}
}).trigger('change');

Expand Down
2 changes: 2 additions & 0 deletions admin/words.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@
"whatsappNoticeType": "longWhatsappNotice",
"whatsappOnlyError": false,
"whatsappWaitToSend": 0,
"gotifyInstance": "gotify.0",
"gotifyNoticeType": "longGotifyNotice",
"gotifyOnlyError": false,
"gotifyWaitToSend": 0,
"signalInstance": "signal-cmb.0",
"signalNoticeType": "longSignalNotice",
"signalOnlyError": false,
Expand Down
13 changes: 13 additions & 0 deletions lib/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ function executeScripts(adapter, config, callback, scripts, code) {
}
break;

case 'gotify':
if (config[name] && config[name].enabled && config[name].notificationsType === 'Gotify') {
func = scripts[name];
try {
options = JSON.parse(JSON.stringify(config));
options[name].time = tools.getTimeString(options[name].systemLang); // provide date
} catch (e) {
callback('cannot parse config for gotify!!');
}
}
break;

case 'signal':
if (config[name] && config[name].enabled && config[name].notificationsType === 'Signal') {
func = scripts[name];
Expand Down Expand Up @@ -311,6 +323,7 @@ function executeScripts(adapter, config, callback, scripts, code) {
if (_options.pushover && !_options.pushover.enabled) delete _options.pushover;
if (_options.email && !_options.email.enabled) delete _options.email;
if (_options.whatsapp && !_options.whatsapp.enabled) delete _options.whatsapp;
if (_options.gotify && !_options.gotify.enabled) delete _options.gotify;
if (_options.discord && !_options.discord.enabled) delete _options.discord;
if (_options.dropbox && !_options.dropbox.enabled) delete _options.dropbox;
if (_options.onedrive && !_options.onedrive.enabled) delete _options.onedrive;
Expand Down
Loading

0 comments on commit c654ca5

Please sign in to comment.