Grizzelbee / ioBroker.dysonairpurifier

ioBroker Adapter to control to your dyson fan and air purifier devices such as Pure Cool, Hot & Cool and others.
MIT License
13 stars 7 forks source link

Refactor to current standards #271

Closed Arcticon closed 4 months ago

Arcticon commented 4 months ago

Habe mal ein bisschen geholfen das Projekt auf den aktuellen Stand der Dinge in JS zu bringen :) Bitte einmal testen!

Bin auch gerade dabei das Projekt in TS umzusetzen.

Arcticon commented 4 months ago

ich pushe mal einen fix, damit die Windows Pipeline wieder geht

Arcticon commented 4 months ago

@Grizzelbee kannst du einmal im ioBroker testen ob alles funktioniert? Bin leider noch nicht dazu gekommen :/

Grizzelbee commented 4 months ago

@Arcticon Vielen Dank für deine Arbeit und Mühe!!

kannst du einmal im ioBroker testen ob alles funktioniert? Bin leider noch nicht dazu gekommen :/

Ja - bin gerade auf dem Weg dazu. Deshalb habe ich den PR auch in meinen Development Branch verschoben. Main nutze ich ausschließlich für Releases.

Grizzelbee commented 4 months ago

Okay - der Start des Adapters fährt aktuell voll gegen die Wand:

<!--StartFragment-->
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | info | Restart adapter system.adapter.dysonairpurifier.0 because enabled
-- | -- | -- | --
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | instance system.adapter.dysonairpurifier.0 terminated with code 1 (JS_CONTROLLER_STOPPED)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: Node.js v20.12.2
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]:
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at node:internal/main/run_main_module:28:49
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at Module._load (node:internal/modules/cjs/loader:1022:12)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at Module.load (node:internal/modules/cjs/loader:1206:32)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at Module._compile (node:internal/modules/cjs/loader:1369:14)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at Object.<anonymous> (C:\iobroker\node_modules\iobroker.dysonairpurifier\main.js:1676:3)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at new dysonAirPurifier (C:\iobroker\node_modules\iobroker.dysonairpurifier\main.js:50:5)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: at new AdapterClass (C:\iobroker\node_modules\@iobroker\js-controller-adapter\build\lib\adapter\adapter.js:112:21)
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: TypeError: Cannot set property config of #<dysonAirPurifier> which has only a getter
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]:
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: ^
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: this.config = {};
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.998 | error | Caught by controller[0]: C:\iobroker\node_modules\@iobroker\js-controller-adapter\build\lib\adapter\adapter.js:112
host.DESKTOP-NG6GUOJ | 2024-05-08 10:27:38.350 | info | instance system.adapter.dysonairpurifier.0 started with pid 40700

<!--EndFragment-->

image

Ich gucke mir das gerade mal an ...

Arcticon commented 4 months ago

oh stimmt. Mein Ziel war nur die typen richtig anzuzeigen. wenn du die function entfernst sollte es wieder funktionieren. dann muss ich wohl einen anderen weg finden die AdapterOptions zu typisieren

Arcticon commented 4 months ago

@Grizzelbee ich habe einen fix bei mir gepushed, kannst du den mal testen?

Grizzelbee commented 4 months ago

@Grizzelbee ich habe einen fix bei mir gepushed, kannst du den mal testen?

Läuft nicht:

