Skip to content

Commit

Permalink
Merge pull request #140 from Grizzelbee/Development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Grizzelbee authored Oct 4, 2021
2 parents 85491ac + 8933e64 commit b87dcb6
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 28 deletions.
14 changes: 13 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"common": {
"name": "dysonairpurifier",
"version": "2.0.0",
"version": "2.0.1",
"news": {
"2.0.1": {
"en": "* Fixed Sentry Error Cannot read property '3' of undefined, * Turning on HeatingMode should work now, * updated dependencies",
"de": "* Sentry Error behoben Kann die Eigenschaft '3' von undefined nicht lesen, * Das Einschalten des Heizmodus sollte jetzt funktionieren, * Abhängigkeiten aktualisiert.",
"ru": "* Исправлена ​​ошибка Sentry. Невозможно прочесть свойство '3' из undefined, * Включение режима отопления теперь должно работать, * обновленные зависимости",
"pt": "* Erro de Sentinela corrigido, não é possível ler a propriedade '3' de indefinido, * Ativar o HeatingMode deve funcionar agora, * dependências atualizadas",
"nl": "* Vaste Sentry-fout Kan eigenschap '3' van undefined niet lezen, * Verwarmingsmodus inschakelen zou nu moeten werken, * bijgewerkte afhankelijkheden",
"fr": "* Correction de l'erreur Sentry Impossible de lire la propriété '3' de non défini, * L'activation du HeatingMode devrait fonctionner maintenant, * Dépendances mises à jour",
"it": "* Risolto errore Sentry Impossibile leggere la proprietà '3' di undefined, * L'attivazione della modalità di riscaldamento dovrebbe funzionare ora, * dipendenze aggiornate",
"es": "* Se corrigió el error de Sentry No se puede leer la propiedad '3' de indefinido, * Activar el modo de calefacción debería funcionar ahora, * dependencias actualizadas",
"pl": "* Naprawiono błąd Sentry Cannot read property '3' undefined, * Włączenie trybu ogrzewania powinno teraz działać, * zaktualizowane zależności",
"zh-cn": "* 固定哨兵错误无法读取未定义的属性“3”,* 现在应该可以打开加热模式,* 更新依赖项"
},
"2.0.0": {
"en": "Highlights: Breaking Change: All ON/OFF-switches are type bool now - Added DeepCleanCycle to known data points - Fix: Switching water hardness now really works - See changelog for all changes!",
"de": "Highlights: Breaking Change: Alle ON/OFF-Schalter sind jetzt vom Typ bool - DeepCleanCycle zu bekannten Datenpunkten hinzugefügt - Fix: Wasserhärte-Umschaltung funktioniert jetzt wirklich - Siehe Changelog für alle Änderungen!",
Expand Down
25 changes: 16 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class dysonAirPurifier extends utils.Adapter {
await dysonUtils.getAngles(this, dysonAction, id, state)
.then((result) => {
this.log.debug(`Result of getAngles: ${JSON.stringify(result)}`);
result.ancp = (Number.parseInt(result.ancp.val) || 90);
result.ancp = (result.ancp.val==='CUST'? 90 : Number.parseInt(result.ancp.val));
this.log.debug(`Result of parseInt(result.ancp.val): ${result.ancp}, typeof: ${typeof result.ancp }`);
result.osal = Number.parseInt(result.osal.val);
result.osau = Number.parseInt(result.osau.val);
if (result.osal + result.ancp > 355) {
Expand All @@ -187,16 +188,22 @@ class dysonAirPurifier extends utils.Adapter {
// switches defined as boolean must get the proper value to be send
// this is to translate between the needed states for ioBroker and the device
// boolean switches are better for visualizations and other adapters like text2command
if (ActionData[3]==='boolean' && ActionData[5].startsWith('switch')){
if (state.val){
// handle special action "humidification" where ON is not ON but HUME
if (dysonAction === 'hume'){
messageData = {[dysonAction]: 'HUMD'};
if (typeof ActionData !== 'undefined') {
if ( ActionData[3]==='boolean' && ActionData[5].startsWith('switch')){
// current state is TRUE!
if (state.val) {
// handle special action "humidification" where ON is not ON but HUME
if (dysonAction === 'hume'){
messageData = {[dysonAction]: 'HUMD'};
// handle special action "HeatingMode" where ON is not ON but HEAT
} else if (dysonAction === 'hmod'){
messageData = {[dysonAction]: 'HEAT'};
} else {
messageData = {[dysonAction]: 'ON'};
}
} else {
messageData = {[dysonAction]: 'ON'};
messageData = {[dysonAction]: 'OFF'};
}
} else {
messageData = {[dysonAction]: 'OFF'};
}
}
// only send to device if change should set a device value
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.dysonairpurifier",
"version": "2.0.0",
"version": "2.0.1",
"description": "dyson air purifiers and fans",
"author": {
"name": "grizzelbee",
Expand All @@ -24,13 +24,13 @@
},
"dependencies": {
"@iobroker/adapter-core": "^2.5.1",
"axios": "^0.21.4",
"axios": "^0.22.0",
"flatted": "^3.2.2",
"https": "^1.0.0",
"lodash": "^4.17.21",
"mqtt": "^4.2.8",
"path": "^0.12.7",
"snyk": "^1.721.0",
"snyk": "^1.730.0",
"ssl-root-cas": "^1.3.1"
},
"devDependencies": {
Expand All @@ -39,7 +39,7 @@
"@types/chai-as-promised": "^7.1.4",
"@types/gulp": "^4.0.9",
"@types/mocha": "^9.0.0",
"@types/node": "^16.10.1",
"@types/node": "^16.10.2",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^10.0.4",
"@types/sinon-chai": "^3.2.5",
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ Which is what the dyson app does also.

## Changelog

### V2.0.1 (2021-10-04) (Lost in forever)
* (grizzelbee) Fix: Turning on HeatingMode should work now
* (grizzelbee) Fix: Sentry-error [2690134161](https://sentry.io/organizations/nocompany-6j/issues/2690134161/?project=5735771) -> Cannot read property '3' of undefined
* (grizzelbee) Upd: Updated dependencies

### V2.0.0 (2021-09-26) (Lost in forever)
* (grizzelbee) New: Added DeepCleanCycle to known data points
Expand Down

0 comments on commit b87dcb6

Please sign in to comment.