diff --git a/.eslintignore b/.eslintignore index 396d8e1..a7bd61d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ **/.eslintrc.js -admin/words.js \ No newline at end of file +admin/words.js +test/*.js \ No newline at end of file diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index c9b5329..baeae23 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Check if PR should be auto-merged uses: ahmadnassri/action-dependabot-auto-merge@v2 diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 172d009..9ecee7c 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: ioBroker/testing-action-check@v1 with: - node-version: '18.x' + node-version: '20.x' # Uncomment the following line if your adapter cannot be installed using 'npm ci' # install-command: 'npm install' lint: true @@ -40,7 +40,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18.x, 20.x] os: [ubuntu-latest, windows-latest, macos-latest] steps: @@ -74,7 +74,7 @@ jobs: # steps: # - uses: ioBroker/testing-action-deploy@v1 # with: -# node-version: '18.x' +# node-version: '20.x' # # Uncomment the following line if your adapter cannot be installed using 'npm ci' # # install-command: 'npm install' # npm-token: ${{ secrets.NPM_TOKEN }} diff --git a/io-package.json b/io-package.json index d204ab6..97bb76f 100644 --- a/io-package.json +++ b/io-package.json @@ -95,7 +95,6 @@ "zh-cn": "作为消息对象的扩展有效载荷可能性" } }, - "title": "Notification for AndroidTv and FireTV", "titleLang": { "en": "Notification for AndroidTv and FireTV", "de": "Benachrichtigung für AndroidTv und FireTV", @@ -141,6 +140,7 @@ "extIcon": "https://raw.githubusercontent.com/DNAngelX/ioBroker.notificationforandroidtv/main/admin/notificationforandroidtv.png", "readme": "https://github.com/DNAngelX/ioBroker.notificationforandroidtv/blob/main/README.md", "loglevel": "info", + "tier": 2, "mode": "daemon", "type": "messaging", "compact": true, @@ -151,7 +151,7 @@ }, "dependencies": [ { - "js-controller": ">=3.3.22" + "js-controller": ">=5.0.19" } ], "globalDependencies": [ diff --git a/main.js b/main.js index 721ea7e..3ccfc78 100644 --- a/main.js +++ b/main.js @@ -7,7 +7,7 @@ // The adapter-core module gives you access to the core ioBroker functions // you need to create an adapter const utils = require("@iobroker/adapter-core"); -const adapter = utils.adapter("notificationforandroidtv"); +//const adapter = utils.adapter("notificationforandroidtv"); -> use this const axios = require("axios"); // Load your modules here, e.g.: @@ -31,62 +31,62 @@ class Notificationforandroidtv extends utils.Adapter { } async writeChannelDataToIoBroker(channelParentPath, id ,channelName, value, channelType, channelRole, createObjectInitally,createObjectInitallyUnit,createObjectInitallyStates,readOnly) { - - if(createObjectInitally && createObjectInitallyUnit){ - await this.setObjectNotExistsAsync(channelParentPath + "." + id, { - type: "state", - common: { - name: channelName, - type: channelType, - role: channelRole, - unit: createObjectInitallyUnit, - read: true, - write: readOnly ? false : true, - - }, - native: {}, - }); - } else if(createObjectInitally && createObjectInitallyStates){ - await this.setObjectNotExistsAsync(channelParentPath + "." + id, { - type: "state", - common: { - name: channelName, - type: channelType, - role: channelRole, - states: createObjectInitallyStates, - read: true, - write: readOnly ? false : true, - - }, - native: {}, - }); - } else if(createObjectInitally){ - await this.setObjectNotExistsAsync(channelParentPath + "." + id, { - type: "state", - common: { - name: channelName, - type: channelType, - role: channelRole, - read: true, - write: readOnly ? false : true, - - }, - native: {}, - }); - - - } - - let stateVal = await adapter.getStateAsync(`${channelParentPath}.${id}`); - stateVal ? stateVal = stateVal.val : ""; - - - if((value != undefined || value != null) && stateVal === null){ - - await this.setStateAsync(channelParentPath + "." + id, value, true); - - } - } + + if(createObjectInitally && createObjectInitallyUnit){ + await this.setObjectNotExistsAsync(channelParentPath + "." + id, { + type: "state", + common: { + name: channelName, + type: channelType, + role: channelRole, + unit: createObjectInitallyUnit, + read: true, + write: readOnly ? false : true, + + }, + native: {}, + }); + } else if(createObjectInitally && createObjectInitallyStates){ + await this.setObjectNotExistsAsync(channelParentPath + "." + id, { + type: "state", + common: { + name: channelName, + type: channelType, + role: channelRole, + states: createObjectInitallyStates, + read: true, + write: readOnly ? false : true, + + }, + native: {}, + }); + } else if(createObjectInitally){ + await this.setObjectNotExistsAsync(channelParentPath + "." + id, { + type: "state", + common: { + name: channelName, + type: channelType, + role: channelRole, + read: true, + write: readOnly ? false : true, + + }, + native: {}, + }); + + + } + + let stateVal = await this.getStateAsync(`${channelParentPath}.${id}`); + stateVal ? stateVal = stateVal.val : ""; + + + if((value != undefined || value != null) && stateVal === null){ + + await this.setStateAsync(channelParentPath + "." + id, value, true); + + } + } /** * Is called when databases are connected and adapter received configuration. @@ -95,445 +95,445 @@ class Notificationforandroidtv extends utils.Adapter { async onReady() { // Initialize your adapter here - const dev = adapter.config.keys; + const dev = this.config.keys; if (dev) { - for (const key in dev) { + for (const key in dev) { + + const androidTv = dev[key]; - const androidTv = dev[key]; - - - - //const deviceFolder = 'IP: '+ androidTv; - const deviceFolder = this.name2id(androidTv.ip.replaceAll(".", "_")); - const deviceName = androidTv.name; - - //let initialCreate = await adapter.getStatesAsync(deviceFolder) != undefined ? false : true; + //const deviceFolder = 'IP: '+ androidTv; + const deviceFolder = this.name2id(androidTv.ip.replaceAll(".", "_")); + const deviceName = androidTv.name; + + + + //let initialCreate = await this.getStatesAsync(deviceFolder) != undefined ? false : true; const initialCreate = true; const positions = { - 0:"BOTTOM_RIGHT", - 1:"BOTTOM_LEFT", - 2:"TOP_RIGHT", - 3:"TOP_LEFT", - 4:"CENTER" - }; - const positionsPiPup = { - 0:"TopRight", - 1:"TopLeft", - 2:"BottomRight", - 3:"BottomLeft", - 4:"Center" - }; - const transparencies = { - 0:"Standard", - 1:"0 %", - 2:"25 %", - 3:"50 %", - 4:"75 %", - 5:"100 %" - }; - const types = { - 0:"Standard", - 1:"ONLY_TITLE", - 2:"ONLY_ICON" - }; - const typesUrl = { - 0:"video", - 1:"image", - 2:"web" - }; - const bkgcolor = { - 0:"neutral blue", - 1:"black", - 2:"blue", - 3:"green", - 4:"red", - 5:"light blue", - 6:"turquoise", - 7:"orange", - 8:"purple" - }; - const icon = { - 0:"( i )", - 1:"/ ! \\", - 2:"( ! )", - 3:"( x )", - 4:"( ? )", - 5:":-)" - }; - - const width = { - 0:"Standard", - 1:"very small", - 2:"small", - 3:"large", - 4:"extra large" - }; - - await this.setObjectNotExistsAsync(deviceFolder, { - type: "channel", - common: { - name: deviceName, - }, - native: {}, - }); - - await this.writeChannelDataToIoBroker(deviceFolder, "message", { - "en": "Message", - "de": "Nachricht", - "ru": "Сообщение", - "pt": "Mensagem", - "nl": "Bericht", - "fr": "Message", - "it": "Messaggio", - "es": "Mensaje", - "pl": "Message", - "uk": "Новини", - "zh-cn": "导 言" - }, "","string","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder, "title", { - "en": "Message Title", - "de": "Nachricht Titel", - "ru": "Название сообщения", - "pt": "Título da Mensagem", - "nl": "Bericht Tit", - "fr": "Titre du message", - "it": "Titolo del messaggio", - "es": "Título del mensaje", - "pl": "Tytuł", - "uk": "Назва повідомлення", - "zh-cn": "标题" - },"ioBroker Message","string","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder, "duration",{ - "en": "Display duration", - "de": "Anzeigedauer", - "ru": "Продолжительность дисплея", - "pt": "Duração da exposição", - "nl": "Vertaling:", - "fr": "Durée d ' affichage", - "it": "Durata dell'esposizione", - "es": "Duración de la pantalla", - "pl": "Czas trwania gry", - "uk": "Тривалість відображення", - "zh-cn": "A. 期限" - },15, "number", "state",initialCreate,'s'); - await this.writeChannelDataToIoBroker(deviceFolder, "color", { - "en": "Color", - "de": "Farbe", - "ru": "Цвет", - "pt": "Cor", - "nl": "Color", - "fr": "Couleur", - "it": "Colore", - "es": "Color", - "pl": "Color", - "uk": "Колір", - "zh-cn": "科 法 律" - },"8","string","state",initialCreate,null,bkgcolor); - await this.writeChannelDataToIoBroker(deviceFolder, "ip", { - "en": "IP Address", - "de": "IP-Adresse", - "ru": "IP адрес", - "pt": "Endereço IP", - "nl": "IP Addres", - "fr": "Adresse IP", - "it": "Indirizzo IP", - "es": "Dirección IP", - "pl": "IP Address", - "uk": "IP-адреса", - "zh-cn": "IP地址" - },androidTv.ip,"string","state",initialCreate,null,null,true); - await this.writeChannelDataToIoBroker(deviceFolder, "icon", { - "en": "Icon if iconurl empty", - "de": "Icon, wenn iconurl leer ist", - "ru": "Икона, если iconurl пуст", - "pt": "Ícone se iconurl vazio", - "nl": "Icon als iconurle leeg", - "fr": "Icon si iconurl vide", - "it": "Icona se iconurl vuoto", - "es": "Icono si iconoruro vacío", - "pl": "Icon jeśli ikonur pusty", - "uk": "Ікона під час іконопису", - "zh-cn": "Iconurl空" - },0,"number","state",initialCreate,null,icon); - await this.writeChannelDataToIoBroker(deviceFolder, "transparency", { - "en": "Transparency", - "de": "Transparenz", - "ru": "Прозрачность", - "pt": "Transparência", - "nl": "Vertaling:", - "fr": "Transparence", - "it": "Trasparenza", - "es": "Transparencia", - "pl": "Przejrzystość", - "uk": "Прозорість", - "zh-cn": "透明度" - },0,"number","state",initialCreate,null,transparencies); - await this.writeChannelDataToIoBroker(deviceFolder, "position",{ - "en": "Overlay Position", - "de": "Overlay Position", - "ru": "Overlay позиция", - "pt": "Posição de sobreposição", - "nl": "Overlay Position", - "fr": "Position surmontée", - "it": "Posizione di sovrapposizione", - "es": "Posición de superposición", - "pl": "Overlay", - "uk": "Позиція", - "zh-cn": "增加职位" - },0, "number", "state",initialCreate,null,positions); - await this.writeChannelDataToIoBroker(deviceFolder, "type", "Overlay Type",0,"number", "state",initialCreate,null,types); - await this.writeChannelDataToIoBroker(deviceFolder, "width", { - "en": "Overlay Size", - "de": "Overlay Größe", - "ru": "Overlay Размер", - "pt": "Tamanho de sobreposição", - "nl": "Vertaling:", - "fr": "Overlay Taille", - "it": "Dimensione del sovrapposizione", - "es": "Superposición tamaño", - "pl": "Overlay", - "uk": "Розмір реле", - "zh-cn": "A. 超支" - },0,"number", "state",initialCreate,null,width); - await this.writeChannelDataToIoBroker(deviceFolder, "imageurl", { - "en": "image URL", - "de": "bild URL", - "ru": "изображение URL", - "pt": "imagem URL", - "nl": "beeld URL", - "fr": "image URL", - "it": "immagine URL", - "es": "imagen URL", - "pl": "obraz URL", - "uk": "зображення URL", - "zh-cn": "图像" - },"","string","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder, "iconurl","icon URL","","string","text.url",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder, "delete_image",{ - "en": "Delete image after sending", - "de": "Bild nach Senden löschen", - "ru": "Удалить изображение после отправки", - "pt": "Excluir imagem após o envio", - "nl": "Verwijder beeld na het sturen", - "fr": "Supprimer l'image après l'envoi", - "it": "Eliminare l'immagine dopo l'invio", - "es": "Eliminar imagen después de enviar", - "pl": "Zdjęcie Delete po wysłaniu", - "uk": "Видалити зображення після відправлення", - "zh-cn": "在发送后删去图像" - },false,"boolean","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder, "delete_icon",{ - "en": "Delete icon after sending", - "de": "Icon nach Senden löschen", - "ru": "Удалить иконку после отправки", - "pt": "Excluir ícone após o envio", - "nl": "Verwijder icon na het sturen", - "fr": "Supprimer l'icône après l'envoi", - "it": "Elimina icona dopo l'invio", - "es": "Eliminar icono después de enviar", - "pl": "Ikona Delete po wysłaniu", - "uk": "Видалити іконку після відправлення", - "zh-cn": "发货后删去一章" - },false,"boolean","state",initialCreate); - this.writeChannelDataToIoBroker(deviceFolder, "payload", "","","json","json",initialCreate); + 0:"BOTTOM_RIGHT", + 1:"BOTTOM_LEFT", + 2:"TOP_RIGHT", + 3:"TOP_LEFT", + 4:"CENTER" + }; + const positionsPiPup = { + 0:"TopRight", + 1:"TopLeft", + 2:"BottomRight", + 3:"BottomLeft", + 4:"Center" + }; + const transparencies = { + 0:"Standard", + 1:"0 %", + 2:"25 %", + 3:"50 %", + 4:"75 %", + 5:"100 %" + }; + const types = { + 0:"Standard", + 1:"ONLY_TITLE", + 2:"ONLY_ICON" + }; + const typesUrl = { + 0:"video", + 1:"image", + 2:"web" + }; + const bkgcolor = { + 0:"neutral blue", + 1:"black", + 2:"blue", + 3:"green", + 4:"red", + 5:"light blue", + 6:"turquoise", + 7:"orange", + 8:"purple" + }; + const icon = { + 0:"( i )", + 1:"/ ! \\", + 2:"( ! )", + 3:"( x )", + 4:"( ? )", + 5:":-)" + }; + + const width = { + 0:"Standard", + 1:"very small", + 2:"small", + 3:"large", + 4:"extra large" + }; + + await this.setObjectNotExistsAsync(deviceFolder, { + type: "channel", + common: { + name: deviceName, + }, + native: {}, + }); + + await this.writeChannelDataToIoBroker(deviceFolder, "message", { + "en": "Message", + "de": "Nachricht", + "ru": "Сообщение", + "pt": "Mensagem", + "nl": "Bericht", + "fr": "Message", + "it": "Messaggio", + "es": "Mensaje", + "pl": "Message", + "uk": "Новини", + "zh-cn": "导 言" + }, "","string","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder, "title", { + "en": "Message Title", + "de": "Nachricht Titel", + "ru": "Название сообщения", + "pt": "Título da Mensagem", + "nl": "Bericht Tit", + "fr": "Titre du message", + "it": "Titolo del messaggio", + "es": "Título del mensaje", + "pl": "Tytuł", + "uk": "Назва повідомлення", + "zh-cn": "标题" + },"ioBroker Message","string","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder, "duration",{ + "en": "Display duration", + "de": "Anzeigedauer", + "ru": "Продолжительность дисплея", + "pt": "Duração da exposição", + "nl": "Vertaling:", + "fr": "Durée d ' affichage", + "it": "Durata dell'esposizione", + "es": "Duración de la pantalla", + "pl": "Czas trwania gry", + "uk": "Тривалість відображення", + "zh-cn": "A. 期限" + },15, "number", "state",initialCreate,"s"); + await this.writeChannelDataToIoBroker(deviceFolder, "color", { + "en": "Color", + "de": "Farbe", + "ru": "Цвет", + "pt": "Cor", + "nl": "Color", + "fr": "Couleur", + "it": "Colore", + "es": "Color", + "pl": "Color", + "uk": "Колір", + "zh-cn": "科 法 律" + },"8","string","state",initialCreate,null,bkgcolor); + await this.writeChannelDataToIoBroker(deviceFolder, "ip", { + "en": "IP Address", + "de": "IP-Adresse", + "ru": "IP адрес", + "pt": "Endereço IP", + "nl": "IP Addres", + "fr": "Adresse IP", + "it": "Indirizzo IP", + "es": "Dirección IP", + "pl": "IP Address", + "uk": "IP-адреса", + "zh-cn": "IP地址" + },androidTv.ip,"string","state",initialCreate,null,null,true); + await this.writeChannelDataToIoBroker(deviceFolder, "icon", { + "en": "Icon if iconurl empty", + "de": "Icon, wenn iconurl leer ist", + "ru": "Икона, если iconurl пуст", + "pt": "Ícone se iconurl vazio", + "nl": "Icon als iconurle leeg", + "fr": "Icon si iconurl vide", + "it": "Icona se iconurl vuoto", + "es": "Icono si iconoruro vacío", + "pl": "Icon jeśli ikonur pusty", + "uk": "Ікона під час іконопису", + "zh-cn": "Iconurl空" + },0,"number","state",initialCreate,null,icon); + await this.writeChannelDataToIoBroker(deviceFolder, "transparency", { + "en": "Transparency", + "de": "Transparenz", + "ru": "Прозрачность", + "pt": "Transparência", + "nl": "Vertaling:", + "fr": "Transparence", + "it": "Trasparenza", + "es": "Transparencia", + "pl": "Przejrzystość", + "uk": "Прозорість", + "zh-cn": "透明度" + },0,"number","state",initialCreate,null,transparencies); + await this.writeChannelDataToIoBroker(deviceFolder, "position",{ + "en": "Overlay Position", + "de": "Overlay Position", + "ru": "Overlay позиция", + "pt": "Posição de sobreposição", + "nl": "Overlay Position", + "fr": "Position surmontée", + "it": "Posizione di sovrapposizione", + "es": "Posición de superposición", + "pl": "Overlay", + "uk": "Позиція", + "zh-cn": "增加职位" + },0, "number", "state",initialCreate,null,positions); + await this.writeChannelDataToIoBroker(deviceFolder, "type", "Overlay Type",0,"number", "state",initialCreate,null,types); + await this.writeChannelDataToIoBroker(deviceFolder, "width", { + "en": "Overlay Size", + "de": "Overlay Größe", + "ru": "Overlay Размер", + "pt": "Tamanho de sobreposição", + "nl": "Vertaling:", + "fr": "Overlay Taille", + "it": "Dimensione del sovrapposizione", + "es": "Superposición tamaño", + "pl": "Overlay", + "uk": "Розмір реле", + "zh-cn": "A. 超支" + },0,"number", "state",initialCreate,null,width); + await this.writeChannelDataToIoBroker(deviceFolder, "imageurl", { + "en": "image URL", + "de": "bild URL", + "ru": "изображение URL", + "pt": "imagem URL", + "nl": "beeld URL", + "fr": "image URL", + "it": "immagine URL", + "es": "imagen URL", + "pl": "obraz URL", + "uk": "зображення URL", + "zh-cn": "图像" + },"","string","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder, "iconurl","icon URL","","string","text.url",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder, "delete_image",{ + "en": "Delete image after sending", + "de": "Bild nach Senden löschen", + "ru": "Удалить изображение после отправки", + "pt": "Excluir imagem após o envio", + "nl": "Verwijder beeld na het sturen", + "fr": "Supprimer l'image après l'envoi", + "it": "Eliminare l'immagine dopo l'invio", + "es": "Eliminar imagen después de enviar", + "pl": "Zdjęcie Delete po wysłaniu", + "uk": "Видалити зображення після відправлення", + "zh-cn": "在发送后删去图像" + },false,"boolean","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder, "delete_icon",{ + "en": "Delete icon after sending", + "de": "Icon nach Senden löschen", + "ru": "Удалить иконку после отправки", + "pt": "Excluir ícone após o envio", + "nl": "Verwijder icon na het sturen", + "fr": "Supprimer l'icône après l'envoi", + "it": "Elimina icona dopo l'invio", + "es": "Eliminar icono después de enviar", + "pl": "Ikona Delete po wysłaniu", + "uk": "Видалити іконку після відправлення", + "zh-cn": "发货后删去一章" + },false,"boolean","state",initialCreate); + this.writeChannelDataToIoBroker(deviceFolder, "payload", "","","json","json",initialCreate); // Update support for PiPup - const subfolderPiPup = ".PiPup"; + const subfolderPiPup = ".PiPup"; await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "message", { - "en": "Message", - "de": "Nachricht", - "ru": "Сообщение", - "pt": "Mensagem", - "nl": "Bericht", - "fr": "Message", - "it": "Messaggio", - "es": "Mensaje", - "pl": "Message", - "uk": "Новини", - "zh-cn": "导 言" - }, "","string","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "title", { - "en": "Message Title", - "de": "Nachricht Titel", - "ru": "Название сообщения", - "pt": "Título da Mensagem", - "nl": "Bericht Tit", - "fr": "Titre du message", - "it": "Titolo del messaggio", - "es": "Título del mensaje", - "pl": "Tytuł", - "uk": "Назва повідомлення", - "zh-cn": "标题" - },"ioBroker Message","string","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "duration",{ - "en": "Display duration", - "de": "Anzeigedauer", - "ru": "Продолжительность дисплея", - "pt": "Duração da exposição", - "nl": "Vertaling:", - "fr": "Durée d ' affichage", - "it": "Durata dell'esposizione", - "es": "Duración de la pantalla", - "pl": "Czas trwania gry", - "uk": "Тривалість відображення", - "zh-cn": "A. 期限" - },15, "number", "state",initialCreate,'s'); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "messageColor", { - "en": "message Color", - "de": "nachricht Farbe", - "ru": "сообщение", - "pt": "mensagem Cor", - "nl": "berichtkleur", - "fr": "couleur du message", - "it": "messaggio", - "es": "mensaje Color", - "pl": "wiadomość Kolor", - "uk": "повідомлення Колір", - "zh-cn": "信件颜色" - },"8","string","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "titleColor", { - "en": "title Color", - "de": "titel Farbe", - "ru": "название", - "pt": "título Cor", - "nl": "titel kleur", - "fr": "titre Couleur", - "it": "titolo", - "es": "título Color", - "pl": "tytuł Kolor", - "uk": "колір", - "zh-cn": "标题颜色" - },"#FFFFFF","string","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "backgroundColor", { - "en": "background Color", - "de": "hintergrundfarbe", - "ru": "цвет", - "pt": "cor de fundo", - "nl": "achtergrondkleur", - "fr": "couleur de fond", - "it": "sfondo colore", - "es": "fondo Color", - "pl": "tło Kolor", - "uk": "фон Колір", - "zh-cn": "背景颜色" - },"#CC000000","string","state",initialCreate); - - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "position",{ - "en": "Overlay Position", - "de": "Overlay Position", - "ru": "Overlay позиция", - "pt": "Posição de sobreposição", - "nl": "Overlay Position", - "fr": "Position surmontée", - "it": "Posizione di sovrapposizione", - "es": "Posición de superposición", - "pl": "Overlay", - "uk": "Позиція", - "zh-cn": "增加职位" - },0, "number", "state",initialCreate,null,positionsPiPup); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "titleSize",{ - "en": "title Size", - "de": "titel Größe", - "ru": "название", - "pt": "tamanho do título", - "nl": "titel Grootte", - "fr": "titre Taille", - "it": "titolo Dimensione", - "es": "título Tamaño", - "pl": "tytuł Rozmiar", - "uk": "розмір титулу", - "zh-cn": "标题大小" - },16, "number", "state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "messageSize",{ - "en": "message Size", - "de": "nachricht Größe", - "ru": "размер сообщения", - "pt": "tamanho da mensagem", - "nl": "berichtgrootte", - "fr": "taille du message", - "it": "dimensione del messaggio", - "es": "mensaje Tamaño", - "pl": "rozmiar wiadomości", - "uk": "розмір повідомлення", - "zh-cn": "信件大小" - },12, "number", "state",initialCreate); - - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "width", { - "en": "width", - "de": "breite", - "ru": "ширина", - "pt": "largura de largura", - "nl": "breedte", - "fr": "largeur", - "it": "larghezza", - "es": "ancho", - "pl": "szerokość", - "uk": "ширина", - "zh-cn": "宽度" - },640,"number", "state",initialCreate,'px'); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "height", { - "en": "height", - "de": "höhe", - "ru": "высота", - "pt": "altura", - "nl": "hoogte", - "fr": "hauteur", - "it": "altezza", - "es": "altura", - "pl": "wysokość", - "uk": "висота", - "zh-cn": "高度" - },480,"number", "state",initialCreate,'px'); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "url", { - "en": "image URL", - "de": "bild URL", - "ru": "изображение URL", - "pt": "imagem URL", - "nl": "beeld URL", - "fr": "image URL", - "it": "immagine URL", - "es": "imagen URL", - "pl": "obraz URL", - "uk": "зображення URL", - "zh-cn": "图像" - },"","string","state",initialCreate); - await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "type", { - "en": "URL Type", - "de": "URL Typ", - "ru": "URL Тип", - "pt": "URL Tipo", - "nl": "URL Type", - "fr": "URL Type", - "it": "URL pagina Tipo", - "es": "URL Tipo", - "pl": "URL Rodzaj", - "uk": "Контакти Тип", - "zh-cn": "網址 类型" - },0,"number", "state",initialCreate,null,typesUrl); - - this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "payload", "","","json","json",initialCreate); + "en": "Message", + "de": "Nachricht", + "ru": "Сообщение", + "pt": "Mensagem", + "nl": "Bericht", + "fr": "Message", + "it": "Messaggio", + "es": "Mensaje", + "pl": "Message", + "uk": "Новини", + "zh-cn": "导 言" + }, "","string","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "title", { + "en": "Message Title", + "de": "Nachricht Titel", + "ru": "Название сообщения", + "pt": "Título da Mensagem", + "nl": "Bericht Tit", + "fr": "Titre du message", + "it": "Titolo del messaggio", + "es": "Título del mensaje", + "pl": "Tytuł", + "uk": "Назва повідомлення", + "zh-cn": "标题" + },"ioBroker Message","string","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "duration",{ + "en": "Display duration", + "de": "Anzeigedauer", + "ru": "Продолжительность дисплея", + "pt": "Duração da exposição", + "nl": "Vertaling:", + "fr": "Durée d ' affichage", + "it": "Durata dell'esposizione", + "es": "Duración de la pantalla", + "pl": "Czas trwania gry", + "uk": "Тривалість відображення", + "zh-cn": "A. 期限" + },15, "number", "state",initialCreate,"s"); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "messageColor", { + "en": "message Color", + "de": "nachricht Farbe", + "ru": "сообщение", + "pt": "mensagem Cor", + "nl": "berichtkleur", + "fr": "couleur du message", + "it": "messaggio", + "es": "mensaje Color", + "pl": "wiadomość Kolor", + "uk": "повідомлення Колір", + "zh-cn": "信件颜色" + },"8","string","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "titleColor", { + "en": "title Color", + "de": "titel Farbe", + "ru": "название", + "pt": "título Cor", + "nl": "titel kleur", + "fr": "titre Couleur", + "it": "titolo", + "es": "título Color", + "pl": "tytuł Kolor", + "uk": "колір", + "zh-cn": "标题颜色" + },"#FFFFFF","string","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "backgroundColor", { + "en": "background Color", + "de": "hintergrundfarbe", + "ru": "цвет", + "pt": "cor de fundo", + "nl": "achtergrondkleur", + "fr": "couleur de fond", + "it": "sfondo colore", + "es": "fondo Color", + "pl": "tło Kolor", + "uk": "фон Колір", + "zh-cn": "背景颜色" + },"#CC000000","string","state",initialCreate); + + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "position",{ + "en": "Overlay Position", + "de": "Overlay Position", + "ru": "Overlay позиция", + "pt": "Posição de sobreposição", + "nl": "Overlay Position", + "fr": "Position surmontée", + "it": "Posizione di sovrapposizione", + "es": "Posición de superposición", + "pl": "Overlay", + "uk": "Позиція", + "zh-cn": "增加职位" + },0, "number", "state",initialCreate,null,positionsPiPup); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "titleSize",{ + "en": "title Size", + "de": "titel Größe", + "ru": "название", + "pt": "tamanho do título", + "nl": "titel Grootte", + "fr": "titre Taille", + "it": "titolo Dimensione", + "es": "título Tamaño", + "pl": "tytuł Rozmiar", + "uk": "розмір титулу", + "zh-cn": "标题大小" + },16, "number", "state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "messageSize",{ + "en": "message Size", + "de": "nachricht Größe", + "ru": "размер сообщения", + "pt": "tamanho da mensagem", + "nl": "berichtgrootte", + "fr": "taille du message", + "it": "dimensione del messaggio", + "es": "mensaje Tamaño", + "pl": "rozmiar wiadomości", + "uk": "розмір повідомлення", + "zh-cn": "信件大小" + },12, "number", "state",initialCreate); + + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "width", { + "en": "width", + "de": "breite", + "ru": "ширина", + "pt": "largura de largura", + "nl": "breedte", + "fr": "largeur", + "it": "larghezza", + "es": "ancho", + "pl": "szerokość", + "uk": "ширина", + "zh-cn": "宽度" + },640,"number", "state",initialCreate,"px"); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "height", { + "en": "height", + "de": "höhe", + "ru": "высота", + "pt": "altura", + "nl": "hoogte", + "fr": "hauteur", + "it": "altezza", + "es": "altura", + "pl": "wysokość", + "uk": "висота", + "zh-cn": "高度" + },480,"number", "state",initialCreate,"px"); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "url", { + "en": "image URL", + "de": "bild URL", + "ru": "изображение URL", + "pt": "imagem URL", + "nl": "beeld URL", + "fr": "image URL", + "it": "immagine URL", + "es": "imagen URL", + "pl": "obraz URL", + "uk": "зображення URL", + "zh-cn": "图像" + },"","string","state",initialCreate); + await this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "type", { + "en": "URL Type", + "de": "URL Typ", + "ru": "URL Тип", + "pt": "URL Tipo", + "nl": "URL Type", + "fr": "URL Type", + "it": "URL pagina Tipo", + "es": "URL Tipo", + "pl": "URL Rodzaj", + "uk": "Контакти Тип", + "zh-cn": "網址 类型" + },0,"number", "state",initialCreate,null,typesUrl); + + this.writeChannelDataToIoBroker(deviceFolder + subfolderPiPup, "payload", "","","json","json",initialCreate); // Update support for PiPup - - - await this.subscribeStates(deviceFolder+subfolderPiPup+".message"); - await this.subscribeStates(deviceFolder+subfolderPiPup+".payload"); - await this.subscribeStates(deviceFolder+".message"); - await this.subscribeStates(deviceFolder+".payload"); - + await this.subscribeStates(deviceFolder+subfolderPiPup+".message"); + await this.subscribeStates(deviceFolder+subfolderPiPup+".payload"); + + await this.subscribeStates(deviceFolder+".message"); + await this.subscribeStates(deviceFolder+".payload"); + + - - } - } else { - adapter.log.error("No AndroidTV`s configurated, please add a device"); - } - + + } + } else { + this.log.error("No AndroidTV`s configurated, please add a device"); + } + // In order to get state updates, you need to subscribe to them. The following line adds a subscription for our variable we have created above. //this.subscribeStates("testVariable"); // You can also add a subscription for multiple states. The following line watches all states starting with "lights." @@ -581,29 +581,29 @@ class Notificationforandroidtv extends utils.Adapter { const data = JSON.parse(state.val); let payloadvalue = ""; for (const [key, value] of Object.entries(data)) { - + if (payloadvalue) { payloadvalue = payloadvalue + "&" + `${key}=${value}`; } else { payloadvalue = "?" + `${key}=${value}`; - + } } this.notifyPayload(id, payloadvalue); } else { - if (state.val != '') + if (state.val != "") { - adapter.log.error(`state ${id} is not a json string`); + this.log.error(`state ${id} is not a json string`); } - + } } else if (event == "message") { this.notify(id, state); } else if (event == "PiPup") { const triggeredEvent = id.split(".", 5); const event2 = triggeredEvent.slice(-1); - + if (event2 == "message") { this.PiPup(id, state); } else if (event2 == "payload") { @@ -613,85 +613,86 @@ class Notificationforandroidtv extends utils.Adapter { { this.PiPupPayload(id, state.val); } else { - if (state.val != '') + if (state.val != "") { - adapter.log.error(`state ${id} is not a json string`); + this.log.error(`state ${id} is not a json string`); } - + } - + } - + } - - adapter.log.debug(`state ${id} changed: ${state.val} (ack = ${state.ack})`); + + this.log.debug(`state ${id} changed: ${state.val} (ack = ${state.ack})`); } else { // The state was deleted - adapter.log.debug(`state ${id} deleted`); + this.log.debug(`state ${id} deleted`); } } name2id(pName) { - return (pName || "").replace(adapter.FORBIDDEN_CHARS, "_"); + return (pName || "").replace(this.FORBIDDEN_CHARS, "_"); } + isJsonString(str) { - try { - JSON.parse(str); - } catch (e) { - return false; - } - return true; + try { + JSON.parse(str); + } catch (e) { + return false; + } + return true; } async notifyPayload(id, payload) { - console.debug('Payload Notify fired!'); - + console.debug("Payload Notify fired!"); + const myObjectArray = id.split(".", 3); const device = myObjectArray.join("."); - const ip = await adapter.getStateAsync(device + ".ip"); + const ip = await this.getStateAsync(device + ".ip"); const url = `http://${ip.val}:7676${payload}`; // send the request axios.put(url, { timeout: 2000 - }) - .then(response => { + }) + .then(response => { - adapter.log.debug(`Notify successful! (${response.status})`); - }) - .catch(error => { - adapter.log.error(`Notify failed for :${ip}`, error.message); - }); + this.log.debug(`Notify successful! (${response.status})`); + }) + .catch(error => { + this.log.error(`Notify failed for :${ip}`, error.message); + }); - return true; + return true; } async notify(id, msg) { - adapter.log.debug("Notify fired!"); + this.log.debug("Notify fired!"); const myObjectArray = id.split(".", 3); - + const device = myObjectArray.join("."); - - - const title = await adapter.getStateAsync(device + ".title"); - const duration = await adapter.getStateAsync(device + ".duration"); - const position = await adapter.getStateAsync(device + ".position"); - const width = await adapter.getStateAsync(device + ".width"); - const transparency = await adapter.getStateAsync(device + ".transparency"); - const type = await adapter.getStateAsync(device + ".type"); - const color = await adapter.getStateAsync(device + ".color"); - const ip = await adapter.getStateAsync(device + ".ip"); - const icon = await adapter.getStateAsync(device + ".icon"); - const iconurl = await adapter.getStateAsync(device + ".iconurl"); - const imageurl = await adapter.getStateAsync(device + ".imageurl"); - const delete_image = await adapter.getStateAsync(device + ".delete_image"); - const delete_icon = await adapter.getStateAsync(device + ".delete_icon"); - + + + const title = await this.getStateAsync(device + ".title"); + const duration = await this.getStateAsync(device + ".duration"); + const position = await this.getStateAsync(device + ".position"); + const width = await this.getStateAsync(device + ".width"); + const transparency = await this.getStateAsync(device + ".transparency"); + const type = await this.getStateAsync(device + ".type"); + const color = await this.getStateAsync(device + ".color"); + const ip = await this.getStateAsync(device + ".ip"); + const icon = await this.getStateAsync(device + ".icon"); + const iconurl = await this.getStateAsync(device + ".iconurl"); + const imageurl = await this.getStateAsync(device + ".imageurl"); + const delete_image = await this.getStateAsync(device + ".delete_image"); + const delete_icon = await this.getStateAsync(device + ".delete_icon"); + axios.post(`http://${ip.val}:7676 ?msg=`+msg.val.replace(/\n/gi,"
")+ "&title="+title.val+ @@ -704,71 +705,71 @@ class Notificationforandroidtv extends utils.Adapter { "&icon="+icon.val+ "&iconurl="+iconurl.val+ "&imageurl="+imageurl.val - , - { - timeout: 2000 - } - ) - .then(response => { - delete_image.val == true ? this.setStateAsync(device + ".imageurl", "", true) : ""; - delete_icon.val == true ? this.setStateAsync(device + ".iconurl", "", true) : ""; - - adapter.log.debug(`Notify successful! (${response.status})`); - }) - .catch(error => { - adapter.log.error(`Notify failed for :${ip.val}`, error.message); - }); - - return true; + , + { + timeout: 2000 + } + ) + .then(response => { + delete_image.val == true ? this.setStateAsync(device + ".imageurl", "", true) : ""; + delete_icon.val == true ? this.setStateAsync(device + ".iconurl", "", true) : ""; + + this.log.debug(`Notify successful! (${response.status})`); + }) + .catch(error => { + this.log.error(`Notify failed for :${ip.val}`, error.message); + }); + + return true; } async PiPupPayload(id, payload) { - adapter.log.debug("PiPup payload fired!"); + this.log.debug("PiPup payload fired!"); const myObjectArray = id.split(".", 3); const device = myObjectArray.join("."); - const ip = await adapter.getStateAsync(device + ".ip"); - + const ip = await this.getStateAsync(device + ".ip"); + axios({ - method: "post", - baseURL: `http://${ip.val}:7979/notify`, - headers: {"Content-Type":"application/json"}, - data : payload, - timeout: 4500, - responseType: "json" - }) - .then(response => { - adapter.log.debug(`PiPup payload successful! (${response.status})`); - }) - .catch(error => { - adapter.log.error(`PiPup payload failed for :${ip.val}`, error.message); - }); - - return true; + method: "post", + baseURL: `http://${ip.val}:7979/notify`, + headers: {"Content-Type":"application/json"}, + data : payload, + timeout: 4500, + responseType: "json" + }) + .then(response => { + this.log.debug(`PiPup payload successful! (${response.status})`); + }) + .catch(error => { + this.log.error(`PiPup payload failed for :${ip.val}`, error.message); + }); + + return true; } async PiPup(id, msg) { - adapter.log.debug("PiPup fired!"); + this.log.debug("PiPup fired!"); const myObjectArray = id.split(".", 3); const device = myObjectArray.join("."); - const title = await adapter.getStateAsync(device + ".PiPup.title"); - const duration = await adapter.getStateAsync(device + ".PiPup.duration"); - const position = await adapter.getStateAsync(device + ".PiPup.position"); - const width = await adapter.getStateAsync(device + ".PiPup.width"); - const height = await adapter.getStateAsync(device + ".PiPup.height"); - const type = await adapter.getStateAsync(device + ".PiPup.type"); - const titleColor = await adapter.getStateAsync(device + ".PiPup.titleColor"); - const titleSize = await adapter.getStateAsync(device + ".PiPup.titleSize"); - const messageColor = await adapter.getStateAsync(device + ".PiPup.messageColor"); - const messageSize = await adapter.getStateAsync(device + ".PiPup.messageSize"); - const backgroundColor = await adapter.getStateAsync(device + ".PiPup.backgroundColor"); - const ip = await adapter.getStateAsync(device + ".ip"); - const url = await adapter.getStateAsync(device + ".PiPup.url"); - const typeClear = type.val == 0 ? "video" : type.val == 1 ? "image" : type.val == 2 ? "web" : ''; - const media = { [typeClear] : { "url": url.val, "width": width.val, "height": typeClear == "image" ? height.val : '' }}; - + const title = await this.getStateAsync(device + ".PiPup.title"); + const duration = await this.getStateAsync(device + ".PiPup.duration"); + const position = await this.getStateAsync(device + ".PiPup.position"); + const width = await this.getStateAsync(device + ".PiPup.width"); + const height = await this.getStateAsync(device + ".PiPup.height"); + const type = await this.getStateAsync(device + ".PiPup.type"); + const titleColor = await this.getStateAsync(device + ".PiPup.titleColor"); + const titleSize = await this.getStateAsync(device + ".PiPup.titleSize"); + const messageColor = await this.getStateAsync(device + ".PiPup.messageColor"); + const messageSize = await this.getStateAsync(device + ".PiPup.messageSize"); + const backgroundColor = await this.getStateAsync(device + ".PiPup.backgroundColor"); + const ip = await this.getStateAsync(device + ".ip"); + const url = await this.getStateAsync(device + ".PiPup.url"); + const typeClear = type.val == 0 ? "video" : type.val == 1 ? "image" : type.val == 2 ? "web" : ""; + const media = { [typeClear] : { "url": url.val, "width": width.val, "height": typeClear == "image" ? height.val : "" }}; + const data = { "message":msg.val.replace(/\n/gi,"
"), "title":title.val, @@ -783,22 +784,22 @@ class Notificationforandroidtv extends utils.Adapter { "media":media }; - axios({ - method: "post", - baseURL: `http://${ip.val}:7979/notify`, - headers: {"Content-Type":"multipart/form-data"}, - data : data, - timeout: 4500, - responseType: "json" - }) - .then(response => { - adapter.log.debug(`PiPup successful! (${response.status})`); - }) - .catch(error => { - adapter.log.error(`PiPup failed for :${ip.val}`, error.message); - }); - - return true; + axios({ + method: "post", + baseURL: `http://${ip.val}:7979/notify`, + headers: {"Content-Type":"multipart/form-data"}, + data : data, + timeout: 4500, + responseType: "json" + }) + .then(response => { + this.log.debug(`PiPup successful! (${response.status})`); + }) + .catch(error => { + this.log.error(`PiPup failed for :${ip.val} - ${error.message}`); + }); + + return true; } diff --git a/package-lock.json b/package-lock.json index 2b18096..1f1698e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "3.0.3", "license": "MIT", "dependencies": { - "@iobroker/adapter-core": "^3.0.4", + "@iobroker/adapter-core": "^3.1.4", "axios": "^1.6.8" }, "devDependencies": { @@ -18,8 +18,8 @@ "@alcalzone/release-script-plugin-license": "^3.7.0", "@alcalzone/release-script-plugin-manual-review": "^3.7.0", "@iobroker/adapter-dev": "^1.3.0", - "@iobroker/testing": "^4.1.0", - "@tsconfig/node16": "^16.1.1", + "@iobroker/testing": "^4.1.3", + "@tsconfig/node16": "^16.1.3", "@types/chai": "^4.3.11", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -30,11 +30,11 @@ "chai": "^4.3.10", "chai-as-promised": "^7.1.1", "eslint": "^8.57.0", - "mocha": "^10.2.0", + "mocha": "^10.4.0", "proxyquire": "^2.1.3", "sinon": "^17.0.1", "sinon-chai": "^3.7.0", - "typescript": "~5.0.4" + "typescript": "~5.4.5" }, "engines": { "node": ">= 16" @@ -908,9 +908,9 @@ "dev": true }, "node_modules/@iobroker/adapter-core": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@iobroker/adapter-core/-/adapter-core-3.0.4.tgz", - "integrity": "sha512-QsSeIkOa+zEVdIQ0kc0GcfsnQC+pTWWkixotdG4naKuaLUwMWK7xP0UyUEUiaHfPG3KqyZxwIxQR9HMENvvIYQ==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@iobroker/adapter-core/-/adapter-core-3.1.4.tgz", + "integrity": "sha512-RYDGB8Vk/MEKvMMwo4fLgxY8kjHrCeQmqROo/JxQYiLBEA4/gwFCTpxdD6s7RQ+dh4yZoH16/yTWqdgyR6NAxQ==", "engines": { "npm": ">=7.0.0" }, @@ -956,71 +956,51 @@ } }, "node_modules/@iobroker/testing": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@iobroker/testing/-/testing-4.1.0.tgz", - "integrity": "sha512-fzCfR5xF9VToixMqSZQKjNZiGvwDCZ5cUX+bfdll7ZyVhPXcMt6LB5UXkAYLF4QN/wA0TYa9o71iElKOQp4b4A==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@iobroker/testing/-/testing-4.1.3.tgz", + "integrity": "sha512-PTfvlXQBXDJVX35bkJxzgjuMX6bEjUmB4Dy8+bWLqbOgyq1JQVrRn+ah5IB7hEf+4lP8wD0MpAjXFJTv3zfTvA==", "dev": true, "dependencies": { "alcalzone-shared": "~4.0.3", - "chai": "^4.3.6", + "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "debug": "^4.3.4", "fs-extra": "^10.1.0", - "mocha": "^10.0.0", - "sinon": "^14.0.0", + "mocha": "^10.2.0", + "sinon": "^15.0.1", "sinon-chai": "^3.7.0" } }, - "node_modules/@iobroker/testing/node_modules/@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, "node_modules/@iobroker/testing/node_modules/@sinonjs/fake-timers": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", - "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^1.7.0" - } - }, - "node_modules/@iobroker/testing/node_modules/@sinonjs/fake-timers/node_modules/@sinonjs/commons": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", - "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", "dev": true, "dependencies": { - "type-detect": "4.0.8" + "@sinonjs/commons": "^3.0.0" } }, - "node_modules/@iobroker/testing/node_modules/@sinonjs/samsam": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-7.0.1.tgz", - "integrity": "sha512-zsAk2Jkiq89mhZovB2LLOdTCxJF4hqqTToGP0ASWlhp4I1hqOjcfmZGafXntCN7MDC6yySH0mFHrYtHceOeLmw==", + "node_modules/@iobroker/testing/node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", "dev": true, - "dependencies": { - "@sinonjs/commons": "^2.0.0", - "lodash.get": "^4.4.2", - "type-detect": "^4.0.8" + "engines": { + "node": ">=0.3.1" } }, "node_modules/@iobroker/testing/node_modules/sinon": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.2.tgz", - "integrity": "sha512-PDpV0ZI3ZCS3pEqx0vpNp6kzPhHrLx72wA0G+ZLaaJjLIYeE0n8INlgaohKuGy7hP0as5tbUd23QWu5U233t+w==", + "version": "15.2.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-15.2.0.tgz", + "integrity": "sha512-nPS85arNqwBXaIsFCkolHjGIkFo+Oxu9vbgmBJizLAhqe6P2o3Qmj3KCUoRkfhHtvgDhZdWD3risLHAUJ8npjw==", "deprecated": "16.1.1", "dev": true, "dependencies": { - "@sinonjs/commons": "^2.0.0", - "@sinonjs/fake-timers": "^9.1.2", - "@sinonjs/samsam": "^7.0.1", - "diff": "^5.0.0", - "nise": "^5.1.2", + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^10.3.0", + "@sinonjs/samsam": "^8.0.0", + "diff": "^5.1.0", + "nise": "^5.1.4", "supports-color": "^7.2.0" }, "funding": { @@ -1202,9 +1182,9 @@ } }, "node_modules/@tsconfig/node16": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-16.1.1.tgz", - "integrity": "sha512-+pio93ejHN4nINX4pXqfnR/fPLRtJBaT4ORaa5RH0Oc1zoYmo2B2koG+M328CQhHKn1Wj6FcOxCDFXAot9NhvA==", + "version": "16.1.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-16.1.3.tgz", + "integrity": "sha512-9nTOUBn+EMKO6rtSZJk+DcqsfgtlERGT9XPJ5PRj/HNENPCBY1yu/JEj5wT6GLtbCLBO2k46SeXDaY0pjMqypw==", "dev": true }, "node_modules/@types/chai": { @@ -3175,9 +3155,9 @@ } }, "node_modules/mocha": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz", - "integrity": "sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.4.0.tgz", + "integrity": "sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA==", "dev": true, "dependencies": { "ansi-colors": "4.1.1", @@ -4250,16 +4230,16 @@ } }, "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" + "node": ">=14.17" } }, "node_modules/uc.micro": { diff --git a/package.json b/package.json index d800cfb..d53f16c 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,10 @@ "url": "git+https://github.com/DNAngelX/ioBroker.notificationforandroidtv.git" }, "engines": { - "node": ">= 16" + "node": ">= 18" }, "dependencies": { - "@iobroker/adapter-core": "^3.0.4", + "@iobroker/adapter-core": "^3.1.4", "axios": "^1.6.8" }, "devDependencies": { @@ -30,8 +30,8 @@ "@alcalzone/release-script-plugin-license": "^3.7.0", "@alcalzone/release-script-plugin-manual-review": "^3.7.0", "@iobroker/adapter-dev": "^1.3.0", - "@iobroker/testing": "^4.1.0", - "@tsconfig/node16": "^16.1.1", + "@iobroker/testing": "^4.1.3", + "@tsconfig/node16": "^16.1.3", "@types/chai": "^4.3.11", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -42,11 +42,11 @@ "chai": "^4.3.10", "chai-as-promised": "^7.1.1", "eslint": "^8.57.0", - "mocha": "^10.2.0", + "mocha": "^10.4.0", "proxyquire": "^2.1.3", "sinon": "^17.0.1", "sinon-chai": "^3.7.0", - "typescript": "~5.0.4" + "typescript": "~5.4.5" }, "main": "main.js", "files": [