Skip to content

Commit

Permalink
Merge pull request #294 from Grizzelbee/development
Browse files Browse the repository at this point in the history
V3.2.1
  • Loading branch information
Grizzelbee authored Jun 4, 2024
2 parents 9eeb765 + 44847f9 commit 8db482e
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 93 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ All states report whether there is a failure or not. `True` means a failure, `fa

### **WORK IN PROGRESS**

### 3.2.1 (2024-06-04) (Marching on)
- (grizzelbee) Upd: Dependencies got updated
- (grizzelbee) Upd: [#286](https://github.com/Grizzelbee/ioBroker.dysonairpurifier/issues/286) Fixed polling which got broken in v3.1.10


### 3.2.0 (2024-05-28) (Marching on)

- (grizzelbee) Chg: Lamps (Product type 552a) won't generate a warning on startup any longer but show an info that they are not supported by this adapter.
Expand Down
15 changes: 14 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
{
"common": {
"name": "dysonairpurifier",
"version": "3.2.0",
"version": "3.2.1",
"news": {
"3.2.1": {
"en": "Fix: Fixed polling which got broken in v3.1.10\nChg: Dependencies got updated",
"de": "Fix: Polling wurde korrigiert nachdem es in Version 3.1.10 kaputt gegangen ist.\nÄnderung: Abhängigkeiten wurden aktualisiert",
"ru": "Исправлено: исправлен опрос, который был нарушен в версии 3.1.10\nChg: зависимости обновлены.",
"pt": "Correção: Corrigida a pesquisa que foi interrompida na v3.1.10\nAlteração: As dependências foram atualizadas",
"nl": "Fix: Vaste polling die kapot ging in v3.1.10\nChg: Afhankelijkheden zijn bijgewerkt",
"fr": "Correctif : correction de l'interrogation qui était interrompue dans la v3.1.10\nChg : les dépendances ont été mises à jour",
"it": "Correzione: risolto il polling che non funzionava nella versione 3.1.10\nChg: le dipendenze sono state aggiornate",
"es": "Solución: Se corrigió el sondeo que se rompió en v3.1.10\nChg: Se actualizaron las dependencias",
"pl": "Poprawka: Naprawiono odpytywanie, które uległo uszkodzeniu w wersji 3.1.10\nChg: Zaktualizowano zależności",
"uk": "Виправлення: виправлено опитування, яке було порушено у версії 3.1.10\nChg: оновлено залежності",
"zh-cn": "修复:修复了 v3.1.10 中损坏的轮询\nChg:依赖项已更新"
},
"3.2.0": {
"en": "Chg: Lamps (Product type 552a) won't generate a warning on startup any longer but show an info that they are not supported by this adapter\nChg: Vacuum cleaner robots (Product types 276 and 277) won't generate a warning on startup any longer but show an info that they are not supported by this adapter\nNew: [#289](https://github.com/Grizzelbee/ioBroker.dysonairpurifier/issues/289) Added Support for Dyson Purifier Big+Quiet Formaldehyde (BP03, Produce type 664)\n Fix: [#287](https://github.com/Grizzelbee/ioBroker.dysonairpurifier/issues/287) Added Switzerland again to config\nUpd: Dependencies got updated\nChg: removed obsolete index_m\nFix: Fixed broken NO2Index\nFix: Fixed broken fan speeds 0-10\nFix: Fixed polling of sensor data\nFix: setting fan speed = Auto works\n",
"de": "Änderung: Lampen (Produkttyp 552a) generieren beim Start keine Warnung mehr, sondern zeigen einen Hinweis an, dass sie von diesem Adapter nicht unterstützt werden.\nÄnderung: Staubsaugerroboter (Produkttypen 276 und 277) generieren keine Warnung mehr Starten Sie nicht mehr, zeigen Sie jedoch die Information an, dass sie von diesem Adapter nicht unterstützt werden.\nNeu: [#289](https://github.com/Grizzelbee/ioBroker.dysonairpurifier/issues/289) Unterstützung für Dyson Purifier Big+Quiet Formaldehyde hinzugefügt (BP03, Produce-Typ 664)\n Fix: [#287](https://github.com/Grizzelbee/ioBroker.dysonairpurifier/issues/287) Schweiz erneut zur Konfiguration hinzugefügt\nAktualisiert: Abhängigkeiten wurden aktualisiert\nÄnderung: veralteter index_m entfernt \nFix: Fehlerhafter NO2Index behoben\nFix: Defekte Lüftergeschwindigkeiten 0-10 behoben\nFix: Abfrage von Sensordaten behoben\nFix: Einstellung der Lüftergeschwindigkeit = Auto funktioniert\n",
Expand Down
30 changes: 21 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const {
SPECIAL_PROPERTIES,
getNameToDysoncodeTranslation
} = require('./dysonConstants.js');
const {setInterval} = require("node:timers/promises");

// Variable definitions
// let adapter = null;
Expand Down Expand Up @@ -663,7 +664,7 @@ class dysonAirPurifier extends utils.Adapter {
[
'product-errors',
'product-warnings',
'module-warnings',
'module-errors',
'module-warnings'
].includes(dysonCode)
//row === 'product-errors' ||
Expand Down Expand Up @@ -1184,9 +1185,16 @@ class dysonAirPurifier extends utils.Adapter {
this.subscribeStates(`${device.Serial}.Sensor.PM25Index`);
}

async pollDeviceInfo(thisDevice, adapterLog) {
/**
*
* @param thisDevice {Object} link to the current Device object
* @param adapterLog {Object} link to the adapters log output
* @param reason {string} the reason why this function is called (for logging purposes)
* @returns {Promise<void>}
*/
async pollDeviceInfo(thisDevice, adapterLog, reason) {
adapterLog.debug(
`Updating device [${thisDevice.Serial}] (polling API scheduled).`
`Updating device [${thisDevice.Serial}] (polling API ${reason}).`
);
try {
// possible messages:
Expand Down Expand Up @@ -1285,7 +1293,7 @@ class dysonAirPurifier extends utils.Adapter {
function () {}
);
// Sends an initial request for current state of device
await adapter.pollDeviceInfo(thisDevice, adapterLog);
await adapter.pollDeviceInfo(thisDevice, adapterLog, 'initially');
// expect the adapter 20 seconds after first poll as Set-up
setTimeout(()=>{
adapterIsSetUp = true;
Expand All @@ -1311,11 +1319,15 @@ class dysonAirPurifier extends utils.Adapter {
`Starting Polltimer with a ${adapter.config.pollInterval} seconds interval.`
);
// start refresh scheduler with interval from adapters config
thisDevice.updateIntervalHandle = setTimeout( async () => {
await adapter.pollDeviceInfo(thisDevice, adapterLog);
},
adapter.config.pollInterval * 1000
);
if (adapter.config.pollInterval > 0) {
thisDevice.updateIntervalHandle = setTimeout(function schedule(){
adapter.pollDeviceInfo(thisDevice, adapterLog, '@ regular schedule');
thisDevice.updateIntervalHandle = setTimeout(schedule, adapter.config.pollInterval * 1000);
}, adapter.config.pollInterval * 1000);

} else {
adapterLog.info(`Disabled scheduled polling for device ${thisDevice.Serial}`);
}
});
/****************
* Message
Expand Down
142 changes: 68 additions & 74 deletions package-lock.json

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

Loading

0 comments on commit 8db482e

Please sign in to comment.