From 1cbeb3333721fb5d0d4b8e0679198e16603645ba Mon Sep 17 00:00:00 2001 From: Katharina Kraus <107550719+pr0crstntr@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:48:47 +0100 Subject: [PATCH] Update version in io-package (#39) * Update verion in io-package * Update README.md * Updated io-package news * Update changelog in readme * Changed author email * Changed eslint to devdependency * Update README.md * Added more explicit error messages * Added more roles for values, deleted unnecessary functions * Set min and max value of retrievalRate with cut-off * Replace invalid characters * Set axios timeout to 4 sec, added hint * Update README.md --- .create-adapter.json | 2 +- LICENSE | 2 +- README.md | 69 ++++++++----------- admin/i18n/de/translations.json | 3 +- admin/i18n/en/translations.json | 1 + admin/i18n/es/translations.json | 3 +- admin/i18n/fr/translations.json | 3 +- admin/i18n/it/translations.json | 3 +- admin/i18n/nl/translations.json | 3 +- admin/i18n/pl/translations.json | 3 +- admin/i18n/pt/translations.json | 3 +- admin/i18n/ru/translations.json | 3 +- admin/i18n/uk/translations.json | 3 +- admin/i18n/zh-cn/translations.json | 3 +- admin/index_m.html | 20 +++++- admin/words.js | 1 + build/main.js | 95 +++++++++++++++------------ build/main.js.map | 6 +- io-package.json | 27 +++++++- package-lock.json | 6 +- package.json | 6 +- src/main.ts | 102 +++++++++++++++++------------ 22 files changed, 217 insertions(+), 150 deletions(-) diff --git a/.create-adapter.json b/.create-adapter.json index caec728..4a71277 100644 --- a/.create-adapter.json +++ b/.create-adapter.json @@ -37,7 +37,7 @@ "es6class": "yes", "authorName": "Katharina K.", "authorGithub": "pr0crstntr", - "authorEmail": "katharina.kraus@student.hs-anhalt.de", + "authorEmail": "katharina.kraus@air-q.com", "gitRemoteProtocol": "HTTPS", "gitCommit": "yes", "defaultBranch": "main", diff --git a/LICENSE b/LICENSE index f13bd0b..1c5e22c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Katharina K. +Copyright (c) 2024 Katharina K. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 6eb4254..6ddde6c 100644 --- a/README.md +++ b/README.md @@ -12,44 +12,37 @@ ## Contents - [About](#about) -- [Installation manual](#install) - - [Prerequisites](#prereq) - - [Getting started](#start) - - [Test the adapter manually with dev-server](#testing) - - [Changelog](#change) - - [License](#license) +- [Getting started](#start) +- [Changelog](#change) +- [License](#license) ## About + This ioBroker Adapter is used in connection with our [air-Q device](https://www.air-q.com). It polls the values from our sensors and displays them for you in the ioBroker environment.

![air-Q_frontal + Seitlich_full](https://github.com/CorantGmbH/ioBroker.air-q/assets/107550719/5c38d737-9641-463f-bd07-ac62ce5f1973) -## Installation manual
+## Getting started -### Prerequisites +You should be able to find the adapter through the admin interface. -Please make sure to install the newest version of npm. -To install and update necessary dependencies please run -``` -npm i +Otherwise you're welcome to use the ioBroker command line interface through the console. Simply direct to your ioBroker root folder and add the adapter via ``` - to ensure the adapter is running properly. -For development it is recommended to use dev-server, which you can install with: +iobroker add air-q ``` -npm install dev-server -``` - -### Getting started +This installs the adapter (if it isn't installed already) and starts an instance. +In case you only want to install the adapter without creating an instance yet, use the following command: -Head to your root directory for your ioBroker system. Now you can install our adapter by using npm directly: ``` -npm install iobroker.air-q +iobroker install air-q ``` -Once this is done, you should be able to find the adapter through the interface. To configure your instance you simply select whether you want to connect it through the IP or the short-ID of your device. +For more information visit the ioBroker CLI documentation under https://github.com/ioBroker/ioBroker/wiki/Console-commands. + +To configure your instance you simply select whether you want to connect it through the IP or the short-ID of your device. ![Screenshot 2024-02-13 103001](https://github.com/CorantGmbH/ioBroker.air-q/assets/107550719/ec878783-af56-490d-af66-43c53c27df20) @@ -66,30 +59,25 @@ The data will be retrieved and shown in the objects-tab according to your config ***For now we have all sensors for the air-Q Pro included. Optional sensors will be included in a future patch.*** +## Changelog -### Test the adapter manually with dev-server +### 1.0.0 -If you'd like to debug the adapter yourself you can use dev-server. -Once you installed it, run `dev-server setup`. -You can use it to run, test and debug your adapter. +* Include typescript files by @pr0crstntr in #6 +* Created air-Q class by @pr0crstntr in #4 +* Fix restart bug by @pr0crstntr in #7 +* Update data poll by @pr0crstntr in #8 +* Updated io-package by @pr0crstntr in #9 +* Fixed save option for configuration by @pr0crstntr in #16 +* Added clear intervals on unload by @pr0crstntr in #26 +* Update README by @pr0crstntr in #37 +* Changed role for temperature and added unit by @pr0crstntr in #38 -You may start `dev-server` by calling from your dev directory: -``` -dev-server watch -``` +### 0.0.1 -The ioBroker.admin interface will then be available at http://127.0.0.1:8081/ - -Please refer to the [`dev-server` documentation](https://github.com/ioBroker/dev-server#command-line) for more details. +* (Katharina K.) initial release -## Changelog - -### **WORK IN PROGRESS** -* (Katharina K.) initial release ## License @@ -114,6 +102,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -Copyright (c) 2024 Corant GmbH diff --git a/admin/i18n/de/translations.json b/admin/i18n/de/translations.json index cd59884..02bcd6a 100644 --- a/admin/i18n/de/translations.json +++ b/admin/i18n/de/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "Kurz-ID (erste 5 Zeichen der Seriennummer)", "so2_txt": "Schwefeldioxid (SO2)", "temperature_txt": "Temperatur", - "voc_txt": "Flüchtige organische Verbindungen (VOC)" + "voc_txt": "Flüchtige organische Verbindungen (VOC)", + "polling_hint_txt": "Hinweis: Erwägen Sie die Verwendung einer Abfragehäufigkeit von 5 Sekunden oder mehr, der Standardwert liegt bei 10 Sekunden." } diff --git a/admin/i18n/en/translations.json b/admin/i18n/en/translations.json index 95caaca..df64497 100644 --- a/admin/i18n/en/translations.json +++ b/admin/i18n/en/translations.json @@ -24,6 +24,7 @@ "performance_txt": "Performance index", "pm_txt": "Particulate matter (PM1, PM2.5, PM10)", "poll_warning_txt": "Warning: Setting a very high polling frequency (less than 2 seconds) might slow down the air-Q smartphone app.", + "polling_hint_txt": "Hint: Consider using a polling frequency of 5 seconds or more, the default is at 10 seconds.", "pressure_rel_txt": "Relative pressure", "pressure_txt": "Pressure", "radon_txt": "Radon", diff --git a/admin/i18n/es/translations.json b/admin/i18n/es/translations.json index bcbf884..b553455 100644 --- a/admin/i18n/es/translations.json +++ b/admin/i18n/es/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "ID corto (los 5 primeros dígitos del número de serie)", "so2_txt": "Dióxido de azufre (SO2)", "temperature_txt": "Temperatura", - "voc_txt": "Compuestos orgánicos volátiles (VOC)" + "voc_txt": "Compuestos orgánicos volátiles (VOC)", + "polling_hint_txt": "Sugerencia: considere utilizar una frecuencia de sondeo de 5 segundos o más; el valor predeterminado es 10 segundos." } diff --git a/admin/i18n/fr/translations.json b/admin/i18n/fr/translations.json index be017a0..ea2a327 100644 --- a/admin/i18n/fr/translations.json +++ b/admin/i18n/fr/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "ID court (les 5 premiers chiffres du numéro de série)", "so2_txt": "Dioxyde de soufre (SO2)", "temperature_txt": "Température", - "voc_txt": "Composés organiques volatils (VOC)" + "voc_txt": "Composés organiques volatils (VOC)", + "polling_hint_txt": "Astuce : envisagez d'utiliser une fréquence d'interrogation de 5 secondes ou plus, la valeur par défaut étant de 10 secondes." } diff --git a/admin/i18n/it/translations.json b/admin/i18n/it/translations.json index 0aec315..fee55b1 100644 --- a/admin/i18n/it/translations.json +++ b/admin/i18n/it/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "ID breve (i primi 5 cifre del numero di serie)", "so2_txt": "Solfidio (SO2)", "temperature_txt": "Temperatura", - "voc_txt": "Composti organici volatili (VOC)" + "voc_txt": "Composti organici volatili (VOC)", + "polling_hint_txt": "Suggerimento: considerare l'utilizzo di una frequenza di polling di 5 secondi o più, il valore predefinito è 10 secondi." } diff --git a/admin/i18n/nl/translations.json b/admin/i18n/nl/translations.json index a91e331..6222b48 100644 --- a/admin/i18n/nl/translations.json +++ b/admin/i18n/nl/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "Kort ID (de eerste 5 cijfers van het serienummer)", "so2_txt": "Zwavelgolf (SO2)", "temperature_txt": "Temperatuur", - "voc_txt": "Vervuilde organisch materiaal (VOC)" + "voc_txt": "Vervuilde organisch materiaal (VOC)", + "polling_hint_txt": "Tip: Overweeg een pollingfrequentie van 5 seconden of meer te gebruiken; de standaardwaarde is 10 seconden." } diff --git a/admin/i18n/pl/translations.json b/admin/i18n/pl/translations.json index b459279..751b9f6 100644 --- a/admin/i18n/pl/translations.json +++ b/admin/i18n/pl/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "Krótki ID (pierwsze 5 cyfr numeru seryjnego)", "so2_txt": "Dwutlenek węgla (SO2)", "temperature_txt": "Temperatura", - "voc_txt": "Wybuchowe składniki organiczne (VOC)" + "voc_txt": "Wybuchowe składniki organiczne (VOC)", + "polling_hint_txt": "Wskazówka: rozważ użycie częstotliwości odpytywania wynoszącej 5 sekund lub więcej, wartość domyślna wynosi 10 sekund." } diff --git a/admin/i18n/pt/translations.json b/admin/i18n/pt/translations.json index 806544f..4e5c37d 100644 --- a/admin/i18n/pt/translations.json +++ b/admin/i18n/pt/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "ID curto (os 5 primeiros dígitos do número de série)", "so2_txt": "Dióxido de enxofre (SO2)", "temperature_txt": "Temperatura", - "voc_txt": "Compostos orgânicos voláteis (VOC)" + "voc_txt": "Compostos orgânicos voláteis (VOC)", + "polling_hint_txt": "Dica: Considere usar uma frequência de pesquisa de 5 segundos ou mais, o padrão é 10 segundos." } diff --git a/admin/i18n/ru/translations.json b/admin/i18n/ru/translations.json index ce12808..a52cb46 100644 --- a/admin/i18n/ru/translations.json +++ b/admin/i18n/ru/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "Короткий ID (первые 5 цифр номера прибора)", "so2_txt": "Диоксид серы (SO2)", "temperature_txt": "Температура", - "voc_txt": "Вольтажные органические соединения (VOC)" + "voc_txt": "Вольтажные органические соединения (VOC)", + "polling_hint_txt": "Подсказка: рассмотрите возможность использования частоты опроса 5 секунд или более, значение по умолчанию — 10 секунд." } diff --git a/admin/i18n/uk/translations.json b/admin/i18n/uk/translations.json index c2269a9..a677559 100644 --- a/admin/i18n/uk/translations.json +++ b/admin/i18n/uk/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "Короткий ідентифікатор (перші 5 цифр серійного номера)", "so2_txt": "Діоксид сірки (SO2)", "temperature_txt": "температура", - "voc_txt": "Летючі органічні сполуки (VOC)" + "voc_txt": "Летючі органічні сполуки (VOC)", + "polling_hint_txt": "Підказка: спробуйте використовувати частоту опитування 5 секунд або більше, за замовчуванням 10 секунд." } diff --git a/admin/i18n/zh-cn/translations.json b/admin/i18n/zh-cn/translations.json index c0e778d..eb5c1db 100644 --- a/admin/i18n/zh-cn/translations.json +++ b/admin/i18n/zh-cn/translations.json @@ -38,5 +38,6 @@ "shortId_txt": "短ID(序列号的前5位)", "so2_txt": "硫化氢(SO2)", "temperature_txt": "温度", - "voc_txt": "挥发性有机物(VOC)" + "voc_txt": "挥发性有机物(VOC)", + "polling_hint_txt": "提示:考虑使用 5 秒或更长的轮询频率,默认值为 10 秒。" } diff --git a/admin/index_m.html b/admin/index_m.html index ae1d39b..a9ee5b3 100644 --- a/admin/index_m.html +++ b/admin/index_m.html @@ -38,6 +38,10 @@ disableIPInput(); onChange(); }); + $("#retrievalRate").on("change", () => { + limitRetrievalRate($("#retrievalRate").val()); + onChange(); + }); disableIPInput(); onChange(false); if (M) M.updateTextFields(); @@ -70,6 +74,15 @@ obj.connectViaIP = $("#connectViaIP").prop("checked"); callback(obj); } + + function limitRetrievalRate(rate) { + if (rate < 2) { + return $("#retrievalRate").val(2); + } else if (rate > 3600) { + return $("#retrievalRate").val(3600); + } + } +