<!--StartFragment-->
dysonairpurifier.0 | 2024-05-08 10:54:35.181 | debug | Plugin sentry Initialize Plugin (enabled=true)
-- | -- | -- | --
dysonairpurifier.0 | 2024-05-08 10:54:02.881 | info | terminating
dysonairpurifier.0 | 2024-05-08 10:54:02.378 | warn | Terminated (UNCAUGHT_EXCEPTION): Without reason
dysonairpurifier.0 | 2024-05-08 10:54:02.378 | debug | Plugin sentry destroyed
dysonairpurifier.0 | 2024-05-08 10:54:02.378 | info | terminating
dysonairpurifier.0 | 2024-05-08 10:54:02.378 | info | Cleaned up everything...
dysonairpurifier.0 | 2024-05-08 10:54:02.372 | error | Cannot read properties of undefined (reading 'then')
dysonairpurifier.0 | 2024-05-08 10:54:02.372 | error | TypeError: Cannot read properties of undefined (reading 'then') at dysonAirPurifier.onReady (C:\iobroker\node_modules\iobroker.dysonairpurifier\main.js:1091:9) at dysonAirPurifier.emit (node:events:518:28) at dysonAirPurifier.emit (node:domain:488:12) at dysonAirPurifier._callReadyHandler (C:\iobroker\node_modules\@iobroker\js-controller-adapter\src\lib\adapter\adapter.ts:11899:18) at C:\iobroker\node_modules\@iobroker\js-controller-adapter\src\lib\adapter\adapter.ts:11876:26
dysonairpurifier.0 | 2024-05-08 10:54:02.329 | error | unhandled promise rejection: Cannot read properties of undefined (reading 'then')
dysonairpurifier.0 | 2024-05-08 10:54:02.329 | error | Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
dysonairpurifier.0 | 2024-05-08 10:54:02.323 | info | starting. Version 3.1.7 in C:/iobroker/node_modules/iobroker.dysonairpurifier, node: v20.12.2, js-controller: 5.0.19
dysonairpurifier.0 | 2024-05-08 10:54:02.208 | debug | Plugin sentry Initialize Plugin (enabled=true)

<!--EndFragment-->

Das reine entfernen der get config Funktion hat den Adapter aber weider zum Laufen gebracht.

Grizzelbee commented 4 months ago

Hast das # da einen Nährwert, oder ist das ein typo?

image

Arcticon commented 4 months ago

das # ist das fuer private properties: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_properties

Arcticon commented 4 months ago

bei mir startet die instanz auf jeden fall: image

Grizzelbee commented 4 months ago

bei mir startet die instanz auf jeden fall:

Naja - Jein . Sie crashed einfach definiert an einer anderen Stelle.

Ich habe gerade noch ein paar kleine Dinge in meinen Dev-Branch gepushed. Die solltest Du vielleicht noch mergen.

Arcticon commented 4 months ago

Danke! Funktioniert der Adapter wieder?

Grizzelbee commented 4 months ago

Ich bin wieder auf die Version von vor vier Stunden zurück - also ohne diese get config Geschichte. Das läuft soweit. Das Einzige das mir aufgefallen ist, ist das die ganzen Auswahllisten für nicht zu erratende Werte kaputt gegangen sind (Filter, TempUnit des Displays, ...). Da stehen nur noch die API-Werte drin (GHEP, True/false, ...).

Und es wäre gut die dysonConstants.js-Datei nicht umzuformatieren. Die Formatierung diente massiv der Übersicht.

Arcticon commented 4 months ago

was genau meinst du mit die ganzen Auswahllisten für nicht zu erratende Werte kaputt gegangen sind ?

Grizzelbee commented 4 months ago

Ich meine das hier: image

Die Werte kommen aus den dysonConstants: image

und werden unter anderem hier: image

über getValueList zugeordnet.

Arcticon commented 4 months ago

In der "alten" version sehen die werten genau so aus wie in der neuen version. hast du einen vorher nachher vergleich fuer mich?

Grizzelbee commented 4 months ago

In der "alten" version sehen die werten genau so aus wie in der neuen version. hast du einen vorher nachher vergleich fuer mich?

Tut mir leid - Du hast recht. Das ist ein Problem im Admin; nicht im Adapter.

https://github.com/ioBroker/ioBroker.admin/issues/2439

Arcticon commented 4 months ago

dann fixe ich den mal :)

Arcticon commented 4 months ago

issue ist schon gefixed: https://github.com/ioBroker/ioBroker.admin/commit/fb8a69ead3eea9ce155f326afd1cab16dd5ac